mirror of
https://github.com/trycua/computer.git
synced 2026-01-04 12:30:08 -06:00
fix output of gpt 4o
This commit is contained in:
@@ -243,18 +243,20 @@ async def replace_computer_call_with_function(
|
||||
"id": item.get("id"),
|
||||
"call_id": item.get("call_id"),
|
||||
"status": "completed",
|
||||
# Fall back to string representation
|
||||
"content": f"Used tool: {action_data.get("type")}({json.dumps(fn_args)})",
|
||||
}
|
||||
]
|
||||
|
||||
elif item_type == "computer_call_output":
|
||||
# Simple conversion: computer_call_output -> function_call_output
|
||||
output = item.get("output")
|
||||
|
||||
if isinstance(output, dict):
|
||||
output = [output]
|
||||
|
||||
return [
|
||||
{
|
||||
"type": "function_call_output",
|
||||
"call_id": item.get("call_id"),
|
||||
"content": [item.get("output")],
|
||||
"output": output,
|
||||
"id": item.get("id"),
|
||||
"status": "completed",
|
||||
}
|
||||
@@ -338,7 +340,26 @@ class OmniparserConfig(AsyncAgentConfig):
|
||||
if _on_api_start:
|
||||
await _on_api_start(api_kwargs)
|
||||
|
||||
print(str(api_kwargs)[:1000])
|
||||
# Debug: Check for duplicate IDs
|
||||
import json as json_module
|
||||
all_ids = []
|
||||
all_call_ids = []
|
||||
for msg in messages:
|
||||
if msg.get("id"):
|
||||
all_ids.append(msg.get("id"))
|
||||
if msg.get("call_id"):
|
||||
all_call_ids.append(msg.get("call_id"))
|
||||
|
||||
duplicate_ids = [x for x in all_ids if all_ids.count(x) > 1]
|
||||
duplicate_call_ids = [x for x in all_call_ids if all_call_ids.count(x) > 1]
|
||||
|
||||
if duplicate_ids:
|
||||
print(f"WARNING: Duplicate IDs found: {set(duplicate_ids)}")
|
||||
if duplicate_call_ids:
|
||||
print(f"WARNING: Duplicate call_ids found: {set(duplicate_call_ids)}")
|
||||
|
||||
print("=== Messages being sent ===")
|
||||
print(json_module.dumps(messages, indent=2)[:2000])
|
||||
|
||||
# Use liteLLM responses
|
||||
response = await litellm.aresponses(**api_kwargs)
|
||||
|
||||
Reference in New Issue
Block a user