|
3 | 3 | WARNING: running these tests will make use of the relevant API tokens (and cost money). |
4 | 4 | """ |
5 | 5 |
|
| 6 | +import json |
6 | 7 | import os |
7 | 8 | from collections.abc import AsyncIterator, Callable |
8 | 9 | from pathlib import Path |
@@ -40,14 +41,15 @@ def vertexai(_: httpx.AsyncClient, tmp_path: Path) -> Model: |
40 | 41 | from pydantic_ai.providers.google import GoogleProvider |
41 | 42 |
|
42 | 43 | service_account_content = os.environ['GOOGLE_SERVICE_ACCOUNT_CONTENT'] |
| 44 | + project_id = json.loads(service_account_content)['project_id'] |
43 | 45 | service_account_path = tmp_path / 'service_account.json' |
44 | 46 | service_account_path.write_text(service_account_content) |
45 | 47 |
|
46 | 48 | credentials = service_account.Credentials.from_service_account_file( # type: ignore[reportUnknownReturnType] |
47 | 49 | service_account_path, |
48 | 50 | scopes=['https://www.googleapis.com/auth/cloud-platform'], |
49 | 51 | ) |
50 | | - provider = GoogleProvider(credentials=credentials) |
| 52 | + provider = GoogleProvider(credentials=credentials, project=project_id) |
51 | 53 | return GoogleModel('gemini-1.5-flash', provider=provider) |
52 | 54 |
|
53 | 55 |
|
@@ -91,9 +93,7 @@ def cohere(http_client: httpx.AsyncClient, _tmp_path: Path) -> Model: |
91 | 93 | params = [ |
92 | 94 | pytest.param(openai, id='openai'), |
93 | 95 | pytest.param(gemini, marks=pytest.mark.skip(reason='API seems very flaky'), id='gemini'), |
94 | | - pytest.param( |
95 | | - vertexai, marks=pytest.mark.skip(reason='This needs to be fixed. It raises RuntimeError.'), id='vertexai' |
96 | | - ), |
| 96 | + pytest.param(vertexai, id='vertexai'), |
97 | 97 | pytest.param(groq, id='groq'), |
98 | 98 | pytest.param(anthropic, id='anthropic'), |
99 | 99 | pytest.param(ollama, id='ollama'), |
|
0 commit comments