Repository navigation
How to debug? #2314
|
Hi, Occasionally, I've a request with an error, either because I didn't send the proper paypload, either because my response model doesn't match what I receive. In such case I might need to check the last few messages and the current one. I've tried this approach: #258 : And it work, I've all the information I need in it, but it becomes really slows. What runs in like 15seconds before is now taking something like 5minutes. What would you advise? |
Replies: 2 comments 2 replies
|
A good way to debug this is to avoid sending the complete conversation history every time. Some approaches that can help:
This usually makes debugging faster and helps identify whether the issue is the payload, response format, or API behavior. |
|
If the approach you copied intercepts every single outgoing payload and incoming response, serializes them (e.g., parsing massive JSON objects), and writes them out, you are paying a huge CPU and I/O tax on every loop. |
If the approach you copied intercepts every single outgoing payload and incoming response, serializes them (e.g., parsing massive JSON objects), and writes them out, you are paying a huge CPU and I/O tax on every loop.
So The Fix for that is to Let the code run normally. Only capture, serialize, and log the data inside a catch / except block when a validation or payload error is actually thrown. And if you are printing the "last few messages and the current one" directly to your console, massive text dumps can actually freeze the execution thread. IDE terminals and standard consoles are notoriously slow at rendering huge blocks of text or JSON. try to write these debug logs directly to a …