From ee1345535817a6b3e6943b268057f53840d78b8f Mon Sep 17 00:00:00 2001 From: Alexander_Kabui Date: Fri, 24 May 2024 15:48:45 +0300 Subject: Check for null and empty data results and update timeout message --- gn3/llms/client.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'gn3/llms') diff --git a/gn3/llms/client.py b/gn3/llms/client.py index fa1e36e..5c4fa0e 100644 --- a/gn3/llms/client.py +++ b/gn3/llms/client.py @@ -109,7 +109,7 @@ class GeneNetworkQAClient(Session): for _i in range(max_retries): response = super().request(method, url, *args, **kwargs) if response.ok: - if method.lower() == "get" and response.json().get("data") is None: + if method.lower() == "get" and not (response.json().get("data")): # note this is a dirty trick to check if fahamu has returned the results # the issue is that the api only returns 500 or 200 satus code # TODO: fix this on their end @@ -122,5 +122,6 @@ class GeneNetworkQAClient(Session): {response_msg.get(response.status_code,response.reason)}", query=self.query) #time.sleep(retry_delay) - raise LLMError("Time error: Please try to rephrase of query to get an answer", + raise LLMError("Time error: We couldn't provide a response,Please try\ + to rephrase your question to receive feedback", query=self.query) -- cgit v1.2.3