fix encrypted content error (#15782)

This commit is contained in:
Sameer Kankute
2025-10-21 23:29:48 -07:00
committed by GitHub
parent 29a97784e7
commit 44495c0117
4 changed files with 9 additions and 7 deletions
@@ -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] + "..."
@@ -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] + "..."
@@ -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)
@@ -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"