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/agents.md
+4-3Lines changed: 4 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -504,20 +504,21 @@ The final request uses `temperature=0.0` (run-time), `max_tokens=500` (from mode
504
504
505
505
### Model specific settings
506
506
507
-
If you wish to further customize model behavior, you can use a subclass of [`ModelSettings`][pydantic_ai.settings.ModelSettings], like [`GeminiModelSettings`][pydantic_ai.models.gemini.GeminiModelSettings], associated with your model of choice.
507
+
If you wish to further customize model behavior, you can use a subclass of [`ModelSettings`][pydantic_ai.settings.ModelSettings], like
508
+
[`GoogleModelSettings`][pydantic_ai.models.google.GoogleModelSettings], associated with your model of choice.
508
509
509
510
For example:
510
511
511
512
```py
512
513
from pydantic_ai import Agent, UnexpectedModelBehavior
513
-
from pydantic_ai.models.geminiimportGeminiModelSettings
514
+
from pydantic_ai.models.googleimportGoogleModelSettings
514
515
515
516
agent = Agent('google-gla:gemini-1.5-flash')
516
517
517
518
try:
518
519
result = agent.run_sync(
519
520
'Write a list of 5 very rude things that I might say to the universe after stubbing my toe in the dark:',
520
-
model_settings=GeminiModelSettings(
521
+
model_settings=GoogleModelSettings(
521
522
temperature=0.0, # general model settings can also be specified
Copy file name to clipboardExpand all lines: docs/input.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -110,7 +110,7 @@ The situation is different for certain models:
110
110
111
111
-[`AnthropicModel`][pydantic_ai.models.anthropic.AnthropicModel]: if you provide a PDF document via `DocumentUrl`, the URL is sent directly in the API request, so no download happens on the user side.
112
112
113
-
-[`GeminiModel`][pydantic_ai.models.gemini.GeminiModel] and [`GoogleModel`][pydantic_ai.models.google.GoogleModel] on Vertex AI: any URL provided using `ImageUrl`, `AudioUrl`, `VideoUrl`, or `DocumentUrl` is sent as-is in the API request and no data is downloaded beforehand.
113
+
-[`GoogleModel`][pydantic_ai.models.google.GoogleModel] on Vertex AI: any URL provided using `ImageUrl`, `AudioUrl`, `VideoUrl`, or `DocumentUrl` is sent as-is in the API request and no data is downloaded beforehand.
114
114
115
115
See the [Gemini API docs for Vertex AI](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/inference#filedata) to learn more about supported URLs, formats and limitations:
116
116
@@ -120,4 +120,4 @@ The situation is different for certain models:
120
120
121
121
However, because of crawling restrictions, it may happen that Gemini can't access certain URLs. In that case, you can instruct Pydantic AI to download the file content and send that instead of the URL by setting the boolean flag `force_download` to `True`. This attribute is available on all objects that inherit from [`FileUrl`][pydantic_ai.messages.FileUrl].
122
122
123
-
-[`GeminiModel`][pydantic_ai.models.gemini.GeminiModel] and [`GoogleModel`][pydantic_ai.models.google.GoogleModel] on GLA: YouTube video URLs are sent directly in the request to the model.
123
+
-[`GoogleModel`][pydantic_ai.models.google.GoogleModel] on GLA: YouTube video URLs are sent directly in the request to the model.
Copy file name to clipboardExpand all lines: docs/models/google.md
+11Lines changed: 11 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,6 +44,17 @@ agent = Agent(model)
44
44
45
45
If you are an enterprise user, you can use the `google-vertex` provider with `GoogleModel` to access Gemini via Vertex AI.
46
46
47
+
This interface has a number of advantages over the Generative Language API:
48
+
49
+
1. The VertexAI API comes with more enterprise readiness guarantees.
50
+
2. You can [purchase provisioned throughput](https://cloud.google.com/vertex-ai/generative-ai/docs/provisioned-throughput#purchase-provisioned-throughput) with VertexAI to guarantee capacity.
51
+
3. If you're running Pydantic AI inside GCP, you don't need to set up authentication, it should "just work".
52
+
4. You can decide which region to use, which might be important from a regulatory perspective, and might improve latency.
53
+
54
+
The big disadvantage is that for local development you may need to create and configure a "service account", which can be challenging to get right.
55
+
56
+
Whichever way you authenticate, you'll need to have VertexAI enabled in your GCP account.
57
+
47
58
To use Vertex AI, you may need to set up [application default credentials](https://cloud.google.com/docs/authentication/application-default-credentials) or use a service account. You can also specify the region.
0 commit comments