File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change 2222import sys
2323from typing import AsyncGenerator
2424from typing import cast
25+ from typing import Optional
2526from typing import TYPE_CHECKING
2627from typing import Union
2728
@@ -57,6 +58,23 @@ class Gemini(BaseLlm):
5758
5859 model : str = 'gemini-1.5-flash'
5960
61+ retry_options : Optional [types .HttpRetryOptions ] = None
62+ """Allow Gemini to retry failed responses.
63+
64+ Sample:
65+ ```python
66+ from google.genai import types
67+
68+ # ...
69+
70+ agent = Agent(
71+ model=Gemini(
72+ retry_options=types.HttpRetryOptions(initial_delay=1, attempts=2),
73+ )
74+ )
75+ ```
76+ """
77+
6078 @staticmethod
6179 @override
6280 def supported_models () -> list [str ]:
@@ -191,7 +209,10 @@ def api_client(self) -> Client:
191209 The api client.
192210 """
193211 return Client (
194- http_options = types .HttpOptions (headers = self ._tracking_headers )
212+ http_options = types .HttpOptions (
213+ headers = self ._tracking_headers ,
214+ retry_options = self .retry_options ,
215+ )
195216 )
196217
197218 @cached_property
You can’t perform that action at this time.
0 commit comments