Haystack v0.5.0 adds RAG-based generative QA, DPR training, MySQL support, and an Elasticsearch Query DSL-compliant REST API.
$ git clone --branch v0.5.0 https://github.com/deepset-ai/haystack.git # already have the repo? check out this version: $ git checkout v0.5.0
retrieved_docs = retriever.retrieve(query="who got the first nobel prize in physics?")
predicted_result = generator.predict(
question="who got the first nobel prize in physics?",
documents=retrieved_docs,
top_k=1
) dense_passage_retriever.train(
data_dir="/data/dpr",
train_filename="train.json",
dev_filename="dev.json",
batch_size=16,
embed_title=True,
num_hard_negatives=1,
n_epochs=3
) - ›Adds generator.predict(question=..., documents=..., top_k=...) for Retrieval Augmented Generation (RAG), enabling generative QA where answers are generated from retrieved documents rather than extracted.
- ›Adds dense_passage_retriever.train(data_dir, train_filename, dev_filename, test_filename, batch_size, embed_title, num_hard_negatives, n_epochs) to train or fine-tune DPR models on custom domain data.
- ›Adds
saveandloadmethods toDensePassageRetrieverfor persisting and reloading trained DPR models. - ›Adds
use_fast_tokenizersandsimilarity_functionparameters toDensePassageRetriever, and splitsmax_seq_leninto independentmax_seq_len_queryandmax_seq_len_passageparameters. - ›Adds
faiss_index_factory_strandreturn_embeddingparameters toFAISSDocumentStore, with new default index type'Flat'.
+11 moreshow less
- ›Adds support for MySQL databases in
DocumentStore. - ›Allows configuration of the Elasticsearch Analyzer in
ElasticsearchDocumentStore(e.g. for non-English languages). - ›Adds filter support to get_document_count() in
DocumentStore. - ›Adds Elasticsearch Query DSL-compliant Query API to the REST API.
- ›Adds
create_indexandsimilaritymetric configuration to the REST API config. - ›Allows configuration of log level in the REST API.
- ›Makes filter values optional in the REST API.
- ›Adds automatic mixed precision (AMP) support for FARMReader training.
- ›Adds a preprocessing pipeline via
PreProcessor. - ›Enables returning predictions in Finder and Retriever eval() calls.
- ›Makes creation of the label index optional in
DocumentStore.
- !
TransformersReaderparametermodelis replaced bymodel_name_or_path. - !
FAISSDocumentStoreparametervector_sizeis renamed tovector_dim;faiss_indextype changes fromOptional[IndexHNSWFlat]toOptional[faiss.swigfaiss.Index]; default index type changes from HNSW to'Flat'. - !
DensePassageRetrieverparametermax_seq_lenis split intomax_seq_len_query(default 64) andmax_seq_len_passage(default 256);remove_sep_tok_from_untitled_passagesparameter is removed.