pub struct ChatRequest {
pub messages: Vec<ChatMessage>,
pub model: Option<String>,
pub temperature: Option<f32>,
pub max_tokens: Option<u32>,
pub stream: bool,
pub tools: Option<Vec<ToolDefinition>>,
pub tool_choice: Option<ToolChoice>,
pub top_p: Option<f32>,
pub stop: Option<Vec<String>>,
pub response_format: Option<ResponseFormat>,
pub turn_id: Option<ConversationTurnId>,
pub mcp_servers: Vec<McpServerConfig>,
}Expand description
Configuration for a chat completion request
Fields§
§messages: Vec<ChatMessage>Conversation messages
model: Option<String>Model identifier (provider-specific)
temperature: Option<f32>Temperature for response randomness (0.0 - 2.0).
Support depends on each provider’s LlmCapabilities::TEMPERATURE flag.
Use validate_capabilities to check
before dispatch.
max_tokens: Option<u32>Maximum tokens to generate.
Support depends on each provider’s LlmCapabilities::MAX_TOKENS flag.
Use validate_capabilities to check
before dispatch.
stream: boolWhether to stream the response
tools: Option<Vec<ToolDefinition>>Tool definitions available for the model to call
tool_choice: Option<ToolChoice>Controls which tools the model may call
top_p: Option<f32>Nucleus sampling parameter (0.0 - 1.0)
stop: Option<Vec<String>>Stop sequences that halt generation
response_format: Option<ResponseFormat>Control over the response format (text, JSON, or schema-validated JSON)
turn_id: Option<ConversationTurnId>Conversation-turn correlation identifier.
When present, decorators such as MetricsProvider
can emit per-turn records in addition to their usual aggregation. The
identifier must be propagated from the inbound boundary; LLM providers
never generate it themselves.
mcp_servers: Vec<McpServerConfig>MCP servers an ACP-managed provider should expose to the model for native tool calling.
Only the Copilot Headless converse() path forwards these into the ACP
session/new request; providers without SDK tool calling ignore them.
Implementations§
Source§impl ChatRequest
impl ChatRequest
Sourcepub const fn new(messages: Vec<ChatMessage>) -> Self
pub const fn new(messages: Vec<ChatMessage>) -> Self
Create a new chat request with messages
Sourcepub fn with_mcp_servers(self, mcp_servers: Vec<McpServerConfig>) -> Self
pub fn with_mcp_servers(self, mcp_servers: Vec<McpServerConfig>) -> Self
Set the MCP servers an ACP-managed provider exposes to the model.
Sourcepub fn with_model(self, model: impl Into<String>) -> Self
pub fn with_model(self, model: impl Into<String>) -> Self
Set the model to use
Sourcepub const fn with_temperature(self, temperature: f32) -> Self
pub const fn with_temperature(self, temperature: f32) -> Self
Set the temperature
Sourcepub const fn with_max_tokens(self, max_tokens: u32) -> Self
pub const fn with_max_tokens(self, max_tokens: u32) -> Self
Set the maximum tokens
Sourcepub const fn with_streaming(self) -> Self
pub const fn with_streaming(self) -> Self
Enable streaming
Sourcepub fn with_tools(self, tools: Vec<ToolDefinition>) -> Self
pub fn with_tools(self, tools: Vec<ToolDefinition>) -> Self
Set the tool definitions
Sourcepub fn with_tool_choice(self, tool_choice: ToolChoice) -> Self
pub fn with_tool_choice(self, tool_choice: ToolChoice) -> Self
Set the tool choice
Sourcepub const fn with_top_p(self, top_p: f32) -> Self
pub const fn with_top_p(self, top_p: f32) -> Self
Set the top_p (nucleus sampling) parameter
Sourcepub fn with_response_format(self, response_format: ResponseFormat) -> Self
pub fn with_response_format(self, response_format: ResponseFormat) -> Self
Set the response format
Sourcepub const fn with_turn_id(self, turn_id: ConversationTurnId) -> Self
pub const fn with_turn_id(self, turn_id: ConversationTurnId) -> Self
Attach a conversation-turn correlation identifier.
The identifier is expected to have been generated at the inbound boundary. Calling this method on a downstream request propagates the same identifier — it must not be freshly generated here.
Sourcepub fn has_images(&self) -> bool
pub fn has_images(&self) -> bool
Check whether any message in this request contains images