-
Notifications
You must be signed in to change notification settings - Fork 806
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers
Description
use home assistant as mcp server, then Calling OpenAI ChatCompletion with messages, but the content in message is a list structure.
OpenAI API Specification:
- content can only be a string or null.
- It cannot be a list, object, or any other type.
If content is a list, some LLM(deepseek) return the following error:
[mcp_agent.workflows.llm.augmented_llm_openai] Error: Failed to deserialize the JSON body into the target type: messages[2]: invalid type: sequence, expected a string at line 1 column 639
[DEBUG] 2025-02-12T17:25:30.871390 mcp_agent.workflows.llm.augmented_llm_openai - Iteration 0: Tool call results: [{'role': 'tool', 'tool_call_id':
'call_e9ZCGCWE7PmQIap9IwOOZkZV', 'content': [{'type': 'text', 'text': '{"speech": {}, "response_type": "action_done", "data": {"targets": [], "success":
[{"name": "DC3\\u5f00\\u51732", "type": "entity", "id": "switch.dc1_d3_sw2"}], "failed": []}}'}]}]
[DEBUG] 2025-02-12T17:25:30.871501 mcp_agent.workflows.llm.augmented_llm_openai - Iteration 1: Calling OpenAI ChatCompletion with messages:
{
"data": [
{
"role": "system",
"content": "for home assistant tools, do not use device_class, use name directly"
},
{
"role": "user",
"content": "关闭充电开关"
},
{
"role": "assistant",
"content": null,
"tool_calls": [
{
"id": "call_e9ZCGCWE7PmQIap9IwOOZkZV",
"function": {
"arguments": "{\"name\":\"充电开关\"}",
"name": "homeassistant-HassTurnOff"
},
"type": "function"
}
],
"audio": null,
"refusal": null,
"name": "finder"
},
{
"role": "tool",
"tool_call_id": "call_e9ZCGCWE7PmQIap9IwOOZkZV",
"content": [
{
"type": "text",
"text": "{\"speech\": {}, \"response_type\": \"action_done\", \"data\": {\"targets\": [], \"success\": [{\"name\": \"DC3\\u5f00\\u51732\",
\"type\": \"entity\", \"id\": \"switch.dc1_d3_sw2\"}], \"failed\": []}}"
}
]
}
]
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers