Skip to content

API Reference parrot_tools.multistoresearch.toolkit

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot_tools.multistoresearch.toolkit

View source

MultiStoreSearchToolkit — multi-origin retrieval toolkit (FEAT-379).

Orchestrates an ordered registry of :class:~parrot_tools.multistoresearch. origins.base.SearchOrigin adapters (vector stores, PageIndex, GraphIndex, ParrotWiki) behind four agent-facing tools: store_search, batch_search, fts_search, list_search_origins.

Every response carries BOTH grouped-by-origin sections (native ranking + an LLM-readable origin description — sections intentionally keep cross-origin duplicates) AND a merged, deduped, BM25-reranked top-k block. Origin-native scores are NOT cross-origin comparable (vector distances, wiki FTS ranks, and graph scores live on different scales) — the merged block ranks purely by BM25-over-content, never by raw score.

Per-origin failures and timeouts degrade to an OriginSection status note; they never fail the whole call. Default per-origin timeout is 30s, overridable per adapter via SearchOrigin.timeout.

Class MultiStoreSearchToolkit

Agent-facing toolkit fanning a query out across multiple origins.

Parameter Type Default Description
origins List[SearchOrigin] Ordered list of configured :class:SearchOrigin adapters (e.g. VectorStoreOrigin, PageIndexOrigin, GraphIndexOrigin, ParrotWikiOrigin). An empty list is valid — tools return a structured "no origins configured" response instead of raising.
k int 10 Default cap on the merged top-k block returned by store_search/batch_search/fts_search.
k_per_origin int 20 Number of hits requested from EACH origin before merging (typically larger than k to give the BM25 rerank enough candidates).
default_timeout float 30.0 Default per-origin timeout in seconds, used whenever an origin does not set its own timeout.
bm25_weights Optional[Dict[str, float]] None Optional per-origin multiplier applied to that origin's BM25 score when building the merged ranking (e.g. {"wiki": 0.8} to slightly de-prioritise wiki hits).
**kwargs Any {} Forwarded to :class:AbstractToolkit.

Attributes:

Attribute Type Description
exclude_tools Tuple[str, ...]

Method MultiStoreSearchToolkit.store_search

Search all enabled origins and return grouped + merged results.

Runs every configured origin concurrently (each origin's own native ranking is preserved in its own section — this is deliberate, even when the same document appears in multiple origins), then produces a single deduped, BM25-reranked top-k list across all origins combined.

store_search(query: str, k: Optional[int] = None) -> MultiSearchResponse

Parameter Type Default Description
query str Natural-language search query.
k Optional[int] None Maximum number of hits in the merged top-k block. Defaults to the toolkit's configured k.

Returns: MultiSearchResponse — A grouped-by-origin + merged-top-k response. Per-origin failures or timeouts degrade to a section status note rather than raising.

Method MultiStoreSearchToolkit.batch_search

Search all enabled origins for N queries in one batched pass.

All len(queries) * len(origins) origin calls are dispatched through a single asyncio.gather (no per-query sequential loop, no thread offloading) — this is the efficient way to fan out many queries against the same origin registry.

batch_search(queries: List[str], k: Optional[int] = None) -> List[MultiSearchResponse]

Parameter Type Default Description
queries List[str] List of natural-language search queries. An empty list returns an empty list.
k Optional[int] None Maximum number of hits in each query's merged top-k block. Defaults to the toolkit's configured k.

Returns: List[MultiSearchResponse] — class:~parrot.models.MultiSearchResponse per input query, in the same shape as store_search, in the same order as queries.

Method MultiStoreSearchToolkit.fts_search

Run full-text search on FTS-capable origins only.

Origins without full-text support (supports_fts=False) are reported as skipped sections with a reason, rather than being silently omitted — the LLM can see which origins were consulted.

fts_search(query: str, k: Optional[int] = None) -> MultiSearchResponse

Parameter Type Default Description
query str Full-text search query.
k Optional[int] None Maximum number of hits in the merged top-k block. Defaults to the toolkit's configured k.

Returns: MultiSearchResponse — A grouped-by-origin + merged-top-k response. When no configured origin supports FTS, all sections are "skipped" and the merged block is empty.

Method MultiStoreSearchToolkit.list_search_origins

List the statically configured search origins.

list_search_origins() -> List[Dict[str, Any]]

Returns: List[Dict[str, Any]] — One dict per configured origin with name, kind, description, supports_fts, timeout, and any adapter-specific extra settings (e.g. PageIndex's mode). This is a static configuration view only — no live health/staleness probing is performed.

Method MultiStoreSearchToolkit.search

Satisfy the core MultiSearch protocol; delegates to store_search.

Not exposed as an agent tool (see exclude_tools) — this is the seam StoreRouter's FAN_OUT fallback and AbstractBot.configure_store_router call against.

search(query: str, k: Optional[int] = None, **kwargs: Any) -> Any

Parameter Type Default Description
query str
k Optional[int] None
**kwargs Any {}

Returns: Any

Alias SearchOrigin

Re-exported from parrot_tools.multistoresearch.origins.base.SearchOrigin.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally