Spaces:
Sleeping
Sleeping
Update excel_chat.py
Browse files- excel_chat.py +3 -2
excel_chat.py
CHANGED
@@ -84,7 +84,7 @@ def ask_llm(query, user_input, client_index, user, keys):
|
|
84 |
raise ValueError("Unsupported client index provided")
|
85 |
|
86 |
# Return the response, handling the structure specific to Groq and Mistral clients.
|
87 |
-
return chat_completion.choices[0].message.content if client_index != "Claude" else chat_completion
|
88 |
|
89 |
|
90 |
|
@@ -105,6 +105,7 @@ def chat_with_mistral(source_cols, dest_col, prompt, excel_file, url, search_col
|
|
105 |
# API Keys for Groq :
|
106 |
KEYS = ['GROQ_API_KEY1', 'GROQ_API_KEY2', 'GROQ_API_KEY3']
|
107 |
GroqKey = KEYS[0]
|
|
|
108 |
|
109 |
new_prompts, new_keywords, new_user, conf_file_path = update_json(user, prompt, keywords)
|
110 |
print(f'xlsxfile = {excel_file}')
|
@@ -125,7 +126,7 @@ def chat_with_mistral(source_cols, dest_col, prompt, excel_file, url, search_col
|
|
125 |
for index, row in filtred_df.iterrows():
|
126 |
concatenated_content = "\n\n".join(f"{column_name}: {str(row[column_name])}" for column_name in source_cols)
|
127 |
if not concatenated_content == "\n\n".join(f"{column_name}: nan" for column_name in source_cols):
|
128 |
-
llm_answer = ask_llm(prompt[0], concatenated_content, client, user,
|
129 |
print(f"{cpt}/{len(filtred_df)}\nQUERY:\n{prompt[0]}\nCONTENT:\n{concatenated_content[:200]}...\n\nANSWER:\n{llm_answer}")
|
130 |
df.at[index, dest_col] = llm_answer
|
131 |
cpt += 1
|
|
|
84 |
raise ValueError("Unsupported client index provided")
|
85 |
|
86 |
# Return the response, handling the structure specific to Groq and Mistral clients.
|
87 |
+
return chat_completion.choices[0].message.content,keys if client_index != "Claude" else chat_completion
|
88 |
|
89 |
|
90 |
|
|
|
105 |
# API Keys for Groq :
|
106 |
KEYS = ['GROQ_API_KEY1', 'GROQ_API_KEY2', 'GROQ_API_KEY3']
|
107 |
GroqKey = KEYS[0]
|
108 |
+
gloabal_keys = [GroqKey, KEYS]
|
109 |
|
110 |
new_prompts, new_keywords, new_user, conf_file_path = update_json(user, prompt, keywords)
|
111 |
print(f'xlsxfile = {excel_file}')
|
|
|
126 |
for index, row in filtred_df.iterrows():
|
127 |
concatenated_content = "\n\n".join(f"{column_name}: {str(row[column_name])}" for column_name in source_cols)
|
128 |
if not concatenated_content == "\n\n".join(f"{column_name}: nan" for column_name in source_cols):
|
129 |
+
llm_answer,gloabal_keys = ask_llm(prompt[0], concatenated_content, client, user, gloabal_keys)
|
130 |
print(f"{cpt}/{len(filtred_df)}\nQUERY:\n{prompt[0]}\nCONTENT:\n{concatenated_content[:200]}...\n\nANSWER:\n{llm_answer}")
|
131 |
df.at[index, dest_col] = llm_answer
|
132 |
cpt += 1
|