1414from eval_protocol .pytest import evaluation_test , ExceptionHandlerConfig
1515from eval_protocol .pytest .default_mcp_gym_rollout_processor import MCPGymRolloutProcessor
1616import litellm
17+ from litellm .exceptions import RateLimitError , APIConnectionError
1718from vendor .tau2 .data_model .message import (
1819 AssistantMessage ,
1920 SystemMessage ,
@@ -125,8 +126,8 @@ def tau_bench_airline_to_evaluation_row(data: List[Dict[str, Any]]) -> List[Eval
125126 server_script_path = _get_server_script_path (),
126127 exception_handler_config = ExceptionHandlerConfig (
127128 retryable_exceptions = {
128- litellm . RateLimitError ,
129- litellm . APIConnectionError ,
129+ RateLimitError ,
130+ APIConnectionError ,
130131 }
131132 ),
132133)
@@ -159,8 +160,10 @@ def test_tau_bench_airline_evaluation(row: EvaluationRow) -> EvaluationRow:
159160 role = msg .role
160161 content = msg .content
161162
163+ # Normalize content to str for tau2 message models
164+ text_content = content if isinstance (content , str ) or content is None else ""
162165 if role == "system" :
163- trajectory_objects .append (SystemMessage (role = role , content = content ))
166+ trajectory_objects .append (SystemMessage (role = role , content = text_content ))
164167 elif role == "assistant" :
165168 tau2_tool_calls = []
166169 if msg .tool_calls :
@@ -173,12 +176,12 @@ def test_tau_bench_airline_evaluation(row: EvaluationRow) -> EvaluationRow:
173176 )
174177 tau2_tool_calls .append (tau2_tool_call )
175178
176- trajectory_objects .append (AssistantMessage (role = role , content = content , tool_calls = tau2_tool_calls ))
179+ trajectory_objects .append (AssistantMessage (role = role , content = text_content , tool_calls = tau2_tool_calls ))
177180 elif role == "user" :
178- trajectory_objects .append (UserMessage (role = role , content = content ))
181+ trajectory_objects .append (UserMessage (role = role , content = text_content ))
179182 elif role == "tool" :
180183 tool_id = msg .tool_call_id
181- trajectory_objects .append (ToolMessage (id = tool_id , role = role , content = content ))
184+ trajectory_objects .append (ToolMessage (id = tool_id , role = role , content = text_content ))
182185
183186 reward = 1.0
184187
0 commit comments