Remove feedback from no-answers (#1827)

* Fix some miscopied code

* Remove feedback from the no-answer, seems the backend can't take it

* Try to raise concurrent requests per worker

* Remove the actual number of workers
This commit is contained in:
Sara Zan 2021-11-29 19:42:10 +01:00 committed by GitHub
parent eb5f7bb4c0
commit fb511dc4a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 4 deletions

View File

@ -24,6 +24,7 @@ services:
# See rest_api/pipelines.yaml for configurations of Search & Indexing Pipeline.
- DOCUMENTSTORE_PARAMS_HOST=elasticsearch
- PIPELINE_YAML_PATH=/home/user/rest_api/pipeline/pipelines_dpr.yaml
- CONCURRENT_REQUEST_PER_WORKER
depends_on:
- elasticsearch
command: "/bin/bash -c 'sleep 10 && gunicorn rest_api.application:app -b 0.0.0.0 -k uvicorn.workers.UvicornWorker --workers 1 --timeout 180'"

View File

@ -46,12 +46,12 @@ def query(query, filters={}, top_k_reader=5, top_k_retriever=5) -> Tuple[List[Di
url = f"{API_ENDPOINT}/{DOC_REQUEST}"
params = {"filters": filters, "Retriever": {"top_k": top_k_retriever}, "Reader": {"top_k": top_k_reader}}
req = {"query": query, "params": params}
response_raw = requests.post(url, json=req).json()
response_raw = requests.post(url, json=req)
if response_raw.status_code >= 400:
raise Exception(f"{response_raw}")
response = requests.post(url, json=req).json()
response = response_raw.json()
if "errors" in response:
raise Exception(", ".join(response["errors"]))
@ -66,7 +66,7 @@ def query(query, filters={}, top_k_reader=5, top_k_retriever=5) -> Tuple[List[Di
"answer": answer.get("answer", None),
"source": answer["meta"]["name"],
"relevance": round(answer["score"] * 100, 2),
"document": [doc for doc in response_raw["documents"] if doc["id"] == answer["document_id"]][0],
"document": [doc for doc in response["documents"] if doc["id"] == answer["document_id"]][0],
"offset_start_in_doc": answer["offsets_in_document"][0]["start"],
"_raw": answer
}

View File

@ -186,7 +186,7 @@ Ask any question on this topic and see if Haystack can find the correct answer t
st.info("🤔    Haystack is unsure whether any of the documents contain an answer to your question. Try to reformulate it!")
st.write("**Relevance:** ", result["relevance"])
if eval_mode:
if eval_mode and result["answer"]:
# Define columns for buttons
is_correct_answer = None
is_correct_document = None