pub struct OpenAIRequest {
pub model: String,
pub messages: Vec<OpenAIMessage>,
pub stream: bool,
pub max_tokens: Option<u32>,
pub temperature: Option<f32>,
pub tools: Option<Vec<Value>>,
}Expand description
An OpenAI chat-completions request.
Optional fields are omitted when unset. The client also uses this as its internal request representation before translating to Anthropic at the transport boundary.
Fields§
§model: StringModel identifier (e.g., “gpt-4”, “qwen2.5-32b-instruct”).
messages: Vec<OpenAIMessage>Conversation history as a sequence of messages.
Includes system prompt, user messages, assistant responses, and tool results. Order matters - messages are processed sequentially.
stream: boolWhether to stream the response.
The SDK sets this to true to request SSE responses.
Streaming allows incremental processing of responses rather than
waiting for the entire completion.
max_tokens: Option<u32>Maximum tokens to generate (optional).
None uses the provider’s default. Some providers require this
to be set explicitly.
temperature: Option<f32>Sampling temperature (optional).
None uses the provider’s default. Controls randomness in
generation.
tools: Option<Vec<Value>>Tools/functions available to the model (optional).
When present, enables function calling. Each tool is described
with a JSON schema defining its parameters. None means no
tools are available.