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 22
22
import sys
23
23
from typing import AsyncGenerator
24
24
from typing import cast
25
+ from typing import Optional
25
26
from typing import TYPE_CHECKING
26
27
from typing import Union
27
28
@@ -57,6 +58,23 @@ class Gemini(BaseLlm):
57
58
58
59
model : str = 'gemini-1.5-flash'
59
60
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
+
60
78
@staticmethod
61
79
@override
62
80
def supported_models () -> list [str ]:
@@ -191,7 +209,10 @@ def api_client(self) -> Client:
191
209
The api client.
192
210
"""
193
211
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
+ )
195
216
)
196
217
197
218
@cached_property
You can’t perform that action at this time.
0 commit comments