Skip to content

🔍 Haystack is an open source NLP framework that leverages Transformer models. It enables developers to implement production-ready neural search, question answering, semantic document search and summarization for a wide range of applications.

License

Notifications You must be signed in to change notification settings

jamescalam/haystack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Haystack — Natural Language Question Answering At Scale

Introduction

A system built on top of FARM Framework to perform NLP question answering on a collection of large documents.

Inference for QA using current state-of-the-art models is computationally expensive. To make scaling question answering on documents pragmatic, document retrieval techniques are used to narrow down the scope to small subset of paragraphs across documents where an answer to the question could potentially be.

The system is designed with a goal to be modular. Individual components can be customized or new ones can be incorporated with minimal effort.

Components

There are three major components for the question answering pipeline:

  1. Reader implements inference on FARM Adaptive Models trained on SQuaD like tasks to perform question answering. It takes paragraphs of text as input and returns answers with corresponding confidence scores.
  2. Retriever is an implementation of term frequency–inverse document frequency(tf-idf) numerical statistic similar to the query scoring functions used in popular search systems like Elasticsearch. Retriever helps to narrow down the scope for Reader to smaller units of text where a given question could be answered.
  3. Finder is a pipeline to glue together instance of a Reader and a Retriever to provide an easy-to-use question answering interface.

Quickstart

Installation

There are two ways to install:

  • (recommended) from source, git clone <url> and run pip install [--editable] . from the root of the repositry.
  • from PyPI, do a pip install farm_haystack

Configuration

The configuration can be supplied in a qa_config.py placed in the PYTHONPATH. Alternatively, the DATABASE_URL can also be set an an environment variable.

Deployment

SQL Backend

The database ORM layer is implemented using SQLAlchemy library. By default, it uses the file-based SQLite database. For large scale deployments, the configuration can be changed to use other compatible databases like PostgreSQL or MySQL.

REST API

A Flask based HTTP REST API is included to use the QA Framework with UI or integrating with other systems. To serve the API, run FLASK_APP=farm_hackstack.api.inference flask run.

About

🔍 Haystack is an open source NLP framework that leverages Transformer models. It enables developers to implement production-ready neural search, question answering, semantic document search and summarization for a wide range of applications.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 99.7%
  • Other 0.3%