Cut Mid Object
An agent calls search_orders, which matches 900 rows. It then reports order totals that do not exist anywhere in the database, and confidently cites order numbers that are one digit off.
MAX_TOOL_RESULT_CHARS = 20_000
def run_tool(name, args, tool_use_id):
result = TOOLS[name](**args) # list[dict]
payload = json.dumps(result)
if len(payload) > MAX_TOOL_RESULT_CHARS:
payload = payload[:MAX_TOOL_RESULT_CHARS]
return {"type": "tool_result", "tool_use_id": tool_use_id, "content": payload}
What is producing the fabricated values, and what is the fix?
Sign in to answer questions and track your progress
Sign In