Dagger.LLM (dagger v0.18.2)

View Source

Dagger.LLM

Summary

Functions

create a branch in the LLM's history

returns the type of the current state

return the LLM's current environment

return the llm message history

return the raw llm message history as json

A unique identifier for this LLM.

return the last llm reply from the history

synchronize LLM state

return the model used by the llm

return the provider used by the llm

synchronize LLM state

returns the token usage of the current state

print documentation for available tools

allow the LLM to interact with an environment via MCP

swap out the llm model

append a prompt to the llm context

append the contents of a file to the llm context

Add a system prompt to the LLM's environment

Types

t()

@type t() :: %Dagger.LLM{client: term(), query_builder: term()}

Functions

attempt(llm, number)

@spec attempt(t(), integer()) :: t()

create a branch in the LLM's history

bind_result(llm, name)

@spec bind_result(t(), String.t()) :: Dagger.Binding.t() | nil

returns the type of the current state

env(llm)

@spec env(t()) :: Dagger.Env.t()

return the LLM's current environment

history(llm)

@spec history(t()) :: {:ok, [String.t()]} | {:error, term()}

return the llm message history

history_json(llm)

@spec history_json(t()) :: {:ok, String.t()} | {:error, term()}

return the raw llm message history as json

id(llm)

@spec id(t()) :: {:ok, Dagger.LLMID.t()} | {:error, term()}

A unique identifier for this LLM.

last_reply(llm)

@spec last_reply(t()) :: {:ok, String.t()} | {:error, term()}

return the last llm reply from the history

loop(llm)

@spec loop(t()) :: t()

synchronize LLM state

model(llm)

@spec model(t()) :: {:ok, String.t()} | {:error, term()}

return the model used by the llm

provider(llm)

@spec provider(t()) :: {:ok, String.t()} | {:error, term()}

return the provider used by the llm

sync(llm)

@spec sync(t()) :: {:ok, t()} | {:error, term()}

synchronize LLM state

token_usage(llm)

@spec token_usage(t()) :: Dagger.LLMTokenUsage.t()

returns the token usage of the current state

tools(llm)

@spec tools(t()) :: {:ok, String.t()} | {:error, term()}

print documentation for available tools

with_env(llm, env)

@spec with_env(t(), Dagger.Env.t()) :: t()

allow the LLM to interact with an environment via MCP

with_model(llm, model)

@spec with_model(t(), String.t()) :: t()

swap out the llm model

with_prompt(llm, prompt)

@spec with_prompt(t(), String.t()) :: t()

append a prompt to the llm context

with_prompt_file(llm, file)

@spec with_prompt_file(t(), Dagger.File.t()) :: t()

append the contents of a file to the llm context

with_system_prompt(llm, prompt)

@spec with_system_prompt(t(), String.t()) :: t()

Add a system prompt to the LLM's environment