diff options
author | Alexander_Kabui | 2024-05-27 14:18:48 +0300 |
---|---|---|
committer | Alexander_Kabui | 2024-05-27 14:18:48 +0300 |
commit | d0801cea229d00d5d4ce19fa1cb36242e56070d1 (patch) | |
tree | c46a5a77a812b620d949d0ffc9d3194dfb0b1f3d | |
parent | 105f2b36eb62b9b097e1cbf6fa815f98da77bc16 (diff) | |
download | genenetwork3-d0801cea229d00d5d4ce19fa1cb36242e56070d1.tar.gz |
Delete filter response text method and update relevant code.
-rw-r--r-- | gn3/llms/process.py | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/gn3/llms/process.py b/gn3/llms/process.py index ade4104..2ce6b2b 100644 --- a/gn3/llms/process.py +++ b/gn3/llms/process.py @@ -67,12 +67,6 @@ def format_bibliography_info(bib_info): return bib_info -def filter_response_text(val): - """helper function for filtering non-printable chars""" - return json.loads(''.join([str(char) - for char in val if char in string.printable])) - - def parse_context(context, get_info_func, format_bib_func): """Function to parse doc_ids content Args: @@ -151,7 +145,8 @@ def get_gnqa(query, auth_token, data_dir=""): api_client = GeneNetworkQAClient(api_key=auth_token) res, task_id = api_client.ask('?ask=' + quote(query), query=query) res, _status = api_client.get_answer(task_id) - resp_text = filter_response_text(res.text) + resp_text = json.loads(''.join([str(char) + for char in res.text if char in string.printable])) answer = resp_text['data']['answer'] context = resp_text['data']['context'] return task_id, answer, fetch_pubmed(parse_context( |