pydantic-ai-slim 0.0.28__tar.gz → 0.0.29__tar.gz
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_slim-0.0.28 → pydantic_ai_slim-0.0.29}/PKG-INFO +2 -2
- {pydantic_ai_slim-0.0.28 → pydantic_ai_slim-0.0.29}/pydantic_ai/agent.py +2 -2
- {pydantic_ai_slim-0.0.28 → pydantic_ai_slim-0.0.29}/pydantic_ai/common_tools/duckduckgo.py +14 -4
- {pydantic_ai_slim-0.0.28 → pydantic_ai_slim-0.0.29}/pyproject.toml +2 -2
- {pydantic_ai_slim-0.0.28 → pydantic_ai_slim-0.0.29}/.gitignore +0 -0
- {pydantic_ai_slim-0.0.28 → pydantic_ai_slim-0.0.29}/README.md +0 -0
- {pydantic_ai_slim-0.0.28 → pydantic_ai_slim-0.0.29}/pydantic_ai/__init__.py +0 -0
- {pydantic_ai_slim-0.0.28 → pydantic_ai_slim-0.0.29}/pydantic_ai/_agent_graph.py +0 -0
- {pydantic_ai_slim-0.0.28 → pydantic_ai_slim-0.0.29}/pydantic_ai/_griffe.py +0 -0
- {pydantic_ai_slim-0.0.28 → pydantic_ai_slim-0.0.29}/pydantic_ai/_parts_manager.py +0 -0
- {pydantic_ai_slim-0.0.28 → pydantic_ai_slim-0.0.29}/pydantic_ai/_pydantic.py +0 -0
- {pydantic_ai_slim-0.0.28 → pydantic_ai_slim-0.0.29}/pydantic_ai/_result.py +0 -0
- {pydantic_ai_slim-0.0.28 → pydantic_ai_slim-0.0.29}/pydantic_ai/_system_prompt.py +0 -0
- {pydantic_ai_slim-0.0.28 → pydantic_ai_slim-0.0.29}/pydantic_ai/_utils.py +0 -0
- {pydantic_ai_slim-0.0.28 → pydantic_ai_slim-0.0.29}/pydantic_ai/common_tools/__init__.py +0 -0
- {pydantic_ai_slim-0.0.28 → pydantic_ai_slim-0.0.29}/pydantic_ai/common_tools/tavily.py +0 -0
- {pydantic_ai_slim-0.0.28 → pydantic_ai_slim-0.0.29}/pydantic_ai/exceptions.py +0 -0
- {pydantic_ai_slim-0.0.28 → pydantic_ai_slim-0.0.29}/pydantic_ai/format_as_xml.py +0 -0
- {pydantic_ai_slim-0.0.28 → pydantic_ai_slim-0.0.29}/pydantic_ai/messages.py +0 -0
- {pydantic_ai_slim-0.0.28 → pydantic_ai_slim-0.0.29}/pydantic_ai/models/__init__.py +0 -0
- {pydantic_ai_slim-0.0.28 → pydantic_ai_slim-0.0.29}/pydantic_ai/models/anthropic.py +0 -0
- {pydantic_ai_slim-0.0.28 → pydantic_ai_slim-0.0.29}/pydantic_ai/models/cohere.py +0 -0
- {pydantic_ai_slim-0.0.28 → pydantic_ai_slim-0.0.29}/pydantic_ai/models/fallback.py +0 -0
- {pydantic_ai_slim-0.0.28 → pydantic_ai_slim-0.0.29}/pydantic_ai/models/function.py +0 -0
- {pydantic_ai_slim-0.0.28 → pydantic_ai_slim-0.0.29}/pydantic_ai/models/gemini.py +0 -0
- {pydantic_ai_slim-0.0.28 → pydantic_ai_slim-0.0.29}/pydantic_ai/models/groq.py +0 -0
- {pydantic_ai_slim-0.0.28 → pydantic_ai_slim-0.0.29}/pydantic_ai/models/instrumented.py +0 -0
- {pydantic_ai_slim-0.0.28 → pydantic_ai_slim-0.0.29}/pydantic_ai/models/mistral.py +0 -0
- {pydantic_ai_slim-0.0.28 → pydantic_ai_slim-0.0.29}/pydantic_ai/models/openai.py +0 -0
- {pydantic_ai_slim-0.0.28 → pydantic_ai_slim-0.0.29}/pydantic_ai/models/test.py +0 -0
- {pydantic_ai_slim-0.0.28 → pydantic_ai_slim-0.0.29}/pydantic_ai/models/vertexai.py +0 -0
- {pydantic_ai_slim-0.0.28 → pydantic_ai_slim-0.0.29}/pydantic_ai/models/wrapper.py +0 -0
- {pydantic_ai_slim-0.0.28 → pydantic_ai_slim-0.0.29}/pydantic_ai/py.typed +0 -0
- {pydantic_ai_slim-0.0.28 → pydantic_ai_slim-0.0.29}/pydantic_ai/result.py +0 -0
- {pydantic_ai_slim-0.0.28 → pydantic_ai_slim-0.0.29}/pydantic_ai/settings.py +0 -0
- {pydantic_ai_slim-0.0.28 → pydantic_ai_slim-0.0.29}/pydantic_ai/tools.py +0 -0
- {pydantic_ai_slim-0.0.28 → pydantic_ai_slim-0.0.29}/pydantic_ai/usage.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pydantic-ai-slim
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.29
|
|
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
|
|
@@ -29,7 +29,7 @@ Requires-Dist: exceptiongroup; python_version < '3.11'
|
|
|
29
29
|
Requires-Dist: griffe>=1.3.2
|
|
30
30
|
Requires-Dist: httpx>=0.27
|
|
31
31
|
Requires-Dist: logfire-api>=1.2.0
|
|
32
|
-
Requires-Dist: pydantic-graph==0.0.
|
|
32
|
+
Requires-Dist: pydantic-graph==0.0.29
|
|
33
33
|
Requires-Dist: pydantic>=2.10
|
|
34
34
|
Provides-Extra: anthropic
|
|
35
35
|
Requires-Dist: anthropic>=0.40.0; extra == 'anthropic'
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
from __future__ import annotations as _annotations
|
|
2
2
|
|
|
3
|
-
import asyncio
|
|
4
3
|
import dataclasses
|
|
5
4
|
import inspect
|
|
6
5
|
from collections.abc import AsyncIterator, Awaitable, Iterator, Sequence
|
|
@@ -13,6 +12,7 @@ import logfire_api
|
|
|
13
12
|
from typing_extensions import TypeVar, deprecated
|
|
14
13
|
|
|
15
14
|
from pydantic_graph import BaseNode, End, Graph, GraphRun, GraphRunContext
|
|
15
|
+
from pydantic_graph._utils import get_event_loop
|
|
16
16
|
|
|
17
17
|
from . import (
|
|
18
18
|
_agent_graph,
|
|
@@ -538,7 +538,7 @@ class Agent(Generic[AgentDepsT, ResultDataT]):
|
|
|
538
538
|
"""
|
|
539
539
|
if infer_name and self.name is None:
|
|
540
540
|
self._infer_name(inspect.currentframe())
|
|
541
|
-
return
|
|
541
|
+
return get_event_loop().run_until_complete(
|
|
542
542
|
self.run(
|
|
543
543
|
user_prompt,
|
|
544
544
|
result_type=result_type,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import functools
|
|
1
2
|
from dataclasses import dataclass
|
|
2
3
|
from typing import TypedDict
|
|
3
4
|
|
|
@@ -39,6 +40,9 @@ class DuckDuckGoSearchTool:
|
|
|
39
40
|
client: DDGS
|
|
40
41
|
"""The DuckDuckGo search client."""
|
|
41
42
|
|
|
43
|
+
max_results: int | None = None
|
|
44
|
+
"""The maximum number of results. If None, returns results only from the first response."""
|
|
45
|
+
|
|
42
46
|
async def __call__(self, query: str) -> list[DuckDuckGoResult]:
|
|
43
47
|
"""Searches DuckDuckGo for the given query and returns the results.
|
|
44
48
|
|
|
@@ -48,16 +52,22 @@ class DuckDuckGoSearchTool:
|
|
|
48
52
|
Returns:
|
|
49
53
|
The search results.
|
|
50
54
|
"""
|
|
51
|
-
|
|
55
|
+
search = functools.partial(self.client.text, max_results=self.max_results)
|
|
56
|
+
results = await anyio.to_thread.run_sync(search, query)
|
|
52
57
|
if len(results) == 0:
|
|
53
58
|
raise RuntimeError('No search results found.')
|
|
54
59
|
return duckduckgo_ta.validate_python(results)
|
|
55
60
|
|
|
56
61
|
|
|
57
|
-
def duckduckgo_search_tool(duckduckgo_client: DDGS | None = None):
|
|
58
|
-
"""Creates a DuckDuckGo search tool.
|
|
62
|
+
def duckduckgo_search_tool(duckduckgo_client: DDGS | None = None, max_results: int | None = None):
|
|
63
|
+
"""Creates a DuckDuckGo search tool.
|
|
64
|
+
|
|
65
|
+
Args:
|
|
66
|
+
duckduckgo_client: The DuckDuckGo search client.
|
|
67
|
+
max_results: The maximum number of results. If None, returns results only from the first response.
|
|
68
|
+
"""
|
|
59
69
|
return Tool(
|
|
60
|
-
DuckDuckGoSearchTool(client=duckduckgo_client or DDGS()).__call__,
|
|
70
|
+
DuckDuckGoSearchTool(client=duckduckgo_client or DDGS(), max_results=max_results).__call__,
|
|
61
71
|
name='duckduckgo_search',
|
|
62
72
|
description='Searches DuckDuckGo for the given query and returns the results.',
|
|
63
73
|
)
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "pydantic-ai-slim"
|
|
7
|
-
version = "0.0.
|
|
7
|
+
version = "0.0.29"
|
|
8
8
|
description = "Agent Framework / shim to use Pydantic with LLMs, slim package"
|
|
9
9
|
authors = [{ name = "Samuel Colvin", email = "samuel@pydantic.dev" }]
|
|
10
10
|
license = "MIT"
|
|
@@ -37,7 +37,7 @@ dependencies = [
|
|
|
37
37
|
"httpx>=0.27",
|
|
38
38
|
"logfire-api>=1.2.0",
|
|
39
39
|
"pydantic>=2.10",
|
|
40
|
-
"pydantic-graph==0.0.
|
|
40
|
+
"pydantic-graph==0.0.29",
|
|
41
41
|
"exceptiongroup; python_version < '3.11'",
|
|
42
42
|
]
|
|
43
43
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|