BrainAPI
BrainAPI
Build

For the complete BrainAPI documentation index, see llms.txt. A markdown version of any docs page is available by appending .md to its URL. Docs MCP: /docs/mcp.

Ingestion overview

Choose the smallest ingestion path that preserves the knowledge your application needs

Ingestion turns source material into representations that later retrieval surfaces can use. Choose the path from the structure you already have, not from the retrieval feature you hope to use.

Choose an input path

InputEndpointChoose it when
Plain text or pre-extracted MarkdownPOST /ingest/Language contains the facts and relationships to discover.
PDF, document, or other uploaded filePOST /ingest/fileBrainAPI or a configured parser must extract text first.
Known triples or eventsPOST /ingest/structuredYour application already knows subjects, predicates, objects, IDs, or timestamps.
Search-only passagesPOST /ingest/ with skip_enrichment=trueYou need ranked passage retrieval without graph enrichment.

Choose a structured mode

ModeBehaviorTypical use
deterministicWrites supported structure without LLM enrichment.Imports, catalog attributes, preferences, controlled events.
hybridPreserves supplied structure and fills supported missing information.Partially structured application events.
enrichUses the enrichment path for the supplied data.Inputs where additional semantic detail is worth model cost.

If mode is omitted, BrainAPI infers a safe path from the payload. skip_enrichment=true prevents enrichment and is useful when supplied facts must remain literal.

Direct edges or event hubs

Use a direct subject → predicate → object triple for static facts such as HAS, membership, or PREFERS. Add event and event_obj together when an action needs a first-class event with time or context. Sending only one member of the pair is invalid.

Understand task completion

Text and structured endpoints return 202 and a task_id. Poll the same brain through /tasks/{task_id}. Do not query immediately and assume missing data means ingestion failed.

Prepare for retrieval

  • Context can use graph and passage representations.
  • Search requires PostgreSQL and SEARCH_ENABLED=true; lexical indexes are populated during compatible ingestion.
  • Catalog personalization requires passages mapped to stable graph node_id values.
  • Recommendations require a target node and useful relationships or interactions.

Continue

Edit on GitHub

Last updated on

On this page