Skip to content

Commit 4ebc8c4

Browse files
committed
more generic storing of provider_specific_fields
1 parent 4bc58f7 commit 4ebc8c4

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

eval_protocol/mcp/execution/base_policy.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,12 @@ async def _generate_live_tool_calls(
199199
if message.get("tool_calls"):
200200
assistant_message_for_history["tool_calls"] = message["tool_calls"]
201201

202-
if message.get("reasoning_details"):
203-
assistant_message_for_history["reasoning_details"] = message["reasoning_details"]
202+
# Preserve specific fields from provider_specific_fields if present
203+
if message.get("provider_specific_fields"):
204+
if message["provider_specific_fields"].get("reasoning_details"):
205+
assistant_message_for_history["reasoning_details"] = message["provider_specific_fields"][
206+
"reasoning_details"
207+
]
204208

205209
# Add to actual conversation history
206210
conversation_history.append(assistant_message_for_history)

eval_protocol/mcp/execution/policy.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ async def _make_llm_call(self, messages: List[Dict[str, Any]], tools: List[Dict[
222222
message_dict: Dict[str, Any] = {
223223
"role": getattr(message_obj, "role", "assistant"),
224224
"content": getattr(message_obj, "content", None),
225+
"provider_specific_fields": getattr(message_obj, "provider_specific_fields", None),
225226
"tool_calls": (
226227
[
227228
{
@@ -239,12 +240,6 @@ async def _make_llm_call(self, messages: List[Dict[str, Any]], tools: List[Dict[
239240
),
240241
}
241242

242-
provider_specific_fields = getattr(message_obj, "provider_specific_fields", None)
243-
if isinstance(provider_specific_fields, dict):
244-
for key, value in provider_specific_fields.items():
245-
if value is not None and key not in message_dict:
246-
message_dict[key] = value
247-
248243
return {
249244
"choices": [
250245
{

0 commit comments

Comments
 (0)