From cffc6d5bc40bb895eb60c8307df79c18fab18ac7 Mon Sep 17 00:00:00 2001 From: Tanay Soni Date: Wed, 14 Oct 2020 11:26:54 +0200 Subject: [PATCH] deepcopy meta dicts in answers --- haystack/finder.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/haystack/finder.py b/haystack/finder.py index c2d54776c3..4ead6911c7 100644 --- a/haystack/finder.py +++ b/haystack/finder.py @@ -1,5 +1,6 @@ import logging import time +from copy import deepcopy from statistics import mean from typing import Optional, Dict, Any, List from collections import defaultdict @@ -69,7 +70,7 @@ def get_answers(self, question: str, top_k_reader: int = 1, top_k_retriever: int ans["meta"] = {} for doc in documents: if doc.id == ans["document_id"]: - ans["meta"] = doc.meta + ans["meta"] = deepcopy(doc.meta) return results