Closed ermaxinc closed 7 months ago
Hi @ermaxinc, I have to know if this bug occurs multiple times in a row, or it's just some random error you encountered... also can I have a clue about the file content you're sending as attachment?
Since the status_code
returned is 200, I'm guessing there is probably something wrong either in the ClaudeAPIClient.__decode_response()
method (see this line ) or in the way the response is parsed as text ( here )
I may need to gather more info about this error before pushing a fix.
More specifically I have to look for unproper decoding of responses ( if the compression took place ).
Also there should probably be a better way of parsing the response into the answer
string object.
1) The error occurs often (I use many accounts + multi-thread) 2) I send messages to the chat, in this chat there are messages with files and there are also messages without files. 3) The errors that I tried to track down were all without files, i.e. messages that were sent to the chat were without files, and I received an error for them
This is last error, msg without file
@ermaxinc Are you able to inspect the response body of the send_message post request?
Can you please do that by running this library from source?
1) Download this repo
2) Install it using pip install -e .
inside the repo folder.
3) Inspect the response.content
object in this line
It would be a lot helpful to understand the actual response you're getting...
Thanks in advance
@st1vms I'm sorry it took me so long to respond. I found the problem. It's Claude overloading.
response.content
b'data: {"error":{"type":"overloaded_error","message":"Overloaded"}}\n\n'
Need to make the following logic of behavior.
If we get an overload
, we wait 5 seconds and execute send_message
again
In the web version, it looks like this:
@ermaxinc Thanks a lot for your feedback. Based off the response.content
you provided, it seems that a new exception wrapping this error is what we need...
But also the error_response
basically doesn't give any actual clue about any potential errors, the reason is because of a stinky json parsing strategy...so I think it's best off to let there be a property such as raw_answer
, or smth like that, holding the response.content
itself.
I'll be making a PR to test these things out whenever possible, meanwhile if you'd like to push your help, feel free to do the same.
Thanks again :)
@ermaxinc Let's move the discussion here... #13
Waiting for your confirmation in order to push the new changes into the 0.2.7 release : )
Sometimes I get an error
My code:
res is:
Any idea how fix this?
PS. But if i go to the Web, there's an answer in chat.