The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
[Bug Fix] [Bug]: New Databricks Foundation Models databricks-gpt-oss-20b and databricks-gpt-oss-120b failed with error: litellm.APIConnectionError: 'signature' (#13318)
Ishaan Jaffb455ada161ec
diff --git a/litellm/llms/databricks/chat/transformation.py b/litellm/llms/databricks/chat/transformation.pyindex e7d7920769f..908419f7193 100644--- a/litellm/llms/databricks/chat/transformation.py+++ b/litellm/llms/databricks/chat/transformation.py@@ -371,8 +371,8 @@ class DatabricksConfig(DatabricksBase, OpenAILikeChatConfig, AnthropicConfig):reasoning_content += sum["text"]thinking_block = ChatCompletionThinkingBlock(type="thinking",- thinking=sum["text"],- signature=sum["signature"],+ thinking=sum.get("text", ""),+ signature=sum.get("signature", ""),)if thinking_blocks is None:thinking_blocks = []diff --git a/litellm/proxy/proxy_config.yaml b/litellm/proxy/proxy_config.yamlindex 7aababa79d4..c8d148f7086 100644--- a/litellm/proxy/proxy_config.yaml+++ b/litellm/proxy/proxy_config.yaml@@ -1,6 +1,6 @@model_list:- - model_name: vertex_ai/*+ - model_name: anthropic/*litellm_params:- model: vertex_ai/*+ model: anthropic/*diff --git a/tests/test_litellm/llms/databricks/chat/test_databricks_chat_transformation.py b/tests/test_litellm/llms/databricks/chat/test_databricks_chat_transformation.pyindex 1026a210098..fc44d44aba9 100644--- a/tests/test_litellm/llms/databricks/chat/test_databricks_chat_transformation.py+++ b/tests/test_litellm/llms/databricks/chat/test_databricks_chat_transformation.py@@ -45,3 +45,48 @@ def test_transform_choices():assert choices[0].message.reasoning_content == "i'm thinking."assert choices[0].message.thinking_blocks is not Noneassert choices[0].message.tool_calls is None+++def test_transform_choices_without_signature():+ """+ Test that the transformation works correctly when the signature field is missing+ from the summary, which occurs with new Databricks Foundation Models like+ databricks-gpt-oss-20b and databricks-gpt-oss-120b.+ """+ config = DatabricksConfig()+ databricks_choices = [+ {+ "message": {+ "role": "assistant",+ "content": [+ {+ "type": "reasoning",+ "summary": [+ {+ "type": "summary_text",+ "text": "i'm thinking without signature.",+ # Note: no signature field here+ }+ ],+ },+ {"type": "text", "text": "Response without signature"},+ ],+ },+ "index": 0,+ "finish_reason": "stop",+ }+ ]++ # This should not raise a KeyError for missing signature+ choices = config._transform_dbrx_choices(choices=databricks_choices)++ assert len(choices) == 1+ assert choices[0].message.content == "Response without signature"+ assert choices[0].message.reasoning_content == "i'm thinking without signature."+ assert choices[0].message.thinking_blocks is not None+ assert len(choices[0].message.thinking_blocks) == 1++ # Verify the thinking block was created successfully without signature+ thinking_block = choices[0].message.thinking_blocks[0]+ assert thinking_block["type"] == "thinking"+ assert thinking_block["thinking"] == "i'm thinking without signature."