pydantic-ai-examples 1.6.0__py3-none-any.whl → 1.8.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of pydantic-ai-examples might be problematic. Click here for more details.

@@ -7,7 +7,7 @@ from zoneinfo import ZoneInfo
7
7
 
8
8
  from pydantic_ai import Agent
9
9
 
10
- agent = Agent('openai:gpt-4o-mini')
10
+ agent = Agent('openai:gpt-5-mini')
11
11
  app = agent.to_ag_ui()
12
12
 
13
13
 
@@ -48,7 +48,7 @@ class JSONPatchOp(BaseModel):
48
48
 
49
49
 
50
50
  agent = Agent(
51
- 'openai:gpt-4o-mini',
51
+ 'openai:gpt-5-mini',
52
52
  instructions=dedent(
53
53
  """
54
54
  When planning use tools only, without any other messages.
@@ -10,7 +10,7 @@ from textwrap import dedent
10
10
  from pydantic_ai import Agent
11
11
 
12
12
  agent = Agent(
13
- 'openai:gpt-4o-mini',
13
+ 'openai:gpt-5-mini',
14
14
  instructions=dedent(
15
15
  """
16
16
  When planning tasks use tools only, without any other messages.
@@ -17,7 +17,7 @@ class DocumentState(BaseModel):
17
17
  document: str = ''
18
18
 
19
19
 
20
- agent = Agent('openai:gpt-4o-mini', deps_type=StateDeps[DocumentState])
20
+ agent = Agent('openai:gpt-5-mini', deps_type=StateDeps[DocumentState])
21
21
 
22
22
 
23
23
  # Tools which return AG-UI events will be sent to the client as part of the
@@ -84,7 +84,7 @@ class RecipeSnapshot(BaseModel):
84
84
  )
85
85
 
86
86
 
87
- agent = Agent('openai:gpt-4o-mini', deps_type=StateDeps[RecipeSnapshot])
87
+ agent = Agent('openai:gpt-5-mini', deps_type=StateDeps[RecipeSnapshot])
88
88
 
89
89
 
90
90
  @agent.tool_plain
@@ -7,5 +7,5 @@ from __future__ import annotations
7
7
 
8
8
  from pydantic_ai import Agent
9
9
 
10
- agent = Agent('openai:gpt-4o-mini')
10
+ agent = Agent('openai:gpt-5-mini')
11
11
  app = agent.to_ag_ui()
@@ -51,7 +51,7 @@ class SupportOutput(BaseModel):
51
51
 
52
52
 
53
53
  support_agent = Agent(
54
- 'openai:gpt-4o',
54
+ 'openai:gpt-5',
55
55
  deps_type=SupportDependencies,
56
56
  output_type=SupportOutput,
57
57
  instructions=(
@@ -40,7 +40,7 @@ from pydantic_ai import (
40
40
  logfire.configure(send_to_logfire='if-token-present')
41
41
  logfire.instrument_pydantic_ai()
42
42
 
43
- agent = Agent('openai:gpt-4o')
43
+ agent = Agent('openai:gpt-5')
44
44
  THIS_DIR = Path(__file__).parent
45
45
 
46
46
 
@@ -26,7 +26,7 @@ class AnalystAgentDeps:
26
26
 
27
27
 
28
28
  analyst_agent = Agent(
29
- 'openai:gpt-4o',
29
+ 'openai:gpt-5',
30
30
  deps_type=AnalystAgentDeps,
31
31
  instructions='You are a data analyst and your job is to analyze the data according to the user request.',
32
32
  )
@@ -21,7 +21,7 @@ class TimeRangeDeps:
21
21
 
22
22
 
23
23
  time_range_agent = Agent[TimeRangeDeps, TimeRangeResponse](
24
- 'gpt-4o',
24
+ 'gpt-5',
25
25
  output_type=TimeRangeResponse, # type: ignore # we can't yet annotate something as receiving a TypeForm
26
26
  deps_type=TimeRangeDeps,
27
27
  system_prompt="Convert the user's request into a structured time range.",
@@ -28,8 +28,8 @@ def compare_models():
28
28
  dataset_path, custom_evaluator_types=CUSTOM_EVALUATOR_TYPES
29
29
  )
30
30
  with logfire.span('Comparing different models for time_range_agent'):
31
- with time_range_agent.override(model='openai:gpt-4o'):
32
- dataset.evaluate_sync(infer_time_range, name='openai:gpt-4o')
31
+ with time_range_agent.override(model='openai:gpt-5'):
32
+ dataset.evaluate_sync(infer_time_range, name='openai:gpt-5')
33
33
  with time_range_agent.override(model='openai:o1'):
34
34
  dataset.evaluate_sync(infer_time_range, name='openai:o1')
35
35
 
@@ -49,7 +49,7 @@ class Deps:
49
49
 
50
50
  # This agent is responsible for controlling the flow of the conversation.
51
51
  search_agent = Agent[Deps, FlightDetails | NoFlightFound](
52
- 'openai:gpt-4o',
52
+ 'openai:gpt-5',
53
53
  output_type=FlightDetails | NoFlightFound, # type: ignore
54
54
  retries=4,
55
55
  system_prompt=(
@@ -60,7 +60,7 @@ search_agent = Agent[Deps, FlightDetails | NoFlightFound](
60
60
 
61
61
  # This agent is responsible for extracting flight details from web page text.
62
62
  extraction_agent = Agent(
63
- 'openai:gpt-4o',
63
+ 'openai:gpt-5',
64
64
  output_type=list[FlightDetails],
65
65
  system_prompt='Extract all the flight details from the given text.',
66
66
  )
@@ -112,7 +112,7 @@ class Failed(BaseModel):
112
112
 
113
113
  # This agent is responsible for extracting the user's seat selection
114
114
  seat_preference_agent = Agent[None, SeatPreference | Failed](
115
- 'openai:gpt-4o',
115
+ 'openai:gpt-5',
116
116
  output_type=SeatPreference | Failed,
117
117
  system_prompt=(
118
118
  "Extract the user's seat preference. "
@@ -22,7 +22,7 @@ class MyModel(BaseModel):
22
22
  country: str
23
23
 
24
24
 
25
- model = os.getenv('PYDANTIC_AI_MODEL', 'openai:gpt-4o')
25
+ model = os.getenv('PYDANTIC_AI_MODEL', 'openai:gpt-5')
26
26
  print(f'Using model: {model}')
27
27
  agent = Agent(model, output_type=MyModel)
28
28
 
@@ -26,7 +26,7 @@ from pydantic_graph.persistence.file import FileStatePersistence
26
26
  logfire.configure(send_to_logfire='if-token-present')
27
27
  logfire.instrument_pydantic_ai()
28
28
 
29
- ask_agent = Agent('openai:gpt-4o', output_type=str)
29
+ ask_agent = Agent('openai:gpt-5', output_type=str)
30
30
 
31
31
 
32
32
  @dataclass
@@ -65,7 +65,7 @@ class EvaluationOutput(BaseModel, use_attribute_docstrings=True):
65
65
 
66
66
 
67
67
  evaluate_agent = Agent(
68
- 'openai:gpt-4o',
68
+ 'openai:gpt-5',
69
69
  output_type=EvaluationOutput,
70
70
  system_prompt='Given a question and answer, evaluate if the answer is correct.',
71
71
  )
@@ -49,7 +49,7 @@ class Deps:
49
49
  pool: asyncpg.Pool
50
50
 
51
51
 
52
- agent = Agent('openai:gpt-4o', deps_type=Deps)
52
+ agent = Agent('openai:gpt-5', deps_type=Deps)
53
53
 
54
54
 
55
55
  @agent.tool
@@ -11,7 +11,7 @@ from .models import Analysis, Profile
11
11
 
12
12
  ### [agent]
13
13
  agent = Agent(
14
- 'openai:gpt-4o',
14
+ 'openai:gpt-5',
15
15
  instructions=dedent(
16
16
  """
17
17
  When a new person joins our public Slack, please put together a brief snapshot so we can be most useful to them.
@@ -92,7 +92,7 @@ class InvalidRequest(BaseModel):
92
92
 
93
93
  Response: TypeAlias = Success | InvalidRequest
94
94
  agent = Agent[Deps, Response](
95
- 'google-gla:gemini-1.5-flash',
95
+ 'google-gla:gemini-2.5-flash',
96
96
  # Type ignore while we wait for PEP-0747, nonetheless unions will work fine everywhere else
97
97
  output_type=Response, # type: ignore
98
98
  deps_type=Deps,
@@ -26,8 +26,8 @@ agent = Agent()
26
26
 
27
27
  # models to try, and the appropriate env var
28
28
  models: list[tuple[KnownModelName, str]] = [
29
- ('google-gla:gemini-2.0-flash', 'GEMINI_API_KEY'),
30
- ('openai:gpt-4o-mini', 'OPENAI_API_KEY'),
29
+ ('google-gla:gemini-2.5-flash', 'GEMINI_API_KEY'),
30
+ ('openai:gpt-5-mini', 'OPENAI_API_KEY'),
31
31
  ('groq:llama-3.3-70b-versatile', 'GROQ_API_KEY'),
32
32
  ]
33
33
 
@@ -32,7 +32,7 @@ class Deps:
32
32
 
33
33
 
34
34
  weather_agent = Agent(
35
- 'openai:gpt-4.1-mini',
35
+ 'openai:gpt-5-mini',
36
36
  # 'Be concise, reply with one sentence.' is enough for some models (like openai) to use
37
37
  # the below tools appropriately, but others like anthropic and gemini require a bit more direction.
38
38
  instructions='Be concise, reply with one sentence.',
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pydantic-ai-examples
3
- Version: 1.6.0
3
+ Version: 1.8.0
4
4
  Summary: Examples of how to use Pydantic AI and what it can do.
5
5
  Author-email: Samuel Colvin <samuel@pydantic.dev>, Marcelo Trylesinski <marcelotryle@gmail.com>, David Montague <david@pydantic.dev>, Alex Hall <alex@pydantic.dev>, Douwe Maan <douwe@pydantic.dev>
6
6
  License-Expression: MIT
@@ -34,8 +34,8 @@ Requires-Dist: logfire[asyncpg,fastapi,httpx,sqlite3]>=3.14.1
34
34
  Requires-Dist: mcp[cli]>=1.4.1
35
35
  Requires-Dist: modal>=1.0.4
36
36
  Requires-Dist: pandas>=2.2.3
37
- Requires-Dist: pydantic-ai-slim[ag-ui,anthropic,groq,openai,vertexai]==1.6.0
38
- Requires-Dist: pydantic-evals==1.6.0
37
+ Requires-Dist: pydantic-ai-slim[ag-ui,anthropic,groq,openai,vertexai]==1.8.0
38
+ Requires-Dist: pydantic-evals==1.8.0
39
39
  Requires-Dist: python-multipart>=0.0.17
40
40
  Requires-Dist: rich>=13.9.2
41
41
  Requires-Dist: uvicorn>=0.32.0
@@ -1,50 +1,50 @@
1
1
  pydantic_ai_examples/__main__.py,sha256=i0LEo2JBOZ-gnHED0ou5Bya43gi7KmOyQ_jKN7M5Ces,1647
2
- pydantic_ai_examples/bank_support.py,sha256=TEy19B4iyB49A-ZMv1rOZIE_bOHml5er1Qaz700e2NU,2665
2
+ pydantic_ai_examples/bank_support.py,sha256=O9r6yQraDRPibWLOC1wyZu0n_Nr7Exg4u7wEHh25czk,2664
3
3
  pydantic_ai_examples/chat_app.html,sha256=90XhxrpDAT09mPVTn9edEn8PqAD-tHxWkeeMz9r_okQ,2580
4
- pydantic_ai_examples/chat_app.py,sha256=95sRAnzWZzjF_P4xhfbBZf1gG6UZnrJ25JxSlrDk0SI,7054
4
+ pydantic_ai_examples/chat_app.py,sha256=AX28rI0TR9lTPLDOd0uEkmirvfIZCRyCGr_VdGiOkHM,7053
5
5
  pydantic_ai_examples/chat_app.ts,sha256=2KfZ2rJU2o0iCPjelyqEi5sH6vfemzWaa5Evx_VcAE4,3307
6
- pydantic_ai_examples/data_analyst.py,sha256=vSpfIWpxNgaZqKx2DJD721ZA3QgSjaZkTixy5OHz9xY,3753
7
- pydantic_ai_examples/flight_booking.py,sha256=dPzbP386m85IzEpIPu_oh7kBi-zfdsgFzzMNdUo-fko,7418
6
+ pydantic_ai_examples/data_analyst.py,sha256=sC6mcgfeWzfj4STB7J_7oAWC7T8Y0NWvlIeQ8XND9zA,3752
7
+ pydantic_ai_examples/flight_booking.py,sha256=x8FbztbAiqNdDACzal1O5M80syjt8UuGm_wqHpybeQM,7415
8
8
  pydantic_ai_examples/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
- pydantic_ai_examples/pydantic_model.py,sha256=EQsHBig2bvb0PG_2XDgP9Le5xJ4n8eZJzQDGQYhDykg,775
10
- pydantic_ai_examples/question_graph.py,sha256=lVh48-vu0zRqx6Tw1Z5nh-L0fXsUqfOs5Ir_zG8128g,5075
11
- pydantic_ai_examples/rag.py,sha256=Jbd1fo8LIXp34qCz9tPXPNqYjQUGtUmfK86iWMThR0Q,8011
9
+ pydantic_ai_examples/pydantic_model.py,sha256=4u_-sdpKSF_lRMLSI-WVYwsyIxgdOpq-8LSCJunoyvA,774
10
+ pydantic_ai_examples/question_graph.py,sha256=ERjlfHxKXswISed6TJtj60SFoTIYe-PyCTZoYR4OJkY,5073
11
+ pydantic_ai_examples/rag.py,sha256=7zilWBrVsag0iIgiJ_I5-_khDkZUYvfrzMJRhtv48hM,8010
12
12
  pydantic_ai_examples/roulette_wheel.py,sha256=2YHKbGzYOkLsd98hO3ntjM6pChR1UpmsRrLD36Qh5f0,1654
13
- pydantic_ai_examples/sql_gen.py,sha256=rRp_C0ZvfLu6rkR5wrVvgah6wd92nh1vT4UYurx5pmU,5159
14
- pydantic_ai_examples/stream_markdown.py,sha256=rdhrR6XkqoeOpfv_xFbRpKDV4drEAd8ZrsFBXVrdvHs,2454
13
+ pydantic_ai_examples/sql_gen.py,sha256=akgJv4TSImw6O4NRgQZh92QITSmDeEyvoGQcU3oUNFQ,5159
14
+ pydantic_ai_examples/stream_markdown.py,sha256=4uEK6dzC9jVcQTRaYBEDzYfYAJPYHZWfLJ-ZMtmI8y4,2453
15
15
  pydantic_ai_examples/stream_whales.py,sha256=Yoa7IuqN_6fowfYSINW39uPCthYu9FKChF-QBmQqWb8,2721
16
- pydantic_ai_examples/weather_agent.py,sha256=E42RbuVDJzxlBw9lF2ARNSNAhL1HWVEmTt5MN70DyDU,3187
16
+ pydantic_ai_examples/weather_agent.py,sha256=FZF7pgL2U24m-ymFUw6MnqASVpXOfl49ilrYAtZXlOo,3185
17
17
  pydantic_ai_examples/weather_agent_gradio.py,sha256=MCoNp5TgWj628ABoZpTUVJYIeSV_C-ig08WfcssDH7A,4719
18
18
  pydantic_ai_examples/ag_ui/__init__.py,sha256=ZZs2V-5e9RaLl_7hJAq9-0Juk_f0mk2Vr7a4QT2QB-k,1174
19
19
  pydantic_ai_examples/ag_ui/__main__.py,sha256=PMycatJt8Abb-Q8HXRGZoEY6vnOcvRebH7iI9MxLknA,225
20
20
  pydantic_ai_examples/ag_ui/api/__init__.py,sha256=Pe307_ET_ERKBP-8Vs4L1yZRkK3ILPpajwxDpeW8YiI,673
21
- pydantic_ai_examples/ag_ui/api/agentic_chat.py,sha256=Vrz7TVLHRs28gEdVXQ44R8jJtRU7EPrDjgqSUH90yh4,533
22
- pydantic_ai_examples/ag_ui/api/agentic_generative_ui.py,sha256=z2MVonvUKw-9vA4RC8Z8Jz0qYYcmzkxY-1CLotXzDDo,3489
23
- pydantic_ai_examples/ag_ui/api/human_in_the_loop.py,sha256=130SDox5HoYjusPr2ubliI8udhxtNxUS3kD9RPb0zYc,765
24
- pydantic_ai_examples/ag_ui/api/predictive_state_updates.py,sha256=w98JrwWJfu0fIMdgWbcFcmLz8wZT4bMdfWsCbV9k8Co,2124
25
- pydantic_ai_examples/ag_ui/api/shared_state.py,sha256=W3Q5EOUgNuhgJ6ncb_JlvQXf9JjMy-SeMBDTKnofr54,3802
26
- pydantic_ai_examples/ag_ui/api/tool_based_generative_ui.py,sha256=eT--lWjTzL0S3aIu9C14yeoixLjFXPWqwcdiuIlUAJk,219
21
+ pydantic_ai_examples/ag_ui/api/agentic_chat.py,sha256=PsKHQpL-sx2cgMKg9uW1qQlRAQpPOK6EAES7VBevJXQ,532
22
+ pydantic_ai_examples/ag_ui/api/agentic_generative_ui.py,sha256=dbP6MIw2GBdkgBqfAxXklFpHwxBH8trp7HR7He6QnMQ,3488
23
+ pydantic_ai_examples/ag_ui/api/human_in_the_loop.py,sha256=MmfUwxp9EEELzS2ikx-Y1uY3LUmr8M7k2M7Fre7tma8,764
24
+ pydantic_ai_examples/ag_ui/api/predictive_state_updates.py,sha256=oAvnz6LQLCEuEhMqWVmEDuVuHJOoLObdzGmppJFHLSc,2123
25
+ pydantic_ai_examples/ag_ui/api/shared_state.py,sha256=J09k2Ry83K3aCwbsEq9j3k8e7EJiD6fJRjzjaYOt8IE,3801
26
+ pydantic_ai_examples/ag_ui/api/tool_based_generative_ui.py,sha256=zSUcn31wDksEStPofSuvjF0Arc0TglpvCzm_-bVG-PM,218
27
27
  pydantic_ai_examples/evals/__init__.py,sha256=4f1v2o4F-gnUVtlkZU-dpwwwbLhqRxMcZv676atjNLg,115
28
- pydantic_ai_examples/evals/agent.py,sha256=KjCsUiL28RCNT6NwoQnQCwJ0xRw3EUGdIrYhlIjmVqI,2042
28
+ pydantic_ai_examples/evals/agent.py,sha256=o_l6I4DF3HXh7fgsmyz7mViq1ckdFV1Hxq_B7KJPLa0,2041
29
29
  pydantic_ai_examples/evals/custom_evaluators.py,sha256=siSpALUMrUGJ1DDrm0Ejniuxhmxhlvee_jubgXjOAeU,2244
30
30
  pydantic_ai_examples/evals/example_01_generate_dataset.py,sha256=R-cV9bBHMA8EMIyveP5Yf2p3_VV-g_NSXtDa_zz0ODs,2368
31
31
  pydantic_ai_examples/evals/example_02_add_custom_evaluators.py,sha256=pFX0bvVeyfbZGGb0LSajRW-g1ZiVID3e3-sEXZVcjv8,977
32
32
  pydantic_ai_examples/evals/example_03_unit_testing.py,sha256=G4Ry7ykJfozaQ9GEXi6cnz0O-6pGBrZIkV4_6RNK194,1207
33
- pydantic_ai_examples/evals/example_04_compare_models.py,sha256=aYCIkbwpD-O4MgAKDik3XlK9Y7xpq9DOFiXRWMes2aE,1201
33
+ pydantic_ai_examples/evals/example_04_compare_models.py,sha256=4oPIeFgbk2vMkN7asN6LjWMYPatMpUFLkKhEzrioqJg,1199
34
34
  pydantic_ai_examples/evals/models.py,sha256=QYe_fNv03fmF4ssgSqutHgGx2YX5NLKhhth8-0XFnWo,1776
35
35
  pydantic_ai_examples/evals/datasets/time_range_v1.yaml,sha256=pSUawuDen4NQt2RqqJNmrVENgksTWxIFcw-Kkao_yo8,4193
36
36
  pydantic_ai_examples/evals/datasets/time_range_v1_schema.json,sha256=xS-wRRSvcoG2FcQZGdL0i332mbjsZh9MOSJAND6VkWU,19932
37
37
  pydantic_ai_examples/evals/datasets/time_range_v2.yaml,sha256=zIffxC5bR2l05MrrECJsTHiagFaz8nIPTH-YrmjJz8I,4326
38
38
  pydantic_ai_examples/evals/datasets/time_range_v2_schema.json,sha256=GDbDtBH1skdbUzK5Wd_0-SNXTmEWHMTYhhshaLsq_1Q,21309
39
39
  pydantic_ai_examples/slack_lead_qualifier/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
40
- pydantic_ai_examples/slack_lead_qualifier/agent.py,sha256=0OlqkXYps7bbetRVpv3jgBdwU4kJcYSyy1RycQxfyDk,1936
40
+ pydantic_ai_examples/slack_lead_qualifier/agent.py,sha256=kskE4RjlqeqAT51NDt7FoC1OIyQ47DqFcTDkCOvQS9k,1935
41
41
  pydantic_ai_examples/slack_lead_qualifier/app.py,sha256=KALNxIV8hz0lGxFclZHxolqoH4MsiIYga_CmpidzONE,1036
42
42
  pydantic_ai_examples/slack_lead_qualifier/functions.py,sha256=4LsYtPH_SBo_rJ7008DXvKq_SOwiGtweW_DfzJh8R0s,2196
43
43
  pydantic_ai_examples/slack_lead_qualifier/modal.py,sha256=f464AaeyP-n3UIfvEVVc4DZ7FQQtsEX7-kUP3VqoPYo,1635
44
44
  pydantic_ai_examples/slack_lead_qualifier/models.py,sha256=WTp6D2WCASXqrjPVT3vGgTSYATLPBM3_cjq9wvXMRao,1586
45
45
  pydantic_ai_examples/slack_lead_qualifier/slack.py,sha256=VJVfMeUXYClWUJBLHNuaW8PB2sxjNzpTC-O_AJwcxQ4,833
46
46
  pydantic_ai_examples/slack_lead_qualifier/store.py,sha256=04vB4eZWKk_Tx0b9K4QuVI1U24JEyJyBS4X76cui7OI,896
47
- pydantic_ai_examples-1.6.0.dist-info/METADATA,sha256=ITohqTC9kOnpotz2i_MrSUMnMFRN2vc_BcdXcoH5_5Q,2760
48
- pydantic_ai_examples-1.6.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
49
- pydantic_ai_examples-1.6.0.dist-info/licenses/LICENSE,sha256=vA6Jc482lEyBBuGUfD1pYx-cM7jxvLYOxPidZ30t_PQ,1100
50
- pydantic_ai_examples-1.6.0.dist-info/RECORD,,
47
+ pydantic_ai_examples-1.8.0.dist-info/METADATA,sha256=5MmWc0mCoCTmRE7W_Z0IGdsUyejVlX4TI6wMh2jcXX0,2760
48
+ pydantic_ai_examples-1.8.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
49
+ pydantic_ai_examples-1.8.0.dist-info/licenses/LICENSE,sha256=vA6Jc482lEyBBuGUfD1pYx-cM7jxvLYOxPidZ30t_PQ,1100
50
+ pydantic_ai_examples-1.8.0.dist-info/RECORD,,