Skip to main content

chat_responses/
client.rs

1use chat_core::transport::Transport;
2use chat_core::types::provider_meta::ProviderMeta;
3use serde_json::Value;
4
5/// Generic client over the OpenAI Responses API wire format
6/// (`POST {base_url}/responses`). Provider wrappers like
7/// [`chat_openai`] hold one of these as their inner state.
8pub struct ResponsesClient<T: Transport> {
9    pub model_name: String,
10    pub api_key: String,
11    pub scheme: String,
12    pub host: String,
13    pub base_path: String,
14    pub transport: T,
15    /// Tool declarations injected by the wrapping provider on top of the
16    /// `ToolDeclarations` view supplied by `Chat`. The wire layer drops
17    /// these into `tools[]` opaquely — it does not know about
18    /// `OpenAINativeTool` or any provider-specific trait.
19    pub extra_tool_declarations: Vec<Value>,
20    pub reasoning_effort: Option<String>,
21    pub use_previous_response_id: bool,
22    pub(crate) last_response_id: Option<String>,
23    pub store: Option<bool>,
24    pub meta: ProviderMeta,
25}