[codex] Use input items for Responses Lite tools (#27946)

When using Responses Lite, we should all use `additional_tools` and a
developer item instead of the top level tools array & instructions
field. This keeps things 1-to-1.

Forced namespacing for _all_ tools will land in a following PR after
some coordination & fixes in Responses API (around collisions & return
items).

The goal is to eventually expand the scope of this to _all_ requests
from codex, but that will require larger coordination across providers &
slower rollout.
This commit is contained in:
rka-oai
2026-06-22 23:56:16 -07:00
committed by GitHub
Unverified
parent a22e3d0b82
commit 33cc928d33
22 changed files with 298 additions and 45 deletions
+6 -3
View File
@@ -28,7 +28,8 @@ pub struct CompactionInput<'a> {
pub input: &'a [ResponseItem],
#[serde(skip_serializing_if = "str::is_empty")]
pub instructions: &'a str,
pub tools: Vec<Value>,
#[serde(skip_serializing_if = "Option::is_none")]
pub tools: Option<Vec<Value>>,
pub parallel_tool_calls: bool,
#[serde(skip_serializing_if = "Option::is_none")]
pub reasoning: Option<Reasoning>,
@@ -210,7 +211,8 @@ pub struct ResponsesApiRequest {
#[serde(skip_serializing_if = "String::is_empty")]
pub instructions: String,
pub input: Vec<ResponseItem>,
pub tools: Vec<serde_json::Value>,
#[serde(skip_serializing_if = "Option::is_none")]
pub tools: Option<Vec<serde_json::Value>>,
pub tool_choice: String,
pub parallel_tool_calls: bool,
pub reasoning: Option<Reasoning>,
@@ -258,7 +260,8 @@ pub struct ResponseCreateWsRequest {
#[serde(skip_serializing_if = "Option::is_none")]
pub previous_response_id: Option<String>,
pub input: Vec<ResponseItem>,
pub tools: Vec<Value>,
#[serde(skip_serializing_if = "Option::is_none")]
pub tools: Option<Vec<Value>>,
pub tool_choice: String,
pub parallel_tool_calls: bool,
pub reasoning: Option<Reasoning>,
@@ -838,11 +838,11 @@ mod tests {
phase: None,
internal_chat_message_metadata_passthrough: None,
}],
tools: vec![json!({
tools: Some(vec![json!({
"type": "function",
"name": "lookup",
"parameters": {"type": "object"}
})],
})]),
tool_choice: "auto".to_string(),
parallel_tool_calls: true,
reasoning: None,
+3 -3
View File
@@ -315,7 +315,7 @@ async fn responses_client_stream_request_preserves_item_ids() -> Result<()> {
phase: None,
internal_chat_message_metadata_passthrough: None,
}],
tools: Vec::new(),
tools: Some(Vec::new()),
tool_choice: "auto".into(),
parallel_tool_calls: false,
reasoning: None,
@@ -401,7 +401,7 @@ async fn streaming_client_retries_on_transport_error() -> Result<()> {
model: "gpt-test".into(),
instructions: "Say hi".into(),
input: Vec::new(),
tools: Vec::new(),
tools: Some(Vec::new()),
tool_choice: "auto".into(),
parallel_tool_calls: false,
reasoning: None,
@@ -520,7 +520,7 @@ async fn azure_store_sends_ids_and_headers() -> Result<()> {
phase: None,
internal_chat_message_metadata_passthrough: None,
}],
tools: Vec::new(),
tools: Some(Vec::new()),
tool_choice: "auto".into(),
parallel_tool_calls: false,
reasoning: None,