pub struct ChatParams {
pub messages: Vec<ChatMessage>,
pub tools: Option<Vec<ToolDefinition>>,
pub tool_choice: Option<ToolChoice>,
pub temperature: Option<f32>,
pub max_tokens: Option<u32>,
pub system: Option<String>,
pub reasoning_budget: Option<u32>,
pub structured_output: Option<JsonSchema>,
pub timeout: Option<Duration>,
pub extra_headers: Option<HeaderMap>,
pub metadata: HashMap<String, Value>,
}Expand description
Parameters for a chat completion request.
Most fields are optional — at minimum you need messages.
Use struct-update syntax for concise construction:
use llm_stack::{ChatParams, ChatMessage};
let params = ChatParams {
messages: vec![ChatMessage::user("Hello")],
max_tokens: Some(256),
temperature: Some(0.7),
..Default::default()
};§Serialization
ChatParams implements Serialize / Deserialize for logging and
request replay. The timeout and
extra_headers fields are skipped during
serialization because they are transport-layer concerns, not part of
the logical request.
§Equality
PartialEq is structural. The extra_headers field uses
http::HeaderMap, whose equality comparison is order-sensitive for
multi-valued headers. In practice this only matters in tests via
MockProvider::recorded_calls.
Fields§
§messages: Vec<ChatMessage>The conversation history.
tools: Option<Vec<ToolDefinition>>Tool definitions the model may invoke.
tool_choice: Option<ToolChoice>Controls whether and how the model uses tools.
temperature: Option<f32>Sampling temperature (0.0 = deterministic, higher = more random).
max_tokens: Option<u32>Upper bound on generated tokens.
system: Option<String>System prompt (used by providers that accept it separately from the message list).
reasoning_budget: Option<u32>Token budget for chain-of-thought reasoning, if the provider
supports Capability::Reasoning.
structured_output: Option<JsonSchema>JSON Schema that the model’s output must conform to.
timeout: Option<Duration>Per-request timeout. Skipped during serialization.
extra_headers: Option<HeaderMap>Extra HTTP headers to send with this request. Skipped during serialization.
metadata: HashMap<String, Value>Arbitrary key-value pairs forwarded to the provider. Useful for provider-specific features that don’t have a dedicated field.
Trait Implementations§
Source§impl Clone for ChatParams
impl Clone for ChatParams
Source§fn clone(&self) -> ChatParams
fn clone(&self) -> ChatParams
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more