fix answer is not subscriptable error (#2069)

* fix answer is not subscriptable error

* fix answer is not subscriptable in script
This commit is contained in:
Julian Risch 2022-01-26 11:45:45 +01:00 committed by GitHub
parent 8a32d8da92
commit 0f34983f74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -314,7 +314,7 @@
"\n",
" # Print you answer\n",
" answers = predicted_result[\"answers\"]\n",
" print(f'Generated answer is \\'{answers[0][\"answer\"]}\\' for the question = \\'{question}\\'')"
" print(f'Generated answer is \\'{answers[0].answer}\\' for the question = \\'{question}\\'')"
],
"outputs": [],
"metadata": {
@ -391,4 +391,4 @@
},
"nbformat": 4,
"nbformat_minor": 2
}
}

View File

@ -108,7 +108,7 @@ def tutorial7_rag_generator():
# Print you answer
answers = predicted_result["answers"]
print(f' -> Generated answer is \'{answers[0]["answer"]}\' for the question = \'{question}\'')
print(f' -> Generated answer is \'{answers[0].answer}\' for the question = \'{question}\'')
# Or alternatively use the Pipeline class
from haystack.pipelines import GenerativeQAPipeline