Skip to content

Commit 16ffbac

Browse files
committed
put message back in dict
1 parent 15ff290 commit 16ffbac

File tree

1 file changed

+20
-22
lines changed

1 file changed

+20
-22
lines changed

eval_protocol/mcp/execution/policy.py

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -219,31 +219,29 @@ async def _make_llm_call(self, messages: List[Dict[str, Any]], tools: List[Dict[
219219
# LiteLLM already returns OpenAI-compatible format
220220
message_obj = getattr(response.choices[0], "message", object())
221221

222-
message_dict: Dict[str, Any] = {
223-
"role": getattr(message_obj, "role", "assistant"),
224-
"content": getattr(message_obj, "content", None),
225-
"provider_specific_fields": getattr(message_obj, "provider_specific_fields", None),
226-
"tool_calls": (
227-
[
228-
{
229-
"id": getattr(tc, "id", None),
230-
"type": getattr(tc, "type", "function"),
231-
"function": {
232-
"name": getattr(getattr(tc, "function", None), "name", "tool"),
233-
"arguments": getattr(getattr(tc, "function", None), "arguments", "{}"),
234-
},
235-
}
236-
for tc in (getattr(message_obj, "tool_calls", []) or [])
237-
]
238-
if getattr(message_obj, "tool_calls", None)
239-
else []
240-
),
241-
}
242-
243222
return {
244223
"choices": [
245224
{
246-
"message": message_dict,
225+
"message": {
226+
"role": getattr(message_obj, "role", "assistant"),
227+
"content": getattr(message_obj, "content", None),
228+
"provider_specific_fields": getattr(message_obj, "provider_specific_fields", None),
229+
"tool_calls": (
230+
[
231+
{
232+
"id": getattr(tc, "id", None),
233+
"type": getattr(tc, "type", "function"),
234+
"function": {
235+
"name": getattr(getattr(tc, "function", None), "name", "tool"),
236+
"arguments": getattr(getattr(tc, "function", None), "arguments", "{}"),
237+
},
238+
}
239+
for tc in (getattr(message_obj, "tool_calls", []) or [])
240+
]
241+
if getattr(message_obj, "tool_calls", None)
242+
else []
243+
),
244+
},
247245
"finish_reason": getattr(response.choices[0], "finish_reason", None),
248246
}
249247
],

0 commit comments

Comments
 (0)