-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Provide the ability to configure OpenAI client read timeout #365
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
base: main
Are you sure you want to change the base?
Conversation
As commented in #354 (comment) , using |
@tzolov or @markpollack |
Hi. I added comments here, I think for 0.8.1 we can make an interim approach before tackling the general problem. |
Sorry, i was confusing retry timeout with http timeout. We will address this issue, sorry for the confusion. |
@markpollack |
Hi. I think we can achieve what is needed but in a different way. The code you added to merge the property The read timeout can be added by declaring a Let me know what you think. |
Hi Mark, What you think? Also I'm not sure if you intended to keep the new timeout property or just rely on overridable beans declarations.
I see but the properties merge and validation logic is still duplicated for Let me know. |
I understand the confusion with a constructor that has both a I would like to have the top level property, so it is easy to use, vs writing code that uses the The merge logic is duplicated for OpenAiImageClient and OpenAiAudioTranscriptionClient beans, but I don't see a way around it as each of those clients rely on their own options class to retrieve the value, e.g. |
The specific option classes inherit from
|
Hello, |
Just to update, there are many issues floating around on this topic, i'm trying to reconcile and figure out the best approach. |
I found out that the only way to do this on a per-call request is to use the netty infra. https://projectreactor.io/docs/netty/release/reference/index.html#response-timeout
Thought I don't know if folks are comfortable with defaulting to use |
Created a new
java.time.Duration
read timeout configuration property with sensible default of 1 minute.Introduced at
org.springframework.ai.autoconfigure.openai.OpenAiParentProperties
level so that it can be overriden by more specific configurations.Did a bit of refactoring of
org.springframework.ai.autoconfigure.openai.OpenAiAutoConfiguration
to stay DRY.Eg:
spring.ai.openai.read-timeout = 5m
or
spring.ai.openai.chat.read-timeout = 10m
Closes #354