#[non_exhaustive]pub struct CompletionRequest {
pub model: String,
pub system: Option<String>,
pub messages: Vec<Message>,
pub tools: Vec<ToolSpec>,
pub tool_choice: ToolChoice,
pub response_format: Option<JsonSchema>,
pub max_tokens: Option<u32>,
pub temperature: Option<f32>,
pub stop: Vec<String>,
pub web_search: bool,
}Expand description
Top-level request to an LLM provider.
Construct via CompletionRequest::new, then populate fields directly.
#[non_exhaustive]: provider-shaped sampling fields (top_p, seed, …)
will be added over time; build through new so
such additions stay non-breaking.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.model: StringThe model identifier (e.g. "fast-2", "reasoning-pro").
system: Option<String>Optional system prompt text prepended before the conversation.
messages: Vec<Message>Ordered list of messages in the conversation.
tools: Vec<ToolSpec>Tool definitions available to the model.
tool_choice: ToolChoiceHow the model should decide whether to call a tool.
response_format: Option<JsonSchema>When set, instructs the provider to return structured JSON output.
max_tokens: Option<u32>Maximum number of tokens the model may generate.
temperature: Option<f32>Sampling temperature in [0.0, 2.0]. Lower is more deterministic.
stop: Vec<String>Token sequences that cause the model to stop generating.
web_search: boolWhen true, the model may search the public web to ground its answer.
This is a provider-agnostic capability hint: a provider maps it to its
native mechanism (Vertex Gemini → the googleSearch grounding tool,
alongside any tools function declarations) and a provider without web
search ignores it. Defaults to false; the agent’s answering loop
(run_turn) sets it from its RunTurnOptions.web_search, so auxiliary
calls (summarization, classification) that bypass that loop never offer
search.
Implementations§
Source§impl CompletionRequest
impl CompletionRequest
Sourcepub fn new(model: impl Into<String>) -> Self
pub fn new(model: impl Into<String>) -> Self
Creates a new request for the given model with sensible defaults:
empty messages, tools, and stop lists; tool_choice set to
ToolChoice::Auto; all optional fields None.
Trait Implementations§
Source§impl Clone for CompletionRequest
impl Clone for CompletionRequest
Source§fn clone(&self) -> CompletionRequest
fn clone(&self) -> CompletionRequest
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more