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

Setting timeouts #6

Closed
tckb opened this issue Jun 14, 2023 · 3 comments
Closed

Setting timeouts #6

tckb opened this issue Jun 14, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@tckb
Copy link

tckb commented Jun 14, 2023

Hey.. thanks for writing this library. It works perfect for my usecase. however I use gpt-4 for my queries and 99% of my requests timeout, because the requests take a bit longer than 10 secs. There doesn't seem to be a way to increase the timeout. An environment variable to setup this param would be perfect.

Thank you.

HamaWhiteGG added a commit that referenced this issue Jun 15, 2023
@HamaWhiteGG
Copy link
Owner

HamaWhiteGG commented Jun 15, 2023

I'm glad you're using this project. I have added a parameter requestTimeout with a default value of 10 seconds. When constructing an OpenAI, you can set this parameter according to your needs.

OpenAITest#testOpenAICall()

@Test
void testOpenAICall() {
    OpenAI llm = OpenAI.builder()
            .maxTokens(16)
            .requestTimeout(15)
            .build()
            .init();

    assertThat(llm.call("Say foo:")).isEqualTo("\n\nFoo!");
}

If you still need environment variables, we can continue the discussion.

@HamaWhiteGG HamaWhiteGG added the bug Something isn't working label Jun 15, 2023
HamaWhiteGG added a commit that referenced this issue Jun 15, 2023
Fix issue #6: Setting timeouts
@tckb
Copy link
Author

tckb commented Jun 19, 2023

Hey @HamaWhiteGG thank you! I have a workaround exactly this :) with this config, I do not need any additional environment variable.

@HamaWhiteGG
Copy link
Owner

Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants