-
Notifications
You must be signed in to change notification settings - Fork 454
Add ability to configure timeouts #204
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
Add ability to configure timeouts #204
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
WDYT @MarkDaoust? This is helpful - though I wonder if it's worth exposing something like req_kwargs
instead?
Another thought is that we can already set the timeout in the client constructors, so this isn't strictly needed, but I do prefer the ergonomics of setting per-request.
It turns out every other method/function involving the client has a |
Hi, thanks for this. The other SDK teams have already decided to sync on passing this (and anything else) as a We can go a bit farther to define what those other options are, but I think the minimum we would need to accept this would be if you can replace all the Then If you can pick that up it would be great. If not I'll push some commits on top of this when I can. Thanks again. |
Also
Like @markmcd said, I think users can set some of these things at the client level, but if you care about these settings at all, you probably don't want the same ones for every method. |
Hi, thanks for the feedback! |
Hi @MarkDaoust! I've added |
hi, so how can we use it ? I also think 60 is too short.... But now how can we change this ? |
Hi, @jun0wanan! This Pull Request is pending a review/approval and not in the release yet. |
Thanks! So, if I want to input long text and images into an API ( the model is gemini-vision-pro ), is there a way to solve this? Because this model does not support multi-turn dialogues and can only input very long text and images. However, I am currently evaluating the capabilities of this multimodal model for handling long text and images. Can you have any ideas? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jun0wanan In the release notes there is an example on how to use the new timeout feature: https://github.com/google/generative-ai-python/releases/tag/v0.4.0 |
Hello. I can't see |
This should priorized if Google wants devs to use the Gemini API, specially since they promote it as having an edge over other models due to the large context window. But its not usable because it timeouts if you send large context. |
Description of the change
Added a
timeout
kwarg to relevant methods where it can be used (closes #182)Methods extended with timeout kwarg:
generate_answer
embed_content
generate_content
generate_content_async
Motivation
Makes it possible to wait for the response longer, for example if the number of tokens is large, or the payload has multiple files/images. The default behavior is to stop after 60 seconds and the current API doesn't allow to change it (see default value here).
Type of change
Feature request
Checklist
git pull --rebase upstream main
).