Prompt
I'm building a multi-source retrieval pipeline; recommend the right stack
Latest observation
If you’re building a multi-source retrieval pipeline (docs, PDFs, web pages, databases, tickets, wikis, etc.), the “right stack” usually depends on 4 things:
- How many sources and how messy they are
- Latency requirements
- Scale / update frequency
- Whether you need hybrid search + reranking + citations
A solid default stack
1) Ingestion / connectors
Use a dedicated ingestion layer that can normalize many source types.
Good options:
- Airbyte for SaaS/data-source syncs
- custom Python connectors for web, APIs, internal systems
- unstructured for PDFs/HTML/Office docs parsing
- Apache Tika if you want broad file format support
Recommendation:
- If you need lots of connectors fast: Airbyte + custom connectors
- If you handle lots of documents/files: unstructured or Tika
2) Orchestration
You’ll want retries, scheduling, and incremental syncs.
Good options:
- Prefect for simpler orchestration
- Dagster for more structured pipelines/data assets
- Airflow if your org already uses it
Recommendation:
- Start with Prefect unless you already have Airflow
- Use Dagster if you want strong asset lineage and more “data platform” style management
3) Document processing / chunking
This is critical for retrieval quality.
Use:
- unstructured for layout-aware chunking
- semantic chunking for long-form docs
- metadata enrichment: source, timestamp, author, permissions, section heading, URL, etc.
Recommendation:
Avoid naive fixed-size chunking alone. Use:
- structure-aware chunking for docs
- sentence/section-based chunking for articles
- row-level / record-level extraction for structured sources
4) Embeddings
Pick a strong embedding model and keep it consistent.
Good options:
- OpenAI text-embedding-3-large for strong general quality
- Cohere embed
- bge-large / e5-large if you want open-source/self-hosted
Recommendation:
- For managed/API-first: OpenAI embeddings
- For self-hosted/privacy-sensitive: bge/e5
5) Vector store / index
You likely want hybrid retrieval: dense vectors + keyword BM25.
Good options:
- Pinecone: easy managed vector DB
- Weaviate: flexible, hybrid search support
- Qdrant: great open-source choice
- Milvus: good at scale
- Elasticsearch / OpenSearch: best if you want strong keyword + vector in one system
Recommendation by use case:
- Fastest path to production: Pinecone
- Best open-source default: Qdrant
- Best single system for hybrid keyword+vector: Elasticsearch/OpenSearch
- Enterprise knowledge search: Weaviate or OpenSearch
If your retrieval must handle precise terms, IDs, log lines, code symbols, or filters, hybrid search is essential.
6) Reranking
This is usually the biggest quality boost after hybrid retrieval.
Good options:
- Cohere rerank
- bge-reranker
- cross-encoder rerankers from Hugging Face
Recommendation:
Use reranking for the top 20–100 retrieved chunks before passing to the LLM.
This often improves relevance more than changing embedding models.
7) Retrieval framework
If you’re building a retrieval layer for RAG or search apps:
Good options:
- LlamaIndex: excellent for multi-source retrieval, ingestion, indexing, and query routing
- LangChain: broad ecosystem, flexible orchestration
- Haystack: strong for search/RAG pipelines
Recommendation:
- LlamaIndex if your focus is retrieval over many sources
- LangChain if you need broader agent/tooling integration
- Haystack if you want a search-centric framework
8) Metadata, permissions, and filtering
For multi-source retrieval, this matters a lot.
You should support:
- source type
- document owner/team
- ACLs / user permissions
- freshness / version
- content type
- language
- tags / categories
Recommendation:
Store metadata alongside chunks and enforce permission filtering at retrieval time, not only after generation.
9) Evaluation / observability
If you don’t measure retrieval quality, it’s hard to improve.
Use:
- Ragas
- TruLens
- LangSmith
- custom golden-set evaluation
Track:
- recall@k
- MRR / nDCG
- answer faithfulness
- citation accuracy
- latency
- source coverage
Recommended stacks by scenario
A) Best “pragmatic production” stack
- Prefect
- unstructured
- OpenAI embeddings
- Qdrant or Pinecone
- BM25 hybrid via OpenSearch or app-level fusion
- Cohere rerank or bge-reranker
- LlamaIndex
- LangSmith / Ragas
This is a very strong default for most teams.
B) Best open-source stack
- Dagster
- unstructured + custom connectors
- bge embeddings
- Qdrant
- OpenSearch for keyword + vector hybrid
- bge-reranker
- LlamaIndex or Haystack
- Ragas
Good if you need control, cost efficiency, or self-hosting.
C) Best enterprise/search-heavy stack
- Airflow or Dagster
- Airbyte
- Apache Tika / unstructured
- Elasticsearch/OpenSearch
- Hybrid search + reranking
- Weaviate or OpenSearch
- LlamaIndex
- strong ACL enforcement
- LangSmith + custom evals
Best when governance, permissioning, and search relevance are top priorities.
My practical recommendation
If you want the best balance of speed, quality, and maintainability:
Start with:
- LlamaIndex
- Prefect
- unstructured
- OpenAI embeddings
- Qdrant
- hybrid retrieval
- Cohere rerank
- Ragas for eval
That stack gets you to a high-quality multi-source pipeline quickly without overengineering.
Key design principle
For multi-source retrieval, don’t think “vector DB only.”
Think:
Ingestion → normalization → metadata enrichment → hybrid retrieval → reranking → permission filtering → answer generation → evaluation
That architecture matters more than any single tool.
If you want, I can also give you:
- a reference architecture diagram,
- a stack recommendation by budget (startup vs enterprise), or
- a concrete implementation blueprint in Python.