ó
    ±"³j†  ã                  ó8  • S r SSKJr  SSKJrJrJr  SSKJr  SSK	J
r
JrJr  SSKJrJr  SSKJrJrJr  S	S
KJr  \
(       a  SSKJr  / SQr\S   r \S   r \\\   \\   \S   /\\   \\\      -  4   r \\\   \\4   r Sr \" SS9 " S S\5      5       rg)aÛ  Internals for the tool-search native tool.

Tool search lets the model discover tools marked with `defer_loading=True` rather
than carrying every deferred tool's full schema in the prompt. The
[`ToolSearch`][pydantic_ai.capabilities.ToolSearch] capability picks between three
modes per provider:

* **Native server-side**: the provider's own tool-search tool (Anthropic
  `bm25`/`regex`, OpenAI server-executed `tool_search`).
* **Native client-executed (custom callable)**: the provider invokes our local
  callable through its native client-execution mode (Anthropic regular function tool
  + `tool_reference` result blocks, OpenAI `ToolSearchToolParam(execution='client')`).
* **Local fallback**: a regular `search_tools` function tool the model can call.
  Used on providers that don't expose any native tool-search surface.

The end-user surface is the [`ToolSearch`][pydantic_ai.capabilities.ToolSearch]
capability; the types in this module are kept here as implementation detail.
é    )Úannotations)Ú	AwaitableÚCallableÚSequence)Ú	dataclass)ÚTYPE_CHECKINGÚLiteralÚUnioné   )Ú
AgentDepsTÚ
RunContext)ÚToolSearchArgsÚToolSearchMatchÚToolSearchReturnContenté   )ÚAbstractNativeTool)ÚToolDefinition)r   r   r   ÚToolSearchNativeStrategyÚToolSearchLocalStrategyÚToolSearchFuncÚToolSearchStrategyÚTOOL_SEARCH_FUNCTION_TOOL_NAME)Úbm25ÚregexÚkeywordsr   Úsearch_toolsT)Úkw_onlyc                  ó8   • \ rS rSr% SrSrS\S'    SrS\S'   S	rg)
ÚToolSearchTooléf   uñ  Framework-internal: users access tool search via the [`ToolSearch`][pydantic_ai.capabilities.ToolSearch] capability â€” do not construct directly.

A native tool that enables provider-side tool search.

Tools marked as part of the search corpus (via `with_native='tool_search'`
on their [`ToolDefinition`][pydantic_ai.tools.ToolDefinition]) are sent to supporting
providers with `defer_loading` on the wire; the provider manages their visibility
and only exposes them once they've been discovered.

The mode of discovery depends on `strategy`:

* A named native strategy (or `None` for the provider default): the provider runs
  the search server-side using its own indexing (Anthropic `bm25`/`regex`, OpenAI
  server-executed `tool_search`).
* `'custom'`: the provider invokes our local search function to answer each search
  request. On Anthropic this goes via a regular function tool whose return value the
  adapter re-formats as `tool_reference` blocks; on OpenAI it goes via
  `ToolSearchToolParam(execution='client')` with our callable's parameter schema.

When the model doesn't support native tool search at all, the
[`ToolSearch`][pydantic_ai.capabilities.ToolSearch] capability's local
implementation handles discovery via its own `search_tools` function tool.

Supported by:

* Anthropic (bm25, regex, custom callable) â€” Sonnet 4.5+, Opus 4.5+, Haiku 4.5+
* OpenAI Responses (server default, custom callable via `execution='client'`) â€” GPT-5.4+
  (named strategies `'bm25'`/`'regex'` are not supported).
Nz)Literal['bm25', 'regex', 'custom'] | NoneÚstrategyÚtool_searchÚstrÚkind© )	Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r!   Ú__annotations__r$   Ú__static_attributes__r%   ó    Úb/home/mande/repo/quber/.venv/lib/python3.13/site-packages/pydantic_ai/native_tools/_tool_search.pyr   r   f   s(   ‡ ñð< ;?€HÐ7Ó>ðð( €Dˆ#ÓÚr-   r   N) r*   Ú
__future__r   Úcollections.abcr   r   r   Údataclassesr   Útypingr   r	   r
   Ú_run_contextr   r   Úmessagesr   r   r   Ú r   Útoolsr   Ú__all__r   r   r#   r   r   r   r   r%   r-   r.   Ú<module>r8      sí   ðñõ& #ç 9Ñ 9Ý !ß 0Ñ 0ç 1ß OÑ OÝ  æÝ&ò	€ð # ?Ñ3Ð ðð " *Ñ-Ð ðð Ø�
Ñ˜X c™]¨HÐ5EÑ,FÐGØˆS�M�I˜h s™mÑ,Ñ,ð.ñ€ðð ˜>¨*Ñ5Ð7NÐPhÐhÑiÐ ðð "0Ð ð)ñ �4Ñô5Ð'ó 5ó ñ5r-   