fix(search): make ToolsetConfigError actionable and fix misleading docs

Merged
CA
6mo ago
+25-15

Summary

  • Rewrite the ToolsetConfigError "Search is disabled" message at all 4 raise sites to show the exact constructor arg needed (search={} or search={"method": "auto"})
  • Fix 3 README snippets that called StackOneToolSet() with no args before invoking pydantic_ai(mode="search_and_execute"), get_search_tool(), or search_tools() — these would all raise ToolsetConfigError at runtime
  • Fix openai(), pydantic_ai(), and get_search_tool() docstring examples that showed the same misleading pattern

No behavior change — default remains search=None (disabled).

Test plan

  • just lint passes
  • just ty passes
  • Run examples/search_tools.py against 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 ToolsetConfigError sites to suggest search={} or search={"method": "auto"} and reference README "Search Tool".
    • Corrected README and docstring examples: construct StackOneToolSet(search={"method": "auto"}) before using pydantic_ai(mode="search_and_execute"), get_search_tool(), or search_tools(); fixed Basic Usage snippet (added StackOneToolSet import, removed unused fetch_tools, and passed account_ids to the search call).