pydantic-ai-slim 0.0.21__py3-none-any.whl → 0.0.22__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-slim might be problematic. Click here for more details.
- pydantic_ai/_agent_graph.py +770 -0
- pydantic_ai/agent.py +182 -554
- pydantic_ai/models/__init__.py +4 -0
- pydantic_ai/models/gemini.py +7 -1
- pydantic_ai/models/openai.py +6 -1
- pydantic_ai/settings.py +5 -0
- {pydantic_ai_slim-0.0.21.dist-info → pydantic_ai_slim-0.0.22.dist-info}/METADATA +2 -3
- {pydantic_ai_slim-0.0.21.dist-info → pydantic_ai_slim-0.0.22.dist-info}/RECORD +9 -8
- {pydantic_ai_slim-0.0.21.dist-info → pydantic_ai_slim-0.0.22.dist-info}/WHEEL +0 -0
pydantic_ai/models/__init__.py
CHANGED
|
@@ -52,11 +52,15 @@ KnownModelName = Literal[
|
|
|
52
52
|
'google-gla:gemini-1.5-flash-8b',
|
|
53
53
|
'google-gla:gemini-1.5-pro',
|
|
54
54
|
'google-gla:gemini-2.0-flash-exp',
|
|
55
|
+
'google-gla:gemini-2.0-flash-thinking-exp-01-21',
|
|
56
|
+
'google-gla:gemini-exp-1206',
|
|
55
57
|
'google-vertex:gemini-1.0-pro',
|
|
56
58
|
'google-vertex:gemini-1.5-flash',
|
|
57
59
|
'google-vertex:gemini-1.5-flash-8b',
|
|
58
60
|
'google-vertex:gemini-1.5-pro',
|
|
59
61
|
'google-vertex:gemini-2.0-flash-exp',
|
|
62
|
+
'google-vertex:gemini-2.0-flash-thinking-exp-01-21',
|
|
63
|
+
'google-vertex:gemini-exp-1206',
|
|
60
64
|
'gpt-3.5-turbo',
|
|
61
65
|
'gpt-3.5-turbo-0125',
|
|
62
66
|
'gpt-3.5-turbo-0301',
|
pydantic_ai/models/gemini.py
CHANGED
|
@@ -40,7 +40,13 @@ from . import (
|
|
|
40
40
|
)
|
|
41
41
|
|
|
42
42
|
GeminiModelName = Literal[
|
|
43
|
-
'gemini-1.5-flash',
|
|
43
|
+
'gemini-1.5-flash',
|
|
44
|
+
'gemini-1.5-flash-8b',
|
|
45
|
+
'gemini-1.5-pro',
|
|
46
|
+
'gemini-1.0-pro',
|
|
47
|
+
'gemini-2.0-flash-exp',
|
|
48
|
+
'gemini-2.0-flash-thinking-exp-01-21',
|
|
49
|
+
'gemini-exp-1206',
|
|
44
50
|
]
|
|
45
51
|
"""Named Gemini models.
|
|
46
52
|
|
pydantic_ai/models/openai.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from __future__ import annotations as _annotations
|
|
2
2
|
|
|
3
|
+
import os
|
|
3
4
|
from collections.abc import AsyncIterable, AsyncIterator, Iterable
|
|
4
5
|
from contextlib import asynccontextmanager
|
|
5
6
|
from dataclasses import dataclass, field
|
|
@@ -101,7 +102,11 @@ class OpenAIModel(Model):
|
|
|
101
102
|
In the future, this may be inferred from the model name.
|
|
102
103
|
"""
|
|
103
104
|
self.model_name: OpenAIModelName = model_name
|
|
104
|
-
|
|
105
|
+
# This is a workaround for the OpenAI client requiring an API key, whilst locally served,
|
|
106
|
+
# openai compatible models do not always need an API key.
|
|
107
|
+
if api_key is None and 'OPENAI_API_KEY' not in os.environ and base_url is not None and openai_client is None:
|
|
108
|
+
api_key = ''
|
|
109
|
+
elif openai_client is not None:
|
|
105
110
|
assert http_client is None, 'Cannot provide both `openai_client` and `http_client`'
|
|
106
111
|
assert base_url is None, 'Cannot provide both `openai_client` and `base_url`'
|
|
107
112
|
assert api_key is None, 'Cannot provide both `openai_client` and `api_key`'
|
pydantic_ai/settings.py
CHANGED
|
@@ -80,6 +80,7 @@ class ModelSettings(TypedDict, total=False):
|
|
|
80
80
|
"""Whether to allow parallel tool calls.
|
|
81
81
|
|
|
82
82
|
Supported by:
|
|
83
|
+
|
|
83
84
|
* OpenAI (some models, not o1)
|
|
84
85
|
* Groq
|
|
85
86
|
* Anthropic
|
|
@@ -89,6 +90,7 @@ class ModelSettings(TypedDict, total=False):
|
|
|
89
90
|
"""The random seed to use for the model, theoretically allowing for deterministic results.
|
|
90
91
|
|
|
91
92
|
Supported by:
|
|
93
|
+
|
|
92
94
|
* OpenAI
|
|
93
95
|
* Groq
|
|
94
96
|
* Cohere
|
|
@@ -99,6 +101,7 @@ class ModelSettings(TypedDict, total=False):
|
|
|
99
101
|
"""Penalize new tokens based on whether they have appeared in the text so far.
|
|
100
102
|
|
|
101
103
|
Supported by:
|
|
104
|
+
|
|
102
105
|
* OpenAI
|
|
103
106
|
* Groq
|
|
104
107
|
* Cohere
|
|
@@ -110,6 +113,7 @@ class ModelSettings(TypedDict, total=False):
|
|
|
110
113
|
"""Penalize new tokens based on their existing frequency in the text so far.
|
|
111
114
|
|
|
112
115
|
Supported by:
|
|
116
|
+
|
|
113
117
|
* OpenAI
|
|
114
118
|
* Groq
|
|
115
119
|
* Cohere
|
|
@@ -121,6 +125,7 @@ class ModelSettings(TypedDict, total=False):
|
|
|
121
125
|
"""Modify the likelihood of specified tokens appearing in the completion.
|
|
122
126
|
|
|
123
127
|
Supported by:
|
|
128
|
+
|
|
124
129
|
* OpenAI
|
|
125
130
|
* Groq
|
|
126
131
|
"""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pydantic-ai-slim
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.22
|
|
4
4
|
Summary: Agent Framework / shim to use Pydantic with LLMs, slim package
|
|
5
5
|
Author-email: Samuel Colvin <samuel@pydantic.dev>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -28,13 +28,12 @@ Requires-Dist: eval-type-backport>=0.2.0
|
|
|
28
28
|
Requires-Dist: griffe>=1.3.2
|
|
29
29
|
Requires-Dist: httpx>=0.27
|
|
30
30
|
Requires-Dist: logfire-api>=1.2.0
|
|
31
|
+
Requires-Dist: pydantic-graph==0.0.22
|
|
31
32
|
Requires-Dist: pydantic>=2.10
|
|
32
33
|
Provides-Extra: anthropic
|
|
33
34
|
Requires-Dist: anthropic>=0.40.0; extra == 'anthropic'
|
|
34
35
|
Provides-Extra: cohere
|
|
35
36
|
Requires-Dist: cohere>=5.13.11; extra == 'cohere'
|
|
36
|
-
Provides-Extra: graph
|
|
37
|
-
Requires-Dist: pydantic-graph==0.0.21; extra == 'graph'
|
|
38
37
|
Provides-Extra: groq
|
|
39
38
|
Requires-Dist: groq>=0.12.0; extra == 'groq'
|
|
40
39
|
Provides-Extra: logfire
|
|
@@ -1,29 +1,30 @@
|
|
|
1
1
|
pydantic_ai/__init__.py,sha256=FbYetEgT6OO25u2KF5ZnFxKpz5DtnSpfckRXP4mjl8E,489
|
|
2
|
+
pydantic_ai/_agent_graph.py,sha256=IdznyPzgrLmfiw3733GA3gYWOA_6LYIEuXBKTBXOi0A,32942
|
|
2
3
|
pydantic_ai/_griffe.py,sha256=RYRKiLbgG97QxnazbAwlnc74XxevGHLQet-FGfq9qls,3960
|
|
3
4
|
pydantic_ai/_parts_manager.py,sha256=ARfDQY1_5AIY5rNl_M2fAYHEFCe03ZxdhgjHf9qeIKw,11872
|
|
4
5
|
pydantic_ai/_pydantic.py,sha256=dROz3Hmfdi0C2exq88FhefDRVo_8S3rtkXnoUHzsz0c,8753
|
|
5
6
|
pydantic_ai/_result.py,sha256=tN1pVulf_EM4bkBvpNUWPnUXezLY-sBrJEVCFdy2nLU,10264
|
|
6
7
|
pydantic_ai/_system_prompt.py,sha256=602c2jyle2R_SesOrITBDETZqsLk4BZ8Cbo8yEhmx04,1120
|
|
7
8
|
pydantic_ai/_utils.py,sha256=zfuY3NiPPsSM5J1q2JElfbfIa8S1ONGOlC7M-iyBVso,9430
|
|
8
|
-
pydantic_ai/agent.py,sha256=
|
|
9
|
+
pydantic_ai/agent.py,sha256=RDKBnHU1yFBMwW9e7_BUYs4aRfbwJ69bpWp_ha2y9M0,44880
|
|
9
10
|
pydantic_ai/exceptions.py,sha256=eGDKX6bGhgVxXBzu81Sk3iiAkXr0GUtgT7bD5Rxlqpg,2028
|
|
10
11
|
pydantic_ai/format_as_xml.py,sha256=QE7eMlg5-YUMw1_2kcI3h0uKYPZZyGkgXFDtfZTMeeI,4480
|
|
11
12
|
pydantic_ai/messages.py,sha256=kzXn4ZjlX9Sy2KXgFHWYbbwPk7TzTPdztzOJLWEONwU,17101
|
|
12
13
|
pydantic_ai/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
14
|
pydantic_ai/result.py,sha256=0beXiUfiSb2kVc68iqLeg2qFQW6-mnTC8TFtiQayPDQ,18394
|
|
14
|
-
pydantic_ai/settings.py,sha256=
|
|
15
|
+
pydantic_ai/settings.py,sha256=ntuWnke9UA18aByDxk9OIhN0tAgOaPdqCEkRf-wlp8Y,3059
|
|
15
16
|
pydantic_ai/tools.py,sha256=lhupwm815lPlFFS79B0P61AyhUYtepA62LbZOCJrPEY,13205
|
|
16
17
|
pydantic_ai/usage.py,sha256=60d9f6M7YEYuKMbqDGDogX4KsA73fhDtWyDXYXoIPaI,4948
|
|
17
|
-
pydantic_ai/models/__init__.py,sha256=
|
|
18
|
+
pydantic_ai/models/__init__.py,sha256=kVWd_WEK2dThHoG0Yha4t93w4Zaqkjcu9sKJ7nNqX_U,13245
|
|
18
19
|
pydantic_ai/models/anthropic.py,sha256=v2m6zjaezLjtkHO2Rx67rmoN1iOqDeAp9fswJcqRMBA,16967
|
|
19
20
|
pydantic_ai/models/cohere.py,sha256=wyjtD2uwkYYbsXLKwr-flmXSng_Atd-0jqtVDxDie14,10611
|
|
20
21
|
pydantic_ai/models/function.py,sha256=jv2aw5K4KrMIRPFSTiGbBHcv16UZtGEe_1irjTudLg0,9826
|
|
21
|
-
pydantic_ai/models/gemini.py,sha256=
|
|
22
|
+
pydantic_ai/models/gemini.py,sha256=OsvtVqmKK4XmnLjPTRFwtCeXEuBOWfPrVZVZq0mSA30,28305
|
|
22
23
|
pydantic_ai/models/groq.py,sha256=W-uosi9PtvgXp8yoF6w8QZxPtrVjX1fmRQDjQQ10meE,13603
|
|
23
24
|
pydantic_ai/models/mistral.py,sha256=RuRlxTBPGXIpcwTdjX2596uN2tgHBvCDQCWieWa1A_Q,24793
|
|
24
|
-
pydantic_ai/models/openai.py,sha256=
|
|
25
|
+
pydantic_ai/models/openai.py,sha256=ZwhYcpPIehDzmOBY_U1BKQhxYPtvKUeQjs9jDNr23bU,15547
|
|
25
26
|
pydantic_ai/models/test.py,sha256=D_wBpRtrPcikopd5LBYjdAp3q-1gvuB9WnuopBQiRME,16659
|
|
26
27
|
pydantic_ai/models/vertexai.py,sha256=bQZ5W8n4521AH3jTiyP1fOYxtNgCgkhjCbBeASv5Ap8,9388
|
|
27
|
-
pydantic_ai_slim-0.0.
|
|
28
|
-
pydantic_ai_slim-0.0.
|
|
29
|
-
pydantic_ai_slim-0.0.
|
|
28
|
+
pydantic_ai_slim-0.0.22.dist-info/METADATA,sha256=lhhSBLTlHXj025p-n0u_X3EGOZnoSUTjAkXk59_WEV8,2839
|
|
29
|
+
pydantic_ai_slim-0.0.22.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
30
|
+
pydantic_ai_slim-0.0.22.dist-info/RECORD,,
|
|
File without changes
|