fix(search): make ToolsetConfigError actionable and fix misleading docs
Merged
CA
6mo ago+25+25+01234567890123456789-15-15-01234567890123456789
Summary
- Rewrite the
ToolsetConfigError"Search is disabled" message at all 4 raise sites to show the exact constructor arg needed (search={}orsearch={"method": "auto"}) - Fix 3 README snippets that called
StackOneToolSet()with no args before invokingpydantic_ai(mode="search_and_execute"),get_search_tool(), orsearch_tools()— these would all raiseToolsetConfigErrorat runtime - Fix
openai(),pydantic_ai(), andget_search_tool()docstring examples that showed the same misleading pattern
No behavior change — default remains search=None (disabled).
Test plan
-
just lintpasses -
just typasses - Run
examples/search_tools.pyagainst a sandbox account to confirm the working path is unaffected - Manually trigger the error to verify the new message renders cleanly
🤖 Generated with Claude Code
Summary by cubic
Makes the "Search is disabled" error actionable and points to the correct README section. Fixes examples so search-enabled usage works out of the box. No behavior change; search remains opt-in.
- Bug Fixes
- Updated all four
ToolsetConfigErrorsites to suggestsearch={}orsearch={"method": "auto"}and reference README "Search Tool". - Corrected README and docstring examples: construct
StackOneToolSet(search={"method": "auto"})before usingpydantic_ai(mode="search_and_execute"),get_search_tool(), orsearch_tools(); fixed Basic Usage snippet (addedStackOneToolSetimport, removed unusedfetch_tools, and passedaccount_idsto the search call).
- Updated all four