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 request timeout on OpenAI calls #67

Merged
merged 4 commits into from
May 16, 2023
Merged

Conversation

realdavidvega
Copy link
Contributor

@realdavidvega realdavidvega commented May 16, 2023

This PR fixes two issues:

  • Timeout-related problems, adding HttpTimeout ktor plugin and setting default timeout of all OpenAI requests to 30 seconds.
  • Max-tokens-related problems, increasing the num of max_tokens due to now having larger prompts. BUT I think this is something we should calculate by ourselves by using a Tokenizer to get the number of tokens of our prompt, and subtracting it from the maximum context length of the selected model. That way we can also raise an error before sending the request to OpenAI. In that sense, I have just added for now the contextLength of each LLMModel.

cc: @xebia-functional/team-ai

@realdavidvega realdavidvega requested a review from nomisRev May 16, 2023 11:11
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.

Thanks, @realdavidvega ! 🚀

@realdavidvega realdavidvega merged commit 6e963cb into main May 16, 2023
@realdavidvega realdavidvega deleted the fix/request-timeout branch May 16, 2023 14:01
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.

3 participants