Allow specification of timeout
variable for GenerativeModel.generate_content
and GenerativeModel.generate_content_async
#182
Labels
component:python sdk
Issue/PR related to Python SDK
type:feature request
New feature request/enhancement
Description of the feature request:
Currently, when making a request to the Gemini Pro Vision API via
GenerativeModel.generate_content
orGenerativeModel.generate_content_async
, there is no easy way to change the default timeout value on the request. It would be great to have this as a parameter (perhaps just as a non-documentedkwarg
) in thegenerate_content
and other sibling methods.What problem are you trying to solve with this feature?
Sometimes, API requests with multiple images or lots of tokens take longer than 60 seconds to get a response. But with a hard-enforced timeout setting of 60 seconds, these requests fail no matter what.
Any other information you'd like to share?
For the
GenerativeServiceAsyncClient
, at least,timeout
is a parameter of many methods likegenerate_content
. It is not a parameter of theGenerativeModel.generate_content
method (or any of its siblings), however.This could be amended currently by creating a custom client class that inherits from, say,
GenerativeServiceAsyncClient
and overriding the internal_client
or_async_client
attributes of aGenerativeModel
. Such a workaround is far from elegant though, and creates a lot of pain on the developer side.The text was updated successfully, but these errors were encountered: