pydantic-ai-slim 0.0.16__py3-none-any.whl → 0.0.18__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/_griffe.py +13 -1
- pydantic_ai/_system_prompt.py +1 -0
- pydantic_ai/agent.py +272 -68
- pydantic_ai/format_as_xml.py +115 -0
- pydantic_ai/messages.py +6 -0
- pydantic_ai/models/__init__.py +28 -10
- pydantic_ai/models/anthropic.py +1 -1
- pydantic_ai/models/gemini.py +22 -24
- pydantic_ai/models/vertexai.py +2 -2
- pydantic_ai/result.py +92 -69
- pydantic_ai/settings.py +1 -61
- pydantic_ai/tools.py +7 -7
- pydantic_ai/usage.py +114 -0
- {pydantic_ai_slim-0.0.16.dist-info → pydantic_ai_slim-0.0.18.dist-info}/METADATA +1 -1
- pydantic_ai_slim-0.0.18.dist-info/RECORD +28 -0
- pydantic_ai_slim-0.0.16.dist-info/RECORD +0 -26
- {pydantic_ai_slim-0.0.16.dist-info → pydantic_ai_slim-0.0.18.dist-info}/WHEEL +0 -0
pydantic_ai/_griffe.py
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
from __future__ import annotations as _annotations
|
|
2
2
|
|
|
3
|
+
import logging
|
|
3
4
|
import re
|
|
5
|
+
from contextlib import contextmanager
|
|
4
6
|
from inspect import Signature
|
|
5
7
|
from typing import Any, Callable, Literal, cast
|
|
6
8
|
|
|
@@ -25,7 +27,8 @@ def doc_descriptions(
|
|
|
25
27
|
parent = cast(GriffeObject, sig)
|
|
26
28
|
|
|
27
29
|
docstring = Docstring(doc, lineno=1, parser=style or _infer_docstring_style(doc), parent=parent)
|
|
28
|
-
|
|
30
|
+
with _disable_griffe_logging():
|
|
31
|
+
sections = docstring.parse()
|
|
29
32
|
|
|
30
33
|
params = {}
|
|
31
34
|
if parameters := next((p for p in sections if p.kind == DocstringSectionKind.parameters), None):
|
|
@@ -125,3 +128,12 @@ _docstring_style_patterns: list[tuple[str, list[str], DocstringStyle]] = [
|
|
|
125
128
|
'numpy',
|
|
126
129
|
),
|
|
127
130
|
]
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
@contextmanager
|
|
134
|
+
def _disable_griffe_logging():
|
|
135
|
+
# Hacky, but suggested here: https://github.com/mkdocstrings/griffe/issues/293#issuecomment-2167668117
|
|
136
|
+
old_level = logging.root.getEffectiveLevel()
|
|
137
|
+
logging.root.setLevel(logging.ERROR)
|
|
138
|
+
yield
|
|
139
|
+
logging.root.setLevel(old_level)
|
pydantic_ai/_system_prompt.py
CHANGED
|
@@ -12,6 +12,7 @@ from .tools import AgentDeps, RunContext, SystemPromptFunc
|
|
|
12
12
|
@dataclass
|
|
13
13
|
class SystemPromptRunner(Generic[AgentDeps]):
|
|
14
14
|
function: SystemPromptFunc[AgentDeps]
|
|
15
|
+
dynamic: bool = False
|
|
15
16
|
_takes_ctx: bool = field(init=False)
|
|
16
17
|
_is_async: bool = field(init=False)
|
|
17
18
|
|