You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/models.md
+9-15Lines changed: 9 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -155,12 +155,6 @@ agent = Agent(model)
155
155
156
156
## Gemini
157
157
158
-
!!! warning "For prototyping only"
159
-
Google themselves refer to this API as the "hobby" API, I've received 503 responses from it a number of times.
160
-
The API is easy to use and useful for prototyping and simple demos, but I would not rely on it in production.
161
-
162
-
If you want to run Gemini models in production, you should use the [VertexAI API](#gemini-via-vertexai) described below.
163
-
164
158
### Install
165
159
166
160
To use [`GeminiModel`][pydantic_ai.models.gemini.GeminiModel] models, you just need to install [`pydantic-ai`](install.md) or [`pydantic-ai-slim`](install.md#slim-install), no extra dependencies are required.
@@ -171,7 +165,7 @@ To use [`GeminiModel`][pydantic_ai.models.gemini.GeminiModel] models, you just n
171
165
172
166
[`GeminiModelName`][pydantic_ai.models.gemini.GeminiModelName] contains a list of available Gemini models that can be used through this interface.
173
167
174
-
To use `GeminiModel`, go to [aistudio.google.com](https://aistudio.google.com/) and follow your nose until you find the place to generate an API key.
168
+
To use `GeminiModel`, go to [aistudio.google.com](https://aistudio.google.com/apikey) and select "Create API key".
175
169
176
170
### Environment variable
177
171
@@ -186,7 +180,7 @@ You can then use [`GeminiModel`][pydantic_ai.models.gemini.GeminiModel] by name:
186
180
```python {title="gemini_model_by_name.py"}
187
181
from pydantic_ai import Agent
188
182
189
-
agent = Agent('google-gla:gemini-1.5-flash')
183
+
agent = Agent('google-gla:gemini-2.0-flash')
190
184
...
191
185
```
192
186
@@ -200,7 +194,7 @@ Or initialise the model directly with just the model name:
200
194
from pydantic_ai import Agent
201
195
from pydantic_ai.models.gemini import GeminiModel
202
196
203
-
model = GeminiModel('gemini-1.5-flash')
197
+
model = GeminiModel('gemini-2.0-flash')
204
198
agent = Agent(model)
205
199
...
206
200
```
@@ -213,14 +207,14 @@ If you don't want to or can't set the environment variable, you can pass it at r
213
207
from pydantic_ai import Agent
214
208
from pydantic_ai.models.gemini import GeminiModel
215
209
216
-
model = GeminiModel('gemini-1.5-flash', api_key='your-api-key')
210
+
model = GeminiModel('gemini-2.0-flash', api_key='your-api-key')
217
211
agent = Agent(model)
218
212
...
219
213
```
220
214
221
215
## Gemini via VertexAI
222
216
223
-
To run Google's Gemini models in production, you should use [`VertexAIModel`][pydantic_ai.models.vertexai.VertexAIModel] which uses the `*-aiplatform.googleapis.com` API.
217
+
If you are an enterprise user, you should use [`VertexAIModel`][pydantic_ai.models.vertexai.VertexAIModel] which uses the `*-aiplatform.googleapis.com` API.
224
218
225
219
[`GeminiModelName`][pydantic_ai.models.gemini.GeminiModelName] contains a list of available Gemini models that can be used through this interface.
0 commit comments