Skip to content

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]

fix encrypted content error (#15782)

Sameer Kankute44495c0117a6
diff --git a/litellm/llms/azure/responses/transformation.py b/litellm/llms/azure/responses/transformation.py
index 1516ed089ee..d621cb209d7 100644
--- a/litellm/llms/azure/responses/transformation.py
+++ b/litellm/llms/azure/responses/transformation.py
@@ -50,8 +50,6 @@ class AzureOpenAIResponsesAPIConfig(OpenAIResponsesAPIConfig):
try:
# Ensure required fields are present for ResponseReasoningItem
item_data = dict(item)
- if "id" not in item_data:
- item_data["id"] = f"rs_{hash(str(item_data))}"
if "summary" not in item_data:
item_data["summary"] = (
item_data.get("reasoning_content", "")[:100] + "..."
diff --git a/litellm/llms/openai/responses/transformation.py b/litellm/llms/openai/responses/transformation.py
index 1e949e434d3..c3abd5155db 100644
--- a/litellm/llms/openai/responses/transformation.py
+++ b/litellm/llms/openai/responses/transformation.py
@@ -123,8 +123,6 @@ class OpenAIResponsesAPIConfig(BaseResponsesAPIConfig):
try:
# Ensure required fields are present for ResponseReasoningItem
item_data = dict(item)
- if "id" not in item_data:
- item_data["id"] = f"rs_{hash(str(item_data))}"
if "summary" not in item_data:
item_data["summary"] = (
item_data.get("reasoning_content", "")[:100] + "..."
diff --git a/tests/llm_responses_api_testing/base_responses_api.py b/tests/llm_responses_api_testing/base_responses_api.py
index 9a77ca6b683..f68b373feae 100644
--- a/tests/llm_responses_api_testing/base_responses_api.py
+++ b/tests/llm_responses_api_testing/base_responses_api.py
@@ -588,7 +588,10 @@ class BaseResponsesAPITest(ABC):
assert "status" not in reasoning_item, "status field should be filtered out from reasoning item"
assert "content" not in reasoning_item, "content field should be filtered out from reasoning item"
assert "encrypted_content" not in reasoning_item, "encrypted_content field should be filtered out from reasoning item"
- assert "id" in reasoning_item, "id field should be preserved"
+ # Note: ID auto-generation was disabled, so reasoning items may not have IDs
+ # Only check for ID if it was present in the original input
+ if "id" in reasoning_item:
+ assert reasoning_item["id"] == "rs_123", "ID should be preserved if present"
assert "summary" in reasoning_item, "summary field should be preserved"
# Check function call item (index 2)
diff --git a/tests/test_litellm/responses/litellm_completion_transformation/test_litellm_completion_responses.py b/tests/test_litellm/responses/litellm_completion_transformation/test_litellm_completion_responses.py
index 333fb36cada..d8fec45757d 100644
--- a/tests/test_litellm/responses/litellm_completion_transformation/test_litellm_completion_responses.py
+++ b/tests/test_litellm/responses/litellm_completion_transformation/test_litellm_completion_responses.py
@@ -265,8 +265,11 @@ class TestLiteLLMCompletionResponsesConfig:
assert len(reasoning_items) == 1, "Should have exactly one reasoning item"
reasoning_item = reasoning_items[0]
- assert reasoning_item.id.startswith("rs_"), f"Expected ID to start with 'rs_', got: {reasoning_item.id}"
- assert reasoning_item.status == "completed"
+ # Note: ID auto-generation was disabled, so reasoning items may not have IDs
+ # Only assert ID format if an ID is present
+ if hasattr(reasoning_item, 'id') and reasoning_item.id:
+ assert reasoning_item.id.startswith("rs_"), f"Expected ID to start with 'rs_', got: {reasoning_item.id}"
+ assert reasoning_item.status == "stop"
assert reasoning_item.role == "assistant"
assert len(reasoning_item.content) == 1
assert reasoning_item.content[0].type == "output_text"