pub struct LLMRequest { /* private fields */ }Expand description
Builder-style request passed into LanguageModel::respond.
Wraps the full conversation, model parameters, and tool definitions a provider needs in order to execute a call.
Implementations§
Source§impl LLMRequest
impl LLMRequest
Sourcepub fn new(messages: impl Into<Vec<Message>>) -> Self
pub fn new(messages: impl Into<Vec<Message>>) -> Self
Creates a request from the provided messages using default parameters.
Sourcepub fn with_tool_definitions(self, definitions: Vec<ToolDefinition>) -> Self
pub fn with_tool_definitions(self, definitions: Vec<ToolDefinition>) -> Self
Adds tool definitions to the request.
These define what tools the model can request. The model will emit
Event::ToolCall events when it wants to use a tool.
Sourcepub fn with_parameters(self, parameters: Parameters) -> Self
pub fn with_parameters(self, parameters: Parameters) -> Self
Overrides the sampling parameters used for this call.
Sourcepub const fn messages_mut(&mut self) -> &mut Vec<Message>
pub const fn messages_mut(&mut self) -> &mut Vec<Message>
Returns a mutable reference to messages for modification.
Sourcepub const fn parameters(&self) -> &Parameters
pub const fn parameters(&self) -> &Parameters
Returns the current parameter snapshot.
Sourcepub fn tool_definitions(&self) -> &[ToolDefinition]
pub fn tool_definitions(&self) -> &[ToolDefinition]
Returns the tool definitions.
Sourcepub fn into_parts(self) -> (Vec<Message>, Parameters, Vec<ToolDefinition>)
pub fn into_parts(self) -> (Vec<Message>, Parameters, Vec<ToolDefinition>)
Breaks the request into owned components.
Source§impl LLMRequest
impl LLMRequest
Sourcepub fn with_tools(self, tools: &mut Tools) -> LLMRequestWithTools<'_>
pub fn with_tools(self, tools: &mut Tools) -> LLMRequestWithTools<'_>
Attaches a mutable tool registry to the request.
This is for providers that execute tools internally (e.g., built-in tools).
For agent-controlled tool execution, use with_tool_definitions instead.
Trait Implementations§
Source§impl Clone for LLMRequest
impl Clone for LLMRequest
Source§fn clone(&self) -> LLMRequest
fn clone(&self) -> LLMRequest
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more