MagnivOrg / prompt-layer-library

🍰 PromptLayer - Maintain a log of your prompts and OpenAI API requests. Track, debug, and replay old completions.
https://www.promptlayer.com
Apache License 2.0
479 stars 42 forks source link

Improve error message #42

Closed lfoppiano closed 1 year ago

lfoppiano commented 1 year ago

I would like to know if there is a way to know what is the root cause of such error:

WARNING: While logging your request PromptLayer had the following error: Expecting value: line 1 column 1 (char 0)

It seems a malformed JSON, but without accessing or printing the output (maybe just an error due to a prompt that is too large, or other issue with openai).

Thank you in advance

jzone3 commented 1 year ago

Can you please send the request you are trying to log?

lfoppiano commented 1 year ago

I'm sorry, I don't have the prompt I was using. I forgot what I was doing last week 😸 I was calling through langchain.

I believe it was a temporary problem on the promptlayer interface because I was not able to open the history in my promptlayer account.

lfoppiano commented 1 year ago

@jzone3 I've got the same now, and the cause is not due to promptlayer. But perhaps you could improve the error messaging, by showing at least the status code and the returned error. For example, in my case it's the proxy at my organisation that suddenly blocked promptlayer.

Update: it seems that the block was due to some changes in the behaviour of promptlayer. Do you add some strange redirect when the API is overloaded?

lfoppiano commented 1 year ago

@jzone3 I've opened a PR to try to mitigate this issue: https://github.com/MagnivOrg/prompt-layer-library/pull/46