3 ms·
lol - Yeah, I could write this in 20 lines. I have it answering a list of questions in an excel from three different 'Frames of mind' by passing three differen
by TrapLord_Rhodo 4y ago
lol - Yeah, I could write this in 20 lines.
I have it answering a list of questions in an excel from three different 'Frames of mind' by passing three different directory'swith different content in each to get three different responses i can craft together.
def excelGPT(self, dir, excel_file, sheet):
#my GPT Key
os.environ['OPENAI_API_KEY'] = 'sk-
#Working Directory for training
# root =
root_folder1 =
documents1 = SimpleDirectoryReader(root_folder1).load_data()
index1 = GPTSimpleVectorIndex(documents1)
root_folder2 =
documents2 = SimpleDirectoryReader(root_folder2).load_data()
index2 = GPTSimpleVectorIndex(documents2)
root_folder3 =
documents3 = SimpleDirectoryReader(root_folder3).load_data()
index3 = GPTSimpleVectorIndex(documents3)
file_name = dir + excel_file
df = pd.read_excel(file_name, sheet_name=sheet)
GSA_answer_array = []
basic_answer_array = []
QA_answer_array = []
df_series = df.iloc[:,0]
for i,x in enumerate(df_series):
print("This is the index ", i)
print(x)
GSA_response = index1.query(x)
basic_response = index2.query(x)
QA_response = index3.query(x)
GSA_answer_array.append(str(GSA_response))
basic_answer_array.append(str(basic_response))
QA_answer_array.append(str(QA_response))
self.zip_to_docv2(dir, "Gippie_Response.docx", df_series, GSA_answer_array, basic_answer_array, QA_answer_array)