Skip to main content

flatten_codex_namespaces_for_provider

Function flatten_codex_namespaces_for_provider 

Source
pub fn flatten_codex_namespaces_for_provider(body: &mut Value)
Expand description

Flattens Codex namespaces in an outbound Responses body for an OpenAI-compatible provider.

The Responses encoder rebuilds namespace containers and namespace fields on calls for the client, and a replayed preserved body still holds them as sent. Providers accept only flat function tools, so this pass runs on every body sent to a Responses upstream. It names each child <namespace>__<tool>, moves the namespace field of function_call items and a tool_choice into the name, and gives each function tool a string description.