Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix json marshaling error response of azure openai (#343) #345

Conversation

vvatanabe
Copy link
Collaborator

Fix #343

Azure OpenAI error response seems to be type field missing sometimes. Error (unexpected end of JSON input) when parsing type in APIError.UnmarshalJSON function.

Example error response:

# Azure OpenAI
{
   "error":{
      "code":"429",
      "message":"Requests to the Creates a completion for the chat message Operation under Azure OpenAI API version 2023-03-15-preview have exceeded token rate limit of your current OpenAI S0 pricing tier. Please retry after 17 seconds. Please go here: https://aka.ms/oai/quotaincrease if you would like to further increase the default rate limit."
   }
}

Note:
I also considered changing the type field to a pointer, but decided against it because that would be a breaking changes.

@codecov
Copy link

codecov bot commented Jun 8, 2023

Codecov Report

Merging #345 (fe1edcd) into master (6830e00) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master     #345   +/-   ##
=======================================
  Coverage   93.65%   93.66%           
=======================================
  Files          17       17           
  Lines         646      647    +1     
=======================================
+ Hits          605      606    +1     
  Misses         30       30           
  Partials       11       11           
Impacted Files Coverage Δ
error.go 100.00% <100.00%> (ø)

@vvatanabe
Copy link
Collaborator Author

@sashabaranov Please check it.

@vvatanabe vvatanabe mentioned this pull request Jun 8, 2023
Copy link
Owner

@sashabaranov sashabaranov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! 🙌🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

About Error handling
2 participants