Spaces:
Sleeping
Sleeping
Update excel_chat.py
Browse files- excel_chat.py +21 -0
excel_chat.py
CHANGED
@@ -57,6 +57,27 @@ def ask_llm(query, user_input, client_index, user, keys):
|
|
57 |
)
|
58 |
return response.content[0].text
|
59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
elif "Groq" in client_index:
|
61 |
try:
|
62 |
client = Groq(api_key= os.getenv(keys[0]))
|
|
|
57 |
)
|
58 |
return response.content[0].text
|
59 |
|
60 |
+
elif "GPT 4o" in client_index:
|
61 |
+
client = OpenAI(api_key=os.environ[user['api_keys']['gpt-4o']])
|
62 |
+
response = client.messages.create(
|
63 |
+
model="gpt-4o",
|
64 |
+
messages=messageC
|
65 |
+
)
|
66 |
+
return response.content[0].text
|
67 |
+
|
68 |
+
elif "Perplexity" in client_index:
|
69 |
+
client = OpenAI(api_key=os.environ[user['api_keys']['perplexity']], base_url="https://api.perplexity.ai")
|
70 |
+
model_map = {
|
71 |
+
"Perplexity Mixtral": "mixtral-8x7b-instruct",
|
72 |
+
"Perplexity Llama3 70b": "llama-3-70b-instruct",
|
73 |
+
"Perplexity Llama3 8b": "llama-3-8b-instruct"
|
74 |
+
}
|
75 |
+
response = client.messages.create(
|
76 |
+
model=model_map[client_index],
|
77 |
+
messages=messageC
|
78 |
+
)
|
79 |
+
return response.content[0].text
|
80 |
+
|
81 |
elif "Groq" in client_index:
|
82 |
try:
|
83 |
client = Groq(api_key= os.getenv(keys[0]))
|