From f5124e612e3059b64d32e65f4825e1eb3cada54b Mon Sep 17 00:00:00 2001 From: Alexander_Kabui Date: Wed, 14 Feb 2024 12:40:00 +0300 Subject: raise error for fahamu api 0 task_id --- gn3/llms/process.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'gn3/llms') diff --git a/gn3/llms/process.py b/gn3/llms/process.py index e4d33c7..9d32d4e 100644 --- a/gn3/llms/process.py +++ b/gn3/llms/process.py @@ -72,6 +72,9 @@ def get_gnqa(query, auth_token): api_client = GeneNetworkQAClient(requests.Session(), api_key=auth_token) res, task_id = api_client.ask('?ask=' + quote(query), auth_token) + + if task_id == 0 : + raise RuntimeError(f"Error connecting to Fahamu Api: {str(res)}") res, success = api_client.get_answer(task_id) if success == 1: resp_text = filter_response_text(res.text) -- cgit v1.2.3