mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-23 05:34:41 +00:00
Merge 574b96aefb into 82ca10cc2d
This commit is contained in:
commit
05f3391e29
2 changed files with 22 additions and 7 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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():
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue