mirror of
https://github.com/deepset-ai/haystack.git
synced 2025-09-25 16:15:35 +00:00
Update readme
This commit is contained in:
parent
a2e5e6b09e
commit
737a47e2fe
@ -105,12 +105,13 @@ We recommend Elasticsearch or FAISS, but have also more light-weight options for
|
||||
```python
|
||||
# DB to store your docs
|
||||
document_store = ElasticsearchDocumentStore(host="localhost", username="", password="",
|
||||
index="document", embedding_dim=768, embedding_field="embedding")
|
||||
index="document", embedding_dim=768,
|
||||
embedding_field="embedding")
|
||||
|
||||
# Index your docs
|
||||
# (Options: Convert text from PDFs etc. via FileConverter; Split and clean docs with the PreProcessor)
|
||||
docs = [Document(text="Arya accompanies her father Ned and her sister Sansa to King's Landing. Before their departure ...", meta={}),
|
||||
...]
|
||||
...]
|
||||
|
||||
document_store.write_documents([doc])
|
||||
|
||||
@ -131,7 +132,7 @@ reader = FARMReader(model_name_or_path="deepset/roberta-base-squad2", use_gpu=Tr
|
||||
pipeline = ExtractiveQAPipeline(reader, retriever)
|
||||
|
||||
# Voilá! Ask a question!
|
||||
prediction = pipeline.run(query="Who is the father of Arya Stark?", top_k_retriever=10, top_k_reader=3)
|
||||
prediction = pipeline.run(query="Who is the father of Arya Stark?", top_k_retriever=10,top_k_reader=3)
|
||||
print_answers(prediction, details="minimal")
|
||||
|
||||
[ { 'answer': 'Eddard',
|
||||
|
Loading…
x
Reference in New Issue
Block a user