pub struct Llm {
pub proc: Option<Arc<DaggerSessionProc>>,
pub selection: Selection,
pub graphql_client: DynGraphQLClient,
}Fields§
§proc: Option<Arc<DaggerSessionProc>>§selection: Selection§graphql_client: DynGraphQLClientImplementations§
Source§impl Llm
impl Llm
Sourcepub async fn context_tokens(&self) -> Result<isize, DaggerError>
pub async fn context_tokens(&self) -> Result<isize, DaggerError>
estimated number of tokens currently occupying the context window; unlike tokenUsage this is not cumulative over the session
Sourcepub async fn context_window(&self) -> Result<isize, DaggerError>
pub async fn context_window(&self) -> Result<isize, DaggerError>
The model’s total context window in tokens, or null if unknown (e.g. a local or uncatalogued model).
Sourcepub fn fork(&self, label: impl Into<String>) -> Llm
pub fn fork(&self, label: impl Into<String>) -> Llm
Fork the conversation, so that otherwise-identical follow-ups evaluate independently instead of deduplicating to a single cached result.
§Arguments
label- A label distinguishing this fork from its siblings, e.g. “attempt-2” when retrying a flaky evaluation.
Sourcepub async fn has_pending(&self) -> Result<bool, DaggerError>
pub async fn has_pending(&self) -> Result<bool, DaggerError>
Report whether anything is queued to send to the model: an unsent prompt or unevaluated tool results. When true, another step will do work; when false, the turn is complete.
Sourcepub async fn id(&self) -> Result<Id, DaggerError>
pub async fn id(&self) -> Result<Id, DaggerError>
A unique identifier for this LLM.
Sourcepub async fn last_reply(&self) -> Result<String, DaggerError>
pub async fn last_reply(&self) -> Result<String, DaggerError>
The text of the model’s most recent reply.
Sourcepub fn loop(&self) -> Llm
pub fn loop(&self) -> Llm
Send the queued prompt and step the model against the available tools, until it ends its turn: a reply with no tool calls and nothing left queued.
§Arguments
opt- optional argument, see inner type for documentation, use_opts to use
Sourcepub fn loop_opts(&self, opts: LlmLoopOpts) -> Llm
pub fn loop_opts(&self, opts: LlmLoopOpts) -> Llm
Send the queued prompt and step the model against the available tools, until it ends its turn: a reply with no tool calls and nothing left queued.
§Arguments
opt- optional argument, see inner type for documentation, use_opts to use
Sourcepub async fn messages(&self) -> Result<Vec<LlmMessage>, DaggerError>
pub async fn messages(&self) -> Result<Vec<LlmMessage>, DaggerError>
The full message history, as structured messages.
Sourcepub async fn model(&self) -> Result<String, DaggerError>
pub async fn model(&self) -> Result<String, DaggerError>
The model the conversation is running against, after resolving any configured default.
Sourcepub async fn portable_id(&self) -> Result<Id, DaggerError>
pub async fn portable_id(&self) -> Result<Id, DaggerError>
A portable, self-contained ID for the conversation that node() can resolve in any session. Unlike id, which may return an engine-local runtime handle valid only within the current session, this returns the recipe form suitable for persisting and later restoring the conversation. The recipe is flattened: bindings superseded during the session (workspace overlays recorded by each mutating tool call, and re-bound toolsets) are dropped, while the current workspace binding — including any pending, un-exported edits — is preserved.
Sourcepub async fn provider(&self) -> Result<String, DaggerError>
pub async fn provider(&self) -> Result<String, DaggerError>
The provider serving the model, e.g. “anthropic”, “openai”, “google”, or “local”.
Sourcepub async fn reasoning_effort(&self) -> Result<String, DaggerError>
pub async fn reasoning_effort(&self) -> Result<String, DaggerError>
The reasoning effort in use, e.g. “low”, “medium”, or “high”. Empty or “none” when reasoning is disabled.
Sourcepub async fn replay(&self) -> Result<Llm, DaggerError>
pub async fn replay(&self) -> Result<Llm, DaggerError>
Re-emit telemetry spans for the full message history, so a loaded conversation displays in the TUI.
Sourcepub async fn skills(&self) -> Result<Vec<LlmSkill>, DaggerError>
pub async fn skills(&self) -> Result<Vec<LlmSkill>, DaggerError>
The skills visible to the model, exactly as the ListSkills tool serves them: engine-embedded skills, skills installed with withSkills, and skills discovered in the workspace.
Sourcepub fn step(&self) -> Llm
pub fn step(&self) -> Llm
Advance the conversation by a single step: send the queued prompt or tool results to the model, evaluate any tool calls it makes, and queue their results. Use loop to step until the model ends its turn.
§Arguments
opt- optional argument, see inner type for documentation, use_opts to use
Sourcepub fn step_opts(&self, opts: LlmStepOpts) -> Llm
pub fn step_opts(&self, opts: LlmStepOpts) -> Llm
Advance the conversation by a single step: send the queued prompt or tool results to the model, evaluate any tool calls it makes, and queue their results. Use loop to step until the model ends its turn.
§Arguments
opt- optional argument, see inner type for documentation, use_opts to use
Sourcepub async fn sync(&self) -> Result<Llm, DaggerError>
pub async fn sync(&self) -> Result<Llm, DaggerError>
Force evaluation of the conversation’s pending operations (prompts, steps, loops) in the engine.
Sourcepub fn token_usage(&self) -> LlmTokenUsage
pub fn token_usage(&self) -> LlmTokenUsage
The cumulative token usage, summed across every API call in the conversation.
Sourcepub async fn tools(&self) -> Result<String, DaggerError>
pub async fn tools(&self) -> Result<String, DaggerError>
Render documentation for the tools currently exposed to the model.
Sourcepub async fn transcript(&self) -> Result<String, DaggerError>
pub async fn transcript(&self) -> Result<String, DaggerError>
The message history rendered as a plain-text transcript, suitable for feeding back to an LLM (e.g. for summarization).
Sourcepub fn with_mcp_server(
&self,
name: impl Into<String>,
service: impl IntoID<Id>,
) -> Llm
pub fn with_mcp_server( &self, name: impl Into<String>, service: impl IntoID<Id>, ) -> Llm
Add an external MCP server to the LLM
§Arguments
name- The name of the MCP serverservice- The MCP service to run and communicate with over stdio
Sourcepub fn with_model(&self, model: impl Into<String>) -> Llm
pub fn with_model(&self, model: impl Into<String>) -> Llm
Change the model for the rest of the conversation. The message history is preserved; the new model takes effect on the next step.
§Arguments
model- The model to use, e.g. “claude-sonnet-4-5” or “gpt-5.4”.opt- optional argument, see inner type for documentation, use_opts to use
Sourcepub fn with_model_opts<'a>(
&self,
model: impl Into<String>,
opts: LlmWithModelOpts<'a>,
) -> Llm
pub fn with_model_opts<'a>( &self, model: impl Into<String>, opts: LlmWithModelOpts<'a>, ) -> Llm
Change the model for the rest of the conversation. The message history is preserved; the new model takes effect on the next step.
§Arguments
model- The model to use, e.g. “claude-sonnet-4-5” or “gpt-5.4”.opt- optional argument, see inner type for documentation, use_opts to use
Sourcepub fn with_prompt(&self, prompt: impl Into<String>) -> Llm
pub fn with_prompt(&self, prompt: impl Into<String>) -> Llm
Queue a user prompt, to be sent to the model on the next step or loop.
§Arguments
prompt- The prompt to send
Sourcepub fn with_prompt_file(&self, file: impl IntoID<Id>) -> Llm
pub fn with_prompt_file(&self, file: impl IntoID<Id>) -> Llm
Queue a file’s contents as a user prompt, like withPrompt.
§Arguments
file- The file to read the prompt from
Sourcepub fn with_reasoning_effort(&self, effort: impl Into<String>) -> Llm
pub fn with_reasoning_effort(&self, effort: impl Into<String>) -> Llm
Change the reasoning effort for the rest of the conversation, overriding any configured default. The message history is preserved; the new effort takes effect on the next step.
§Arguments
effort- The reasoning effort, e.g. “low”, “medium”, or “high”; “none” disables reasoning. Supported levels are model-specific — some models also accept e.g. “minimal”, “xhigh”, or “max”.
Sourcepub fn with_response(&self, content: Vec<LlmContentBlockInput>) -> Llm
pub fn with_response(&self, content: Vec<LlmContentBlockInput>) -> Llm
Append an assistant response to the message history without calling the model, e.g. to reconstruct a conversation from another source.
§Arguments
content- The response contentopt- optional argument, see inner type for documentation, use_opts to use
Sourcepub fn with_response_opts(
&self,
content: Vec<LlmContentBlockInput>,
opts: LlmWithResponseOpts,
) -> Llm
pub fn with_response_opts( &self, content: Vec<LlmContentBlockInput>, opts: LlmWithResponseOpts, ) -> Llm
Append an assistant response to the message history without calling the model, e.g. to reconstruct a conversation from another source.
§Arguments
content- The response contentopt- optional argument, see inner type for documentation, use_opts to use
Sourcepub fn with_skills(&self, directory: impl IntoID<Id>) -> Llm
pub fn with_skills(&self, directory: impl IntoID<Id>) -> Llm
Install skills from a directory, adding them to the skills the model discovers with ListSkills and reads with ReadSkill. Each skill is a directory containing a SKILL.md with name and description frontmatter, discovered anywhere in the tree. Installed skills take precedence over skills discovered in the workspace, but cannot shadow the engine’s built-in skills.
§Arguments
directory- A directory containing skills, each a subdirectory holding a SKILL.md.
Sourcepub fn with_system_prompt(&self, prompt: impl Into<String>) -> Llm
pub fn with_system_prompt(&self, prompt: impl Into<String>) -> Llm
Add a system prompt, instructing the model across the whole conversation.
§Arguments
prompt- The system prompt to send
Sourcepub fn with_tool_result(
&self,
call_id: impl Into<String>,
content: impl Into<String>,
errored: bool,
) -> Llm
pub fn with_tool_result( &self, call_id: impl Into<String>, content: impl Into<String>, errored: bool, ) -> Llm
Append the result of a tool call to the message history.
§Arguments
call_id- The ID of the tool call this result responds tocontent- The content returned by the toolerrored- Whether the tool call resulted in an error
Sourcepub fn with_tools(&self, object: impl IntoID<Id>) -> Llm
pub fn with_tools(&self, object: impl IntoID<Id>) -> Llm
Expose an object’s methods as tools. Every eligible method of the bound object becomes a tool; a tool that returns this object’s own type replaces it as the new state. Repeatable to bind several objects.
§Arguments
object- The object whose methods become tools.opt- optional argument, see inner type for documentation, use_opts to use
Sourcepub fn with_tools_opts<'a>(
&self,
object: impl IntoID<Id>,
opts: LlmWithToolsOpts<'a>,
) -> Llm
pub fn with_tools_opts<'a>( &self, object: impl IntoID<Id>, opts: LlmWithToolsOpts<'a>, ) -> Llm
Expose an object’s methods as tools. Every eligible method of the bound object becomes a tool; a tool that returns this object’s own type replaces it as the new state. Repeatable to bind several objects.
§Arguments
object- The object whose methods become tools.opt- optional argument, see inner type for documentation, use_opts to use
Sourcepub fn with_workspace(&self, workspace: impl IntoID<Id>) -> Llm
pub fn with_workspace(&self, workspace: impl IntoID<Id>) -> Llm
Bind the LLM to a workspace, exposing its modules as tools exactly as the Dagger CLI would serve them for that workspace.
§Arguments
workspace- The workspace to work in.
Sourcepub fn without_default_system_prompt(&self) -> Llm
pub fn without_default_system_prompt(&self) -> Llm
Disable the default system prompt
Sourcepub fn without_message_history(&self) -> Llm
pub fn without_message_history(&self) -> Llm
Clear the message history, keeping only the system prompts.
Sourcepub fn without_system_prompts(&self) -> Llm
pub fn without_system_prompts(&self) -> Llm
Clear the user-added system prompts, keeping only the default system prompt.
Trait Implementations§
Source§impl Loadable for Llm
impl Loadable for Llm
Source§fn graphql_type() -> &'static str
fn graphql_type() -> &'static str
"Container").Source§fn from_query(
proc: Option<Arc<DaggerSessionProc>>,
selection: Selection,
graphql_client: DynGraphQLClient,
) -> Self
fn from_query( proc: Option<Arc<DaggerSessionProc>>, selection: Selection, graphql_client: DynGraphQLClient, ) -> Self
Auto Trait Implementations§
impl !RefUnwindSafe for Llm
impl !UnwindSafe for Llm
impl Freeze for Llm
impl Send for Llm
impl Sync for Llm
impl Unpin for Llm
impl UnsafeUnpin for Llm
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more