Spaces:
Sleeping
Sleeping
Update excel_chat.py
Browse files- excel_chat.py +6 -6
excel_chat.py
CHANGED
@@ -10,7 +10,7 @@ from users_management import update_json, users
|
|
10 |
|
11 |
#users = ['maksG', 'AlmaA', 'YchK']
|
12 |
|
13 |
-
def ask_llm(query,
|
14 |
messages = [
|
15 |
{
|
16 |
"role": "system",
|
@@ -18,7 +18,7 @@ def ask_llm(query, input, client_index):
|
|
18 |
},
|
19 |
{
|
20 |
"role": "user",
|
21 |
-
"content":
|
22 |
}
|
23 |
]
|
24 |
|
@@ -27,12 +27,12 @@ def ask_llm(query, input, client_index):
|
|
27 |
"role": "user",
|
28 |
"content": [{
|
29 |
"type": "text",
|
30 |
-
"text":
|
31 |
}]
|
32 |
}]
|
33 |
|
34 |
if "Mistral" in client_index:
|
35 |
-
client = MistralClient(api_key=os.environ['
|
36 |
model_map = {
|
37 |
"Mistral Tiny": "mistral-tiny",
|
38 |
"Mistral Small": "mistral-small-latest",
|
@@ -41,7 +41,7 @@ def ask_llm(query, input, client_index):
|
|
41 |
chat_completion = client.chat(messages=messages, model=model_map[client_index])
|
42 |
|
43 |
elif "Claude" in client_index:
|
44 |
-
client = anthropic.Anthropic(api_key=os.environ['
|
45 |
model_map = {
|
46 |
"Claude Sonnet": "claude-3-sonnet-20240229",
|
47 |
"Claude Opus": "claude-3-opus-20240229",
|
@@ -56,7 +56,7 @@ def ask_llm(query, input, client_index):
|
|
56 |
return response.content[0].text
|
57 |
|
58 |
elif client_index == "Groq (mixtral)":
|
59 |
-
client = Groq(api_key=os.environ[
|
60 |
chat_completion = client.chat.completions.create(
|
61 |
messages=messages,
|
62 |
model='mixtral-8x7b-32768',
|
|
|
10 |
|
11 |
#users = ['maksG', 'AlmaA', 'YchK']
|
12 |
|
13 |
+
def ask_llm(query, user_input, client_index, user):
|
14 |
messages = [
|
15 |
{
|
16 |
"role": "system",
|
|
|
18 |
},
|
19 |
{
|
20 |
"role": "user",
|
21 |
+
"content": user_input,
|
22 |
}
|
23 |
]
|
24 |
|
|
|
27 |
"role": "user",
|
28 |
"content": [{
|
29 |
"type": "text",
|
30 |
+
"text": user_input
|
31 |
}]
|
32 |
}]
|
33 |
|
34 |
if "Mistral" in client_index:
|
35 |
+
client = MistralClient(api_key=os.environ[user['api_keys']['mistral']])
|
36 |
model_map = {
|
37 |
"Mistral Tiny": "mistral-tiny",
|
38 |
"Mistral Small": "mistral-small-latest",
|
|
|
41 |
chat_completion = client.chat(messages=messages, model=model_map[client_index])
|
42 |
|
43 |
elif "Claude" in client_index:
|
44 |
+
client = anthropic.Anthropic(api_key=os.environ[user['api_keys']['claude']])
|
45 |
model_map = {
|
46 |
"Claude Sonnet": "claude-3-sonnet-20240229",
|
47 |
"Claude Opus": "claude-3-opus-20240229",
|
|
|
56 |
return response.content[0].text
|
57 |
|
58 |
elif client_index == "Groq (mixtral)":
|
59 |
+
client = Groq(api_key=os.environ[user['api_keys']['groq']])
|
60 |
chat_completion = client.chat.completions.create(
|
61 |
messages=messages,
|
62 |
model='mixtral-8x7b-32768',
|