llm icon indicating copy to clipboard operation
llm copied to clipboard

ToolResult.exception property

Open simonw opened this issue 6 months ago • 2 comments

Refs:

  • #1104

Needs tests, especially for the async case.

simonw avatar May 27 '25 17:05 simonw

https://github.com/simonw/llm/blob/d135a0a4ef71cbe5230b9a500dd8fec1a468b964/llm/models.py#L1104-L1107

That needs fixing to do the same as the non-async execute tool calls function.

simonw avatar May 27 '25 17:05 simonw

This doesn't feel right. I'm returning ToolResult() now for non-existent tools, but that means I'll be filling up the database with tool_results records that don't correspond to a real tool, they're purely hallucinations by the models.

CleanShot 2025-05-27 at 10 44 46@2x

Maybe that's OK? It's important to record what happened. Might need to update the logs code to handle this though.

simonw avatar May 27 '25 17:05 simonw

Related:

  • https://github.com/simonw/llm/issues/1027#issuecomment-2878697664

Would also be neat if exceptions were shown in a different color in the --td and the logs. Currently errors are turned into undifferentiated strings.

simonw avatar Jun 01 '25 18:06 simonw

I just tried to merge main back into this and it was a real mess, because the work on tool attachments in #1142 modified the code that this bit had been updating.

I'm going to abandon this PR and start a new branch.

simonw avatar Jun 01 '25 22:06 simonw