llm
llm copied to clipboard
ToolResult.exception property
Refs:
- #1104
Needs tests, especially for the async case.
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.
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.
Maybe that's OK? It's important to record what happened. Might need to update the logs code to handle this though.
Related:
- https://github.com/simonw/llm/issues/1027#issuecomment-2878697664
Would also be neat if exceptions were shown in a different color in the
--tdand the logs. Currently errors are turned into undifferentiated strings.
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.