diff options
author | Nyeusi D. Shebes | 2025-03-03 20:55:51 -0600 |
---|---|---|
committer | Nyeusi D. Shebes | 2025-03-03 20:55:51 -0600 |
commit | 57e22e4455cd8f43168e028e91d1ea9e61df78a1 (patch) | |
tree | 6073f4c49dd020ebbe5bb99c6da39f3ac817bc49 /gnqa/src/study2/run_questions.py | |
parent | 9c7412ff3920010f294093bcb7df143c00321c29 (diff) | |
download | gn-ai-57e22e4455cd8f43168e028e91d1ea9e61df78a1.tar.gz |
added old R2R
Diffstat (limited to 'gnqa/src/study2/run_questions.py')
-rw-r--r-- | gnqa/src/study2/run_questions.py | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/gnqa/src/study2/run_questions.py b/gnqa/src/study2/run_questions.py new file mode 100644 index 0000000..07aee5f --- /dev/null +++ b/gnqa/src/study2/run_questions.py @@ -0,0 +1,38 @@ +import json +import sys +import os + +from r2r import R2RClient +from study2.document_operations import DocOps, QuestionList + +''' +******************************************************************************* +Variables +******************************************************************************* +''' +rag_response = {} +client = R2RClient("http://localhost:8000") +health_resp = client.health() + +''' +******************************************************************************* +Commands +******************************************************************************* +''' + +print("The R2R client's health status is {0}".format(health_resp)) + +try: + read_file = str(sys.argv[1]) + out_file = str(sys.argv[2]) +except: + exit('Example use "python run_questions.py ../data/questions/human/de/aging.json ../data/responses/human/de/aging_resp.json"') + +qLst = QuestionList(read_file, 1) # second parameter is for verbose output +ndx = 1 +for question in qLst.get("domainexpert","aging"): + print('Getting response for the following question --> {0}'.format(question)) + rag_response[str(ndx)] = client.rag(question) + ndx += 1 + +DocOps.writeDatasetFile(rag_response, out_file)
\ No newline at end of file |