This commit is contained in:
devin-ai-integration[bot] 2026-10-17 08:01:47 -07:00 • committed by GitHub
commit 05f3391e29
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 22 additions and 7 deletions

View file

@ -2120,7 +2120,7 @@ class LiteLLMCompletionResponsesConfig:
# Ensure we include any accumulated text as text blocks too
return normalized_blocks
if text_acc:
return "".join(text_acc)
return "\n".join(text_acc)
try:
# last resort: keep something meaningful for providers that require a string
import json as _json

View file

@ -11,7 +11,26 @@ from litellm.responses.litellm_completion_transformation.transformation import (
)
def test_function_call_output_list_input_text_is_converted_to_tool_string_content():
def test_function_call_output_list_input_text_parts_reach_the_tool_message_on_separate_lines():
out = LiteLLMCompletionResponsesConfig._transform_responses_api_tool_call_output_to_chat_completion_message(
tool_call_output={
"type": "function_call_output",
"call_id": "call_1",
"output": [
{"type": "input_text", "text": "Paris: 22 degrees"},
{"type": "input_text", "text": "clear skies"},
],
}
)
assert len(out) == 1
msg = out[0]
assert msg["role"] == "tool"
assert msg["tool_call_id"] == "call_1"
assert msg["content"] == "Paris: 22 degrees\nclear skies"
def test_function_call_output_text_part_whitespace_survives_the_join():
out = LiteLLMCompletionResponsesConfig._transform_responses_api_tool_call_output_to_chat_completion_message(
tool_call_output={
"type": "function_call_output",
@ -23,11 +42,7 @@ def test_function_call_output_list_input_text_is_converted_to_tool_string_conten
}
)
assert len(out) == 1
msg = out[0]
assert msg["role"] == "tool"
assert msg["tool_call_id"] == "call_1"
assert msg["content"] == "hello world"
assert out[0]["content"] == "hello\n world"
def test_function_call_output_string_passthrough():