From e5f156e3fce5211c13b829f6fc743cd9112c43a9 Mon Sep 17 00:00:00 2001 From: Benjoyo Date: Tue, 10 Oct 2023 14:03:43 +0200 Subject: [PATCH] fix: exception when retrieval query does not mention filter value --- python/src/gpt/agents/retrieval_agent/retrieval_agent.py | 2 +- python/tests/manual_integration/test.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/python/src/gpt/agents/retrieval_agent/retrieval_agent.py b/python/src/gpt/agents/retrieval_agent/retrieval_agent.py index cb33728..3909f58 100644 --- a/python/src/gpt/agents/retrieval_agent/retrieval_agent.py +++ b/python/src/gpt/agents/retrieval_agent/retrieval_agent.py @@ -190,7 +190,7 @@ def create_retrieval_qa( verbose=True ) else: - if isinstance(vector_store, AzureSearch): + if filter and isinstance(vector_store, AzureSearch): filter_dict = {'filters': f"{list(filter.keys())[0]} eq '{list(filter.values())[0]}'"} else: filter_dict = {'filter': filter} diff --git a/python/tests/manual_integration/test.py b/python/tests/manual_integration/test.py index 6af5bed..4833708 100644 --- a/python/tests/manual_integration/test.py +++ b/python/tests/manual_integration/test.py @@ -386,8 +386,7 @@ def test_retrieve(): ) print(qa( inputs={ - "input": "I can't decide between the Electra Townie Go! and the Sun Bicycles Electrolite. Could you tell me how they compare in terms of their weight?", - #"input": "What is the weight limit of the Electra Townie Go?", + "input": "What is the weight limit of the Electra Townie Go?", "context": "" })["output"]["answer"])