diff --git a/haystack/nodes/prompt/prompt_node.py b/haystack/nodes/prompt/prompt_node.py index c4a40e9b8a..d5186519fa 100644 --- a/haystack/nodes/prompt/prompt_node.py +++ b/haystack/nodes/prompt/prompt_node.py @@ -247,7 +247,10 @@ def _prepare( # type: ignore """ Prepare prompt invocation. """ - invocation_context = invocation_context.copy() or {} + if invocation_context is None: + invocation_context = {} + else: + invocation_context = invocation_context.copy() if query and "query" not in invocation_context: invocation_context["query"] = query