Skip to content

API Reference parrot.stores.parents.abstract

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

parrot.stores.parents.abstract

View source

Abstract base class for parent document searchers.

This module defines the composable ParentSearcher strategy interface that decouples where parent payloads live from how the bot retrieves them.

The interface follows the async-first pattern of the project:

  • One required async method: fetch.
  • Optional health_check that defaults to True.

Implementations MUST NOT raise on individual misses (missing parent IDs are normal data gaps). Raising is reserved for infrastructure failures such as connection loss or query errors.

Class AbstractParentSearcher

Composable strategy for fetching parent documents by ID.

Implementations MUST:

  • Return a dict keyed by parent_document_id.
  • Silently omit IDs that cannot be found (data gaps are normal).
  • Raise only on infrastructure failures (connection lost, etc.).

The bot calls :meth:fetch with the deduplicated set of parent_document_id values extracted from retrieval results, and uses the returned mapping to substitute parents for children in the LLM context.

Method AbstractParentSearcher.fetch

Fetch parent documents by their IDs.

fetch(parent_ids: List[str]) -> Dict[str, Document]

Parameter Type Default Description
parent_ids List[str] List of parent document IDs to retrieve. An empty list is a valid input and MUST return an empty dict without hitting any backend.

Returns: Dict[str, Document] — Mapping of {parent_document_id: Document}. IDs that were not found are simply absent from the returned dict. The caller (the bot) is responsible for falling back to the child document when a parent is missing.

Raises:

  • Exception — Only for infrastructure failures (network/DB errors). Individual misses MUST NOT raise.

Method AbstractParentSearcher.health_check

Optional readiness probe.

Override in concrete implementations to verify the backend is reachable before serving requests.

health_check() -> bool

Returns: bool — True if the backend is reachable, False otherwise.

Alias Document

Re-exported from parrot.stores.models.Document.

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