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_core::{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 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ChatParams
impl Debug for ChatParams
Source§impl Default for ChatParams
impl Default for ChatParams
Source§fn default() -> ChatParams
fn default() -> ChatParams
Source§impl<'de> Deserialize<'de> for ChatParams
impl<'de> Deserialize<'de> for ChatParams
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Loggable for ChatParams
impl Loggable for ChatParams
Source§fn log_description(&self) -> String
fn log_description(&self) -> String
Source§impl PartialEq for ChatParams
impl PartialEq for ChatParams
Source§fn eq(&self, other: &ChatParams) -> bool
fn eq(&self, other: &ChatParams) -> bool
self and other values to be equal, and is used by ==.