File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22from typing import List
33
44from litellm import acompletion
5+ from openai .types .chat .chat_completion_message import ChatCompletionMessageToolCall
56
67from eval_protocol .models import EvaluationRow , Message
78from eval_protocol .pytest .types import RolloutProcessorConfig
@@ -28,11 +29,26 @@ async def process_row(row: EvaluationRow) -> EvaluationRow:
2829
2930 assistant_content = response .choices [0 ].message .content or ""
3031 tool_calls = response .choices [0 ].message .tool_calls if response .choices [0 ].message .tool_calls else None
32+
33+ converted_tool_calls = None
34+ if tool_calls :
35+ converted_tool_calls = [
36+ ChatCompletionMessageToolCall (
37+ id = tool_call .id ,
38+ type = tool_call .type ,
39+ function = {
40+ "name" : tool_call .function .name ,
41+ "arguments" : tool_call .function .arguments ,
42+ },
43+ )
44+ for tool_call in tool_calls
45+ ]
46+
3147 messages = list (row .messages ) + [
3248 Message (
3349 role = "assistant" ,
3450 content = assistant_content ,
35- tool_calls = tool_calls ,
51+ tool_calls = converted_tool_calls ,
3652 )
3753 ]
3854
You can’t perform that action at this time.
0 commit comments