Skip to main content

Neural Question Answering & Semantic Search at Scale. Use modern transformer based models like BERT to find answers in large document collections

Project description


Tests Schemas Documentation FOSSA Status Release Last commit Downloads Jobs Twitter chat on Discord

Haystack is an end-to-end framework that enables you to build powerful and production-ready pipelines for different search use cases. Whether you want to perform question answering (QA) or semantic document search, you can use the state-of-the-art NLP models in Haystack to provide unique search experiences and allow your users to query in natural language. Haystack is built in a modular fashion so that you can combine the best technology from other open source projects, like Hugging Face's transformers, Elasticsearch, or Milvus.

What to Build with Haystack

  • Ask questions in natural language and find granular answers in your documents.
  • Perform semantic search and retrieve documents according to meaning, not keywords.
  • Use off-the-shelf models or fine-tune them to your domain.
  • Use user feedback to evaluate, benchmark, and continuously improve your live models.
  • Leverage existing knowledge bases and better handle the long tail of queries that chatbots receive.
  • Automate processes by automatically applying a list of questions to new documents and using the extracted answers.

Core Features

  • Latest models: Utilize all latest transformer-based models (for example, BERT, RoBERTa, MiniLM) for extractive QA, generative QA, and document retrieval.
  • Modular: Multiple choices to fit your tech stack and use case. Pick your favorite database, file converter, or modeling framework.
  • Pipelines: Use the Node and Pipeline design of Haystack to route queries to only the relevant components.
  • Open: 100% compatible with Hugging Face's model hub. Tight interfaces to other frameworks (for example, transformers, FARM, sentence-transformers).
  • Scalable: Scale to millions of docs using retrievers, production-ready backends like Elasticsearch / FAISS, and a fastAPI REST API.
  • End-to-End: All tooling in one place: file conversion, cleaning, splitting, training, eval, inference, labeling, and more.
  • Developer friendly: Easy to debug, extend, and modify.
  • Customizable: Fine-tune models to your domain or implement your custom DocumentStore.
  • Continuous Learning: Collect new training data from user feedback in production & improve your models continuously.
:ledger: Docs Components, Pipeline Nodes, Guides, API Reference
:floppy_disk: Installation How to install Haystack
:mortar_board: Tutorials See what Haystack can do with our Notebooks & Scripts
:beginner: Quick Demo Deploy a Haystack application with Docker Compose and a REST API
:vulcan_salute: Community Discord, Twitter, Stack Overflow, GitHub Discussions
:heart: Contributing We welcome all contributions!
:bar_chart: Benchmarks Speed & Accuracy of Retriever, Readers and DocumentStores
:telescope: Roadmap Public roadmap of Haystack
:newspaper: Blog Read our articles on Medium
:phone: Jobs We're hiring! Have a look at our open positions

:floppy_disk: Installation

Basic Installation

Use pip to install a basic version of Haystack's latest release:

    pip install farm-haystack

This command installs everything needed for basic Pipelines that use an Elasticsearch DocumentStore.

Full Installation

To use more advanced features, like certain DocumentStores, FileConverters, OCR, or Ray, install further dependencies. The following command installs the latest version of Haystack and all its dependencies from the main branch:

git clone
cd haystack
pip install --upgrade pip
pip install -e '.[all]' ## or 'all-gpu' for the GPU-enabled dependencies

Custom Installation You can choose the dependencies you want to install. To do so, specify them in the pip install command:

pip install 'farm-haystack[DEPENDENCY_OPTION]'

You can find a full list of dependency options at haystack/pyproject.toml.

If you're running pip version earlier than 21.3, you can't install dependency groups that reference other groups. Instead, you can only specify groups that contain direct package references:

# instead of '[all]'
pip install 'farm-haystack[sql,only-faiss,only-milvus1,weaviate,pinecone,opensearch,graphdb,inmemorygraph,crawler,preprocessing,ocr,onnx,ray,dev]'

# instead of '[all-gpu]'
pip install 'farm-haystack[sql,only-faiss-gpu,only-milvus1,weaviatepinecone,opensearch,graphdb,inmemorygraph,crawler,preprocessing,ocr,onnx-gpu,ray,dev]'

Installing the REST API Haystack comes packaged with a REST API so that you can deploy it as a service. Run the following command from the root directory of the Haystack repo to install REST_API:

pip install rest_api/

Other Operating Systems

Windows We recommend installing WSL to use Haystack on Windows:

pip install farm-haystack -f

Apple Silicon (M1)

Macs with an M1 processor require some extra dependencies to install Haystack:

# some additional dependencies needed on m1 mac
brew install postgresql
brew install cmake
brew install rust

# haystack installation
GRPC_PYTHON_BUILD_SYSTEM_ZLIB=true pip install git+

Learn More

See our installation guide for more options. You can find out more about our PyPi package on our PyPi page.

:mortar_board: Tutorials


Follow our introductory tutorial to set up a question answering system using Python and start performing queries! Explore the rest of our tutorials to learn how to tweak pipelines, train models, and perform evaluation.

:beginner: Quick Demo


Try out our hosted Explore The World live demo here! Ask any question on countries or capital cities and let Haystack return the answers to you.


To run the Explore The World demo on your own machine and customize it to your needs, check out the instructions on Explore the World repository on GitHub.

:vulcan_salute: Community

There is a very vibrant and active community around Haystack which we are regularly interacting with! If you have a feature request or a bug report, feel free to open an issue in Github. We regularly check these and you can expect a quick response. If you'd like to discuss a topic, or get more general advice on how to make Haystack work for your project, you can start a thread in Github Discussions or our Discord channel. We also check Twitter and Stack Overflow.

:heart: Contributing

We are very open to the community's contributions - be it a quick fix of a typo, or a completely new feature! You don't need to be a Haystack expert to provide meaningful improvements. To learn how to get started, check out our Contributor Guidelines first.

You can also find instructions to run the tests locally there.

Thanks so much to all those who have contributed to our project!

Who Uses Haystack

Here's a list of organizations that use Haystack. Don't hesitate to send a PR to let the world know that you use Haystack. Join our growing community!

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

farm_haystack-1.15.0.tar.gz (563.6 kB view hashes)

Uploaded source

Built Distribution

farm_haystack-1.15.0-py3-none-any.whl (677.8 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page