AnswerDotAI / AnswerDotAI/claudette
Is there a way to print both tool use requests and responses inside chat.toolloop?
- Dominant language
- Jupyter Notebook
- Stars
- 316
- Forks
- 43
- PR merge metrics
- No merged PRs in 30d
Description
Hi, sorry if this is a dumb question but I've been trying to make this work and reading the source code and I've had no luck.
I'm playing with an assistant which has 3 tools.
I'm trying to print everything that's happening so I can debug the system prompt and the initial message prompt.
However, if I call `chat.toolloop` like so:
```
answer = chat.toolloop(main_prompt, trace_func=print)
```
I only get prints of:
- (1) the messages from the assistant before calling the tool
- (2) the `tool_use` request
- (3) the messages from the assistant after calling the tool and seeing the results
I'm not seeing, however, any output regarding the tool function call, nor the results and how they are sent to Claude (which would be very useful in debugging).
To work around this, I added prints inside the tool function, but the result is a little weird (at least to me):
The prints from the tool function call appear before (1) from above.
The question is: is there easy way to have the debug prints in chronological order (that is, (1), (2), tool function prints, (3))?
Thanks in advance! Claudette inspired me to play with Claude API and it's fun! :)
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the chat.toolloop entry point and inspect how trace_func is called around tool requests and responses. Reproduce the example with a tool that prints, then verify that tool invocation, results, and assistant messages appear in chronological order.
Written by the indexing model from the issue text.
Assessment
- Domain
- api
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100