diff options
author | Alexander_Kabui | 2024-05-24 15:48:45 +0300 |
---|---|---|
committer | Alexander_Kabui | 2024-05-24 15:48:45 +0300 |
commit | ee1345535817a6b3e6943b268057f53840d78b8f (patch) | |
tree | 7f0337a10ed4f10684cb4732f906a31ec051dcba /gn3/llms | |
parent | 13bb57cbd191ffe6e40e830ca08b9191b2dc5700 (diff) | |
download | genenetwork3-ee1345535817a6b3e6943b268057f53840d78b8f.tar.gz |
Check for null and empty data results and update timeout message
Diffstat (limited to 'gn3/llms')
-rw-r--r-- | gn3/llms/client.py | 5 |
1 files changed, 3 insertions, 2 deletions
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) |