-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Toolsets #2024
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Toolsets #2024
Changes from all commits
Commits
Show all changes
162 commits
Select commit
Hold shift + click to select a range
e290951
WIP: Output modes
DouweM 2056539
WIP: More output modes
DouweM bceba19
Merge remote-tracking branch 'origin/main' into output-modes
DouweM 0cb25c4
Fix tests
DouweM 933b74e
Remove syntax invalid before Python 3.12
DouweM 7974df0
Fix tests
DouweM 9cc19e2
Add TextOutput marker
DouweM bc6bb65
Merge remote-tracking branch 'origin/main' into output-modes
DouweM 0e356a3
Add VCR recording of new test
DouweM 81312dc
Implement additional output modes in GeminiModel and GoogleModel
DouweM 52ef4d5
Fix prompted_json on OpenAIResponses
DouweM fe05956
Test output modes on Gemini and Anthropic
DouweM 94421f3
Add VCR recordings of Gemini output mode tests
DouweM 1902d00
Remove some old TODO comments
DouweM 1f53c9b
Add missing VCR recording of Gemini output mode test
DouweM a4c2877
Add more missing VCR recordings
DouweM 56e58f9
Fix OpenAI tools
DouweM a5234e1
Improve test coverage
DouweM 40def08
Update unsupported output mode error message
DouweM 837d305
Improve test coverage
DouweM 3598bef
Merge branch 'main' into output-modes
DouweM 5f71ba8
Test streaming with structured text output
DouweM cfc2749
Make TextOutputFunction Python 3.9 compatible
DouweM a137641
Properly merge JSON schemas accounting for defs
DouweM f495d46
Refactor output schemas and modes: more 'isinstance(output_schema, ..…
DouweM 449ed0d
Merge branch 'main' into output-modes
DouweM e70d249
Clean up some variable names
DouweM 4592b0b
Improve test coverage
DouweM db1c628
Merge branch 'main' into output-modes
DouweM f57d078
Combine JsonSchemaOutput and PromptedJsonOutput into StructuredTextOu…
DouweM 5112455
Add missing cassettes
DouweM 416cc7d
Can't use dataclass kw_only on 3.9
DouweM 4b0e5cf
Improve test coverage
DouweM 094920f
Improve test coverage
DouweM 9f61706
Improve test coverage
DouweM 9f51387
Remove unnecessary coverage ignores
DouweM 9a1e628
Remove unnecessary coverage ignore
DouweM 2b5fa81
Add docs
DouweM 6c4662b
Fix docs refs
DouweM 3ed3431
Fix nested list in docs
DouweM 3d77818
Merge branch 'main' into output-modes
DouweM a86d7d4
Split StructuredTextOutput into ModelStructuredOutput and PromptedStr…
DouweM ce985a0
Merge branch 'main' into output-modes
DouweM 71d1655
Fix WrapperModel.profile
DouweM 8c04144
Update output modes docs
DouweM d78b5f7
Add examples to output mode marker docstrings
DouweM 70d1197
Fix mypy type inference
DouweM 2eb7fd1
Improve test coverage
DouweM 25ccb54
Merge branch 'main' into output-modes
DouweM 9e00c32
Import cast and RunContext in _function_schema
DouweM 7de3c0d
Move RunContext and AgentDepsT into their own module to solve circula…
DouweM 4029fac
Make _run_context module private, RunContext can be accessed through …
DouweM 98bccf2
Merge branch 'main' into output-modes
DouweM 8041cf3
Fix thinking part related tests
DouweM 9bfed04
Implement Toolset
DouweM 0f8da74
Make MCPServer a Toolset
DouweM 8a29836
--no-edit
DouweM 3d2012c
Add MappedToolset
DouweM 901267d
Import Never from typing_extensions instead of typing
DouweM b9258d7
from __future__ import annotations
DouweM 27ccbd1
Update client.md
DouweM 3031e55
Pass only RunToolset to agent graph
DouweM ebd0b57
Make WrapperToolset abstract
DouweM 867bf68
Introduce ToolDefinition.kind == 'pending'
DouweM c1115ae
Rename pending tools to deferred tools
DouweM 6abd603
Merge branch 'main' into toolsets
DouweM a2f69df
Fix retries
DouweM 0e0bf35
Remove duplicate cassettes
DouweM 735df29
Merge branch 'main' into toolsets
DouweM 8745a7a
Pass just one toolset into the run
DouweM 05aa972
WIP
DouweM ad6e826
Fix streaming tool calls
DouweM 84cd954
Stop double counting retries and reset on success
DouweM 74a56ae
Fix retry error wrapping
DouweM 0360e77
Make DeferredToolCalls work with streaming
DouweM 6607b00
Merge branch 'main' into toolsets
DouweM 8a3febb
Let toolsets be overridden in run/iter/run_stream/run_sync
DouweM 2e200ac
Add DeferredToolset
DouweM 1cb7f32
Add LangChainToolset
DouweM a6eba43
Add Agent.prepare_output_tools
DouweM 0c96126
Require WrapperToolset subclasses to implement their own prepare_for_run
DouweM 2348f45
Require DeferredToolCalls to be used with other output type
DouweM 9dc684e
Merge branch 'main' into toolsets
DouweM f3124c0
Lots of cleanup
DouweM f660cc1
Some more tweaks
DouweM 64dacbb
Merge branch 'main' into toolsets
DouweM 5ca305e
Fix docs example
DouweM c5ef5f6
Address some feedback
DouweM badbe23
Merge branch 'main' into toolsets
DouweM acddb8d
Add sampling_model to Agent __init__, iter, run (etc), and override, …
DouweM 89fc266
Turn RunContext.retries from a defaultdict into a dict again as the 0…
DouweM 7e3331b
Remove unnecessary if TYPE_CHECKING
DouweM ebf6f40
Remove Agent sampling_model field (and method argument) in favor of A…
DouweM f7db040
Allow OutputSpec to be nested
DouweM fe07149
Document Agent.__aenter__
DouweM a0f4678
Import Self from typing_extensions instead of typing
DouweM db82d00
Actually use Agent.prepare_output_tools
DouweM dea8050
Update test to account for fact that text output with early end_strat…
DouweM 131a325
Improve test coverage
DouweM 8203732
Merge branch 'main' into toolsets
DouweM 778962c
Make Agent MCP-related tests only run when mcp can be imported
DouweM e6575a9
Add tests
DouweM 9f9ee55
AbstractToolset.call_tool now takes a ToolCallPart
DouweM a3c9a59
Fix MCP process_tool_call example
DouweM 6eae653
Fix test coverage
DouweM 2b3a9e5
Merge branch 'main' into toolsets
DouweM b2aa894
Improve coverage
DouweM ecf6f75
Merge branch 'main' into toolsets
DouweM 1c2d221
Address feedback
DouweM ca4915b
Make test_docs_examples an async test so Python 3.9 lets us instantia…
DouweM 972e4a7
Merge branch 'main' into toolsets
DouweM 93bb682
Fix test snapshots
DouweM 8a986be
Revert "Make test_docs_examples an async test so Python 3.9 lets us i…
DouweM 9c399c7
Make asyncio.Lock work in Python 3.9 when there is no event loop yet
DouweM a4f8c48
Address feedback, fix docs test
DouweM 3e1847f
Give the A2A task some more time to complete
DouweM 4daa152
Branch is OK to not be covered
DouweM c5c6f00
agent.iter(toolsets=...) is now additional, while new agent.override(…
DouweM f9ba559
Respect overridden toolsets in Agent.__aenter__ and Agent.set_mcp_sam…
DouweM b165503
Fix tool conflict error message
DouweM 4baa710
Rename FunctionToolset.register_{tool,function} to add_{tool,function}
DouweM 39e0353
Branch is OK to not be covered
DouweM 18fcdf7
Add test to ensure tools can be added during a run
DouweM af6ce7d
Make CallableToolset public as we're going to want to let people defi…
DouweM 93e6691
Make it easier to override tool call behavior by subclassing WrapperT…
DouweM 3a4c4c8
Start writing docs
DouweM 87aaa6c
Make WrapperToolset easier to subclass with new _rewrap_for_run method
DouweM 8b81e65
Add classes I forget to add and push
DouweM e72548e
Make all public toolsets importable from pydantic_ai.toolsets
DouweM b8c93f1
Add ACIToolset
DouweM f87319c
Document LangChainToolset and ACIToolset
DouweM 8136441
Merge branch 'main' into toolsets
DouweM 239fc3d
Toolset._call_tool is always async
DouweM febbd08
A WrapperToolset subclass with no additional fields does not need to …
DouweM cfa9ccc
Add some more docs
DouweM 50a72a0
Merge branch 'main' into toolsets
DouweM 0151e20
Mostly finish docs
DouweM d27b4ec
Fix FunctionToolset.max_retries
DouweM 692898e
Fix docs example output
DouweM 06838e2
Make AbstractToolset overridable methods public
DouweM 215eaae
Merge branch 'main' into toolsets
DouweM 8018600
Merge remote-tracking branch 'origin/toolsets' into toolsets
DouweM b2637f8
WIP
DouweM a25df7f
WIP
DouweM 13d9c03
Remove AbstractToolset.for_run_step
DouweM ac5f77d
Rename AbstractToolset.accept to apply
DouweM 0c8b25a
Fix toolsets docs
DouweM 6046a1c
Fix example for 3.9
DouweM 70d24da
Update docs
DouweM a4dedb3
Improve coverage
DouweM f48bd73
Improve docstrings
DouweM a4e0c04
Improve docstrings
DouweM fef897d
Fix docs link
DouweM 9d3d240
Fix docs links
DouweM f3d1ae0
Add filtered, prefixed, prepared, renamed and wrap convenience method…
DouweM f756132
Merge branch 'main' into toolsets
DouweM 57b0720
Move tool call tracing to ToolManager
DouweM e2e0f58
Merge branch 'main' into toolsets
DouweM 7830c73
Fix huggingface_hub.AsyncInferenceClient link in docs
DouweM c9c8873
Add huggingface doc to nav
DouweM 7e4629e
Fix coverage
DouweM 28c753d
Fix coverage
DouweM File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # `pydantic_ai.ext` | ||
|
|
||
| ::: pydantic_ai.ext.langchain | ||
|
|
||
| ::: pydantic_ai.ext.aci |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,3 +10,4 @@ | |
| - PromptedOutput | ||
| - TextOutput | ||
| - StructuredDict | ||
| - DeferredToolCalls | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| # `pydantic_ai.toolsets` | ||
|
|
||
| ::: pydantic_ai.toolsets | ||
| options: | ||
| members: | ||
| - AbstractToolset | ||
| - CombinedToolset | ||
| - DeferredToolset | ||
| - FilteredToolset | ||
| - FunctionToolset | ||
| - PrefixedToolset | ||
| - RenamedToolset | ||
| - PreparedToolset | ||
| - WrapperToolset |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.