Adapters Module
The Adapters module provides concrete implementations of knowledge base components including readers, vector stores, retrievers, and rerankers.Import
Quick Example
Registering the built-in adapters
register_default_adapters() wires the wrapperβs default readers, retrievers, and rerankers into the core-SDK registries. The wrapper entry points call it for you; library-mode Python callers call it themselves.
As of PraisonAI 4.7.9, the wrapperβs entry points (
praisonai.run, praisonai.arun, and the praisonai CLI) call register_default_adapters() for you before the agent starts. A YAML/CLI user who declares retriever: fusion or reranker: llm in their agent config gets it wired up automatically.Call register_default_adapters() explicitly only when you are importing praisonai.adapters.retrievers / rerankers from your own Python code (not via the wrapper entry points) and want the registry populated.- Idempotent and thread-safe β subsequent calls are no-ops.
register_default_*helpers use register-only-if-absent semantics. A multi-tenant host that has already registered a custom retriever/reranker/reader under a built-in name (e.g. its ownfusion) keeps that custom entry β the wrapper defaults never silently overwrite it.- Composite readers (
DirectoryReader.load,GlobReader.load,AutoReader.load) auto-wire the built-in readers on first.load()call, so a reader-only workflow works without the explicit call. Retrievers and rerankers have no equivalent safety net β callregister_default_adapters()if you look them up by name from the registry from your own Python code. register_default_vector_stores()is intentionally not wrapped in β it probes chromadb / pinecone on disk and stays opt-in.
Native async in custom retrievers / rerankers
BasicRetriever.aretrieve() and its siblings β plus every rerankerβs arerank() β offload the blocking body via asyncio.to_thread(...), so calling them from inside an event loop no longer freezes it.
If you build a custom retriever or reranker on top of a natively-async provider (e.g. cohere.AsyncClient, an httpx AsyncClient), override the async def and await the native call directly β a to_thread hop over an already-async provider adds latency for no gain.
Features
- Readers: Load documents from files, directories, URLs, and glob patterns
- Vector Stores: Store and query document embeddings (ChromaDB, Pinecone)
- Retrievers: Find relevant documents (Basic, Fusion, Recursive, AutoMerge)
- Rerankers: Improve result relevance (LLM, CrossEncoder, Cohere)
Module Structure
Available Components
Readers
Vector Stores
Retrievers
Rerankers
Lazy Loading
All adapters use lazy loading to minimize import time:Example: Full RAG Pipeline
CLI Integration
The adapters power thepraisonai knowledge CLI commands:
Related
- Readers Module - Document loading
- Vector Store Module - Vector storage
- Retrieval Module - Document retrieval
- Reranker Module - Result reranking

