File tree Expand file tree Collapse file tree 7 files changed +12
-30
lines changed
pydantic_ai_slim/pydantic_ai/models
pydantic_evals/pydantic_evals
pydantic_graph/pydantic_graph Expand file tree Collapse file tree 7 files changed +12
-30
lines changed Original file line number Diff line number Diff line change @@ -352,7 +352,7 @@ stateDiagram-v2
352352 Feedback --> [*]
353353```
354354
355- ``` python {title="genai_email_feedback.py" py="3.10" test="ci_only" }
355+ ``` python {title="genai_email_feedback.py" py="3.10"}
356356from __future__ import annotations as _annotations
357357
358358from dataclasses import dataclass, field
@@ -384,7 +384,7 @@ class State:
384384
385385
386386email_writer_agent = Agent(
387- ' google-vertex :gemini-1.5-pro' ,
387+ ' google-gla :gemini-1.5-pro' ,
388388 output_type = Email,
389389 system_prompt = ' Write a welcome email to our tech blog.' ,
390390)
Original file line number Diff line number Diff line change 7979 from mistralai .models .usermessage import UserMessage as MistralUserMessage
8080 from mistralai .types .basemodel import Unset as MistralUnset
8181 from mistralai .utils .eventstreaming import EventStreamAsync as MistralEventStreamAsync
82- except ImportError as e : # pragma: no cover
82+ except ImportError as e :
8383 raise ImportError (
8484 'Please install `mistral` to use the Mistral model, '
8585 'you can use the `mistral` optional group — `pip install "pydantic-ai-slim[mistral]"`'
Original file line number Diff line number Diff line change 5050else :
5151 ExceptionGroup = ExceptionGroup # pragma: lax no cover
5252
53- # while waiting for https://github.com/pydantic/logfire/issues/745
54- try :
55- import logfire ._internal .stack_info
56- except ImportError :
57- pass
58- else :
59- from pathlib import Path
60-
61- logfire ._internal .stack_info .NON_USER_CODE_PREFIXES += (str (Path (__file__ ).parent .absolute ()),) # pyright: ignore[reportPrivateImportUsage]
62-
6353__all__ = (
6454 'Case' ,
6555 'Dataset' ,
Original file line number Diff line number Diff line change 66from contextlib import AbstractContextManager , ExitStack , asynccontextmanager
77from dataclasses import dataclass , field
88from functools import cached_property
9+ from pathlib import Path
910from typing import Any , Generic , cast , overload
1011
1112import logfire_api
1819from .persistence import BaseStatePersistence
1920from .persistence .in_mem import SimpleStatePersistence
2021
21- # while waiting for https://github.com/pydantic/logfire/issues/745
22- try :
23- import logfire ._internal .stack_info
24- except ImportError :
25- pass
26- else :
27- from pathlib import Path
28-
29- logfire ._internal .stack_info .NON_USER_CODE_PREFIXES += (str (Path (__file__ ).parent .absolute ()),) # pyright: ignore[reportPrivateImportUsage]
30-
31-
3222__all__ = 'Graph' , 'GraphRun' , 'GraphRunResult'
3323
3424_logfire = logfire_api .Logfire (otel_scope = 'pydantic-graph' )
Original file line number Diff line number Diff line change @@ -414,7 +414,7 @@ def bedrock_provider():
414414 pytest .skip ('boto3 is not installed' )
415415
416416
417- @pytest .fixture (autouse = True )
417+ @pytest .fixture ()
418418def vertex_provider_auth (mocker : MockerFixture ) -> None : # pragma: lax no cover
419419 # Locally, we authenticate via `gcloud` CLI, so we don't need to patch anything.
420420 if not os .getenv ('CI' , False ):
@@ -423,7 +423,7 @@ def vertex_provider_auth(mocker: MockerFixture) -> None: # pragma: lax no cover
423423 try :
424424 from google .genai import _api_client
425425 except ImportError :
426- pytest . skip ( 'google is not installed' )
426+ return # do nothing if this isn't installed
427427
428428 @dataclass
429429 class NoOpCredentials :
@@ -440,7 +440,7 @@ def expired(self) -> bool:
440440
441441
442442@pytest .fixture ()
443- async def vertex_provider (): # pragma: lax no cover
443+ async def vertex_provider (vertex_provider_auth : None ): # pragma: lax no cover
444444 # NOTE: You need to comment out this line to rewrite the cassettes locally.
445445 if not os .getenv ('CI' , False ):
446446 pytest .skip ('Requires properly configured local google vertex config to pass' )
Original file line number Diff line number Diff line change @@ -1113,9 +1113,10 @@ async def test_google_url_input(
11131113 not os .getenv ('CI' , False ), reason = 'Requires properly configured local google vertex config to pass'
11141114)
11151115@pytest .mark .vcr ()
1116- async def test_google_url_input_force_download (allow_model_requests : None ) -> None : # pragma: lax no cover
1117- provider = GoogleProvider (project = 'pydantic-ai' , location = 'us-central1' )
1118- m = GoogleModel ('gemini-2.0-flash' , provider = provider )
1116+ async def test_google_url_input_force_download (
1117+ allow_model_requests : None , vertex_provider : GoogleProvider
1118+ ) -> None : # pragma: lax no cover
1119+ m = GoogleModel ('gemini-2.0-flash' , provider = vertex_provider )
11191120 agent = Agent (m )
11201121
11211122 video_url = VideoUrl (url = 'https://data.grepit.app/assets/tiny_video.mp4' , force_download = True )
Original file line number Diff line number Diff line change @@ -113,6 +113,7 @@ def test_docs_examples( # noqa: C901
113113 allow_model_requests : None ,
114114 env : TestEnv ,
115115 tmp_path_cwd : Path ,
116+ vertex_provider_auth : None ,
116117):
117118 mocker .patch ('pydantic_ai.agent.models.infer_model' , side_effect = mock_infer_model )
118119 mocker .patch ('pydantic_ai._utils.group_by_temporal' , side_effect = mock_group_by_temporal )
You can’t perform that action at this time.
0 commit comments