mirror of
https://github.com/EvolutionAPI/adk-python.git
synced 2025-12-21 12:52:18 -06:00
fix: Simplify content for ollama provider
Even though litellm type definitions and openai API specifies content as list of dictionaries (with type and relevant attributes potentially to allow multimodal inputs/outputs in addition to text), ollama has been demonstrating marshal errors. As a workaround this change simplifies the content as string when there is no more than one content part. Fixes #642, #928, #376 PiperOrigin-RevId: 766890141
This commit is contained in:
committed by
Copybara-Service
parent
32c5ffa8ca
commit
eaee49bc89
@@ -889,15 +889,16 @@ def test_content_to_message_param_function_call():
|
||||
content = types.Content(
|
||||
role="assistant",
|
||||
parts=[
|
||||
types.Part.from_text(text="test response"),
|
||||
types.Part.from_function_call(
|
||||
name="test_function", args={"test_arg": "test_value"}
|
||||
)
|
||||
),
|
||||
],
|
||||
)
|
||||
content.parts[0].function_call.id = "test_tool_call_id"
|
||||
content.parts[1].function_call.id = "test_tool_call_id"
|
||||
message = _content_to_message_param(content)
|
||||
assert message["role"] == "assistant"
|
||||
assert message["content"] == None
|
||||
assert message["content"] == "test response"
|
||||
|
||||
tool_call = message["tool_calls"][0]
|
||||
assert tool_call["type"] == "function"
|
||||
|
||||
Reference in New Issue
Block a user