# `Dagger.LLM`
[🔗](https://github.com/dagger/dagger/blob/v0.21.8/sdk/elixir/lib/dagger/gen/llm.ex#L2)

Dagger.LLM

# `t`

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

# `attempt`

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

create a branch in the LLM's history

# `bind_result`

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

returns the type of the current state

# `env`

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

return the LLM's current environment

# `has_prompt`

```elixir
@spec has_prompt(t()) :: {:ok, boolean()} | {:error, term()}
```

Indicates whether there are any queued prompts or tool results to send to the model

# `history`

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

return the llm message history

# `history_json`

```elixir
@spec history_json(t()) :: {:ok, Dagger.JSON.t()} | {:error, term()}
```

return the raw llm message history as json

# `id`

```elixir
@spec id(t()) :: {:ok, String.t()} | {:error, term()}
```

A unique identifier for this LLM.

# `last_reply`

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

return the last llm reply from the history

# `loop`

```elixir
@spec loop(t()) :: t()
```

Submit the queued prompt, evaluate any tool calls, queue their results, and keep going until the model ends its turn

# `model`

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

return the model used by the llm

# `provider`

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

return the provider used by the llm

# `step`

```elixir
@spec step(t()) :: {:ok, t()} | {:error, term()}
```

Submit the queued prompt or tool call results, evaluate any tool calls, and queue their results

# `sync`

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

synchronize LLM state

# `token_usage`

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

returns the token usage of the current state

# `tools`

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

print documentation for available tools

# `with_blocked_function`

```elixir
@spec with_blocked_function(t(), String.t(), String.t()) :: t()
```

Return a new LLM with the specified function no longer exposed as a tool

# `with_env`

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

allow the LLM to interact with an environment via MCP

# `with_mcp_server`

```elixir
@spec with_mcp_server(t(), String.t(), Dagger.Service.t()) :: t()
```

Add an external MCP server to the LLM

# `with_model`

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

swap out the llm model

# `with_prompt`

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

append a prompt to the llm context

# `with_prompt_file`

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

append the contents of a file to the llm context

# `with_static_tools`

```elixir
@spec with_static_tools(t()) :: t()
```

Use a static set of tools for method calls, e.g. for MCP clients that do not support dynamic tool registration

# `with_system_prompt`

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

Add a system prompt to the LLM's environment

# `without_default_system_prompt`

```elixir
@spec without_default_system_prompt(t()) :: t()
```

Disable the default system prompt

# `without_message_history`

```elixir
@spec without_message_history(t()) :: t()
```

Clear the message history, leaving only the system prompts

# `without_system_prompts`

```elixir
@spec without_system_prompts(t()) :: t()
```

Clear the system prompts, leaving only the default system prompt

---

*Consult [api-reference.md](api-reference.md) for complete listing*
