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 - GenericIOException: Failed to parse HTTP response: unexpected EOF #490

Merged
merged 3 commits into from
Oct 11, 2023

Conversation

tomascayuelas
Copy link
Contributor

@tomascayuelas tomascayuelas commented Oct 11, 2023

What?

Testing our library in a simple use case we have detected that with a newly generated personal OPENAI_TOKEN. When we use it we get this exception
(com.aallam.openai.api.exception.GenericIOException: Failed to parse HTTP response: unexpected EOF)

2023-10-10_14-21

Why?

Because the Timeout establishes a default time of 30 seconds for the socket, so if this request spend more time that this value (socket = 30.seconds) the execution thrown an exception.

2023-10-11_17-13

How?

We have added a configurable Timeout with some default values in our OpenAI class. This solves the timeout problem given by the "com.aallam" OpenAI library client, issue already closed aallam/openai-kotlin#234

Other minor changes:

We take the opportunity to do this little refactor:

  • set the findModel function to private
  • put below the private function findModel (We think that is more readable in this way)

@tomascayuelas tomascayuelas self-assigned this Oct 11, 2023
@tomascayuelas tomascayuelas changed the title Fix problem with EOF using aallam.openai client Fix - GenericIOException: Failed to parse HTTP response: unexpected EOF Oct 11, 2023
Montagon
Montagon previously approved these changes Oct 11, 2023
Copy link
Contributor

@Montagon Montagon left a comment

Choose a reason for hiding this comment

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

🚀

raulraja
raulraja previously approved these changes Oct 11, 2023
Copy link
Contributor

@raulraja raulraja 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 @tomascayuelas! Looks great!

@tomascayuelas tomascayuelas dismissed stale reviews from raulraja and Montagon via 7bc9da5 October 11, 2023 17:02
@raulraja raulraja merged commit b20096a into main Oct 11, 2023
5 checks passed
@raulraja raulraja deleted the fix-socket-timeout-EOF branch October 11, 2023 17:11
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.

Non-informative error.
3 participants