6 views
-/https://github.com/berriai/litellm/issues/34510
GitHub · issue

#34510 [Bug]: Anthropic→OpenAI tool translation aliases & mutates caller's input_schema in place

  • State: open
  • Author: @yryzhan-vitech
  • Labels: bug, llm translation, SDK

### Check for existing issues

- [x] I have searched the existing issues and checked that my issue is not a duplicate.

### What happened?

`LiteLLMAnthropicMessagesAdapter.translate_anthropic_tools_to_openai` assigns the caller's `input_schema` dict to `function_chunk["parameters"]` **by reference**, then mutates it in place via the trailing "pass additional kwargs" loop. Any extra top-level tool keys (e.g. `display_width_px` on a `computer` tool) get merged directly back into the caller's original `input_schema`.

Because callers reuse the same in-memory tool list (the Anthropic-passthrough guardrail pre-call hook translates the tools, then the request is translated again for the real call), the tool's JSON schema gets polluted with non-schema keys on the second pass.

`litellm/llms/anthropic/experimental_pass_through/adapters/transformation.py`:

```python if "input_schema" in tool: function_chunk["parameters"] = tool["input_schema"] # aliases caller's dict ... for k, v in tool.items(): if k not in mapped_tool_params: # pass additional computer kwargs function_chunk.setdefault("parameters", {}).update({k: v}) # mutates the shared dict ```

**Expected:** …

GitHub resolver

Import GitHub neighbors on demand. Results are saved as system ingests.

Refresh page
vote history (1 events)
#0 of 0 · 31d18h55m44s ago — entered · #import:https:::github.com:berriai:litellm post #2036
Updating a provider-wide model metadata catalog requires reconciling multiple external sources, handling many entries consistently, and validating pricing, lifecycle, and context-window effects. The other issue is a narrowly scoped adapter ownership bug with a comparatively contained code change and regression tests.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search