Skip to content

feat(responses): strip custom_tool_call namespace for all providers#26221

Open
Sameerlite wants to merge 1 commit intolitellm_internal_stagingfrom
litellm_responses_strip_custom_tool_call_namespace
Open

feat(responses): strip custom_tool_call namespace for all providers#26221
Sameerlite wants to merge 1 commit intolitellm_internal_stagingfrom
litellm_responses_strip_custom_tool_call_namespace

Conversation

@Sameerlite
Copy link
Copy Markdown
Collaborator

@Sameerlite Sameerlite commented Apr 22, 2026

Summary

  • Add BaseResponsesAPIConfig.strip_custom_tool_call_namespace_from_responses_input and normalize_responses_api_request_dict so namespace is removed from custom_tool_call input items for every Responses API provider (OpenAI-compatible backends reject it).
  • Call normalize_responses_api_request_dict on outbound bodies in llm_http_handler (sync/async responses + compact) so normalization always runs on the wire path.

Tests

  • tests/test_litellm/llms/openai/responses/test_openai_responses_transformation.py: base strip + normalize, OpenAI transform+normalize, Azure transform+normalize.

function_call namespace is preserved for OpenAI deferred tool namespaces; only custom_tool_call is stripped.

image

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 22, 2026

Greptile Summary

This PR adds strip_custom_tool_call_namespace_from_responses_input and normalize_responses_api_request_dict to BaseResponsesAPIConfig, then calls the normalizer across all four Responses API send paths (sync/async standard and sync/async compact) in llm_http_handler.py. The goal is to strip the namespace field from custom_tool_call input items before they reach any provider, since OpenAI-compatible backends reject it, while preserving namespace on function_call items.

Confidence Score: 5/5

Safe to merge — the change is minimal, targeted, and all four send paths are covered.

All four Responses API send paths have the normalizer applied. The stripping logic is type-guarded (only custom_tool_call), non-mutating, and idempotent. Tests are all-mock and cover the base, OpenAI, and Azure paths. No existing tests are modified. No P0/P1 issues found.

No files require special attention.

Important Files Changed

Filename Overview
litellm/llms/base_llm/responses/transformation.py Adds two new static methods for stripping namespace from custom_tool_call items; logic is correct and non-mutating.
litellm/llms/custom_httpx/llm_http_handler.py Applies normalize_responses_api_request_dict at all four Responses API send sites (sync/async standard + compact); ordering relative to extra_body.update() is fine for typical usage.
tests/test_litellm/llms/openai/responses/test_openai_responses_transformation.py Adds three new unit tests covering base strip, OpenAI transform+normalize, and Azure transform+normalize; no network calls, no existing test modifications.

Sequence Diagram

sequenceDiagram
    participant Caller
    participant llm_http_handler as BaseLLMHTTPHandler
    participant ProviderConfig as responses_api_provider_config
    participant Normalizer as BaseResponsesAPIConfig.normalize_*
    participant Provider as Remote Provider

    Caller->>llm_http_handler: async/sync responses_api_handler (input with custom_tool_call)
    llm_http_handler->>ProviderConfig: transform_responses_api_request(...)
    ProviderConfig-->>llm_http_handler: data (dict with input)
    llm_http_handler->>Normalizer: normalize_responses_api_request_dict(data)
    Note over Normalizer: strip namespace from custom_tool_call items<br/>preserve namespace on function_call items
    Normalizer-->>llm_http_handler: normalized data
    llm_http_handler->>Provider: POST /responses (no namespace on custom_tool_call)
Loading

Reviews (1): Last reviewed commit: "feat(responses): strip custom_tool_call ..." | Re-trigger Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant