Data & AI Infrastructure
Haystack by deepset
Create modular Python pipelines for document retrieval and model-backed applications.
- G2 (Haystack framework and platform) rating
- Pricing
- Open-source Haystack
- Free framework under Apache-2.0
- Hosted infrastructure
- Depends on selected services
- Best for
- Developers building custom retrieval and answer pipelines with testable components.
Video tutorial
Haystack 2.0 Full Setup Guide — Build RAG Pipelines Free · DailyDev AI · Watch on YouTube ↗
What is Haystack by deepset?
Haystack gives developers a way to wire together reusable search and model components in Python. It is a strong choice when intermediate pipeline results need to be understood and tested independently of the final model reply.
A query pipeline can have several failure points, including parsing, document storage, ranking, and prompt assembly. Inspect what leaves each stage before trying to fix end-to-end accuracy.
Set up and test a real workflow
Build a small Haystack pipeline around InMemoryDocumentStore and InMemoryBM25Retriever before adding a generator. Write three Documents with source_id metadata, including lockers-1 for a visitor locker policy and two unrelated items. Set the retriever top_k to 2 and record both results. Keep the generator or answer formatter downstream so each stage can be checked by itself.
What to look for in the result
Query the fixture with Where do visitors collect a locker key? and verify lockers-1 appears in the retrieved candidates before judging the answer. Then ask about a topic the docs omit, such as lost parking permits. BM25 may still return a weak match. Confirm your answer logic checks whether the evidence actually answers the question and can leave the result unanswered.
| Problem | What to check | What to change |
|---|---|---|
| The generator gives the wrong policy | Inspect the retriever's documents and source_id values first | Fix ingestion or retrieval if lockers-1 is missing, and adjust the answer step only if evidence is already present |
| The retriever returns no documents even for the exact policy wording | Check that documents were written into the same store instance connected to the pipeline | Seed and query that store in the same test run before swapping in another backend |
Try it: Trace a question through a help pipeline
Index a handful of FAQ entries and inspect the output of each connected component.
Build a pipeline that retrieves a source passage for “How do I return a demo badge?” from fictional office FAQs. Return source IDs, selected text, and a short answer.
- Set up a small in-memory or local store and seed the fixture with three documents.
- Connect the retrieval node and call it independently before adding templating and generation.
- Run supported and unsupported questions. Check the observed source IDs and verify the unsupported case is handled according to your application requirements.
What a usable result looks like
The badge-return passage reaches the model and the answer preserves its conditions.
| Check | What you might see | What to do next |
|---|---|---|
| Retrieval | The expected ID appears. | Compare the source fixture and query. |
| Generation | The response retains the stated deadline. | Check the passage by hand. |
| Unknown | Unsupported queries use the chosen fallback. | Verify the test does not reward guesses. |
What to save from the trial
A small modular pipeline and tests for retrieval and answer composition.
Another scenario
Replace the retriever in a second branch and see if query quality improves without altering the document set.
Use cases and what to check
| Use case | How to try it | What to check |
|---|---|---|
| Document QA | Retrieve fictional handbook passages and compile a prompt. | Verify the correct passage reached the generation stage. |
| Search comparison | Try two retrievers against a small query set. | Record relevance and latency using the same records. |
Which plan should you try?
| Plan | Price | Who should consider it |
|---|---|---|
| Open-source Haystack | Free framework under Apache-2.0 | Run a local test pipeline and choose a backend and model. |
| Hosted infrastructure | Depends on selected services | Estimate vector storage, model use, and orchestration separately. |
Budget infrastructure and inference even when the framework itself is open source.
Provider pricing and access ↗ · Checked
What people say about Haystack by deepset
1 featured user review.
Combining keyword and vector retrieval
The developer built a Haystack pipeline that combined Elasticsearch results with Chroma embeddings and passed the retrieved passages to a local model. Finding the relevant passages was the hardest step, and adding too many documents made the local model's answers less usable.
July 3, 2024 · Simon Marache-Francisco's hands-on write-up ↗ · Paraphrased
Limits to check
Hosting, retries, observability, and permissions require application-level decisions.
When to choose it
Use Haystack when you want retrieval, generation, and validation to remain separate testable components. Keep a keyword-only baseline so a more complex vector or hybrid pipeline earns its place by improving results on known questions.
Common questions
- Can I mix several search components?
- Use the pipeline’s component contracts and test combinations against the expected result set.
- What should an evaluation include?
- Include exact requests, paraphrases, excluded records, and cases with no answer.
Community posts
-
Test hybrid retrieval on a book with known passages ↗
A developer walks through a Haystack experiment that combines keyword and vector retrieval and shows how missing passages can limit the final answer.
Simon Marache-Francisco's developer blog