Spaces:
Running
Running
Update utils/llms.py
Browse files- utils/llms.py +18 -3
utils/llms.py
CHANGED
@@ -12,10 +12,10 @@ groq_api_keys=json.loads(os.environ.get("GROQ_API_KEYS"))
|
|
12 |
chutes_key=os.environ.get("CHUTES_API_KEY")
|
13 |
github_key=os.environ.get("GITHUB_API_KEY")
|
14 |
|
15 |
-
DeepInfraChat.models = ["google/gemma-3-27b-it","deepseek-ai/DeepSeek-R1-Turbo","Qwen/QwQ-32B","deepseek-ai/DeepSeek-R1","deepseek-ai/DeepSeek-V3-0324","meta-llama/Llama-4-Maverick-17B-128E-Instruct-FP8","meta-llama/Llama-4-Scout-17B-16E-Instruct","microsoft/Phi-4-multimodal-instruct"]
|
16 |
|
17 |
deepinframodels=["meta-llama/Llama-4-Maverick-17B-128E-Instruct-FP8","microsoft/Phi-4-multimodal-instruct","google/gemma-3-27b-it","meta-llama/Llama-4-Scout-17B-16E-Instruct"]
|
18 |
-
chutes_models={"MAI-DS-R1-FP8":"microsoft/MAI-DS-R1-FP8","DeepSeek-V3-0324":"deepseek-ai/DeepSeek-V3-0324","deepseek-reasoner":"deepseek-ai/DeepSeek-R1","GLM-4-32B-0414":"THUDM/GLM-4-32B-0414","GLM-Z1-32B-0414":"THUDM/GLM-Z1-32B-0414","DeepSeek-R1T-Chimera":"tngtech/DeepSeek-R1T-Chimera", "DeepSeek-R1-Zero":"deepseek-ai/DeepSeek-R1-Zero"
|
19 |
github_models={"gpt4.1":"gpt-4.1","gpt-4o":"gpt-4o","o4-mini":"o4-mini"}
|
20 |
|
21 |
REASONING_CORRESPONDANCE = {"DeepSeek-R1-Glider":Glider, "DeepSeekR1-LAMBDA":LambdaChat,"DeepSeekR1":DeepInfraChat,"deepseek-slow":TypeGPT}
|
@@ -66,7 +66,22 @@ def chatstream(messages,model,api_keys):
|
|
66 |
except Exception as e:
|
67 |
pass
|
68 |
yield ("RESULT: "+cunk)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
elif model == "DeepSeekR1-togetherAI":
|
71 |
response = completion(model="together_ai/deepseek-ai/DeepSeek-R1", messages=messages, stream=True)
|
72 |
|
@@ -260,4 +275,4 @@ def chatstream(messages,model,api_keys):
|
|
260 |
except Exception as e:
|
261 |
pass
|
262 |
print("STOPPING")
|
263 |
-
yield("RESULT: "+cunk)
|
|
|
12 |
chutes_key=os.environ.get("CHUTES_API_KEY")
|
13 |
github_key=os.environ.get("GITHUB_API_KEY")
|
14 |
|
15 |
+
DeepInfraChat.models = ["Qwen/Qwen3-235B-A22B","Qwen/Qwen3-30B-A3B","Qwen/Qwen3-32B","google/gemma-3-27b-it","deepseek-ai/DeepSeek-R1-Turbo","Qwen/QwQ-32B","deepseek-ai/DeepSeek-R1","deepseek-ai/DeepSeek-V3-0324","meta-llama/Llama-4-Maverick-17B-128E-Instruct-FP8","meta-llama/Llama-4-Scout-17B-16E-Instruct","microsoft/Phi-4-multimodal-instruct"]
|
16 |
|
17 |
deepinframodels=["meta-llama/Llama-4-Maverick-17B-128E-Instruct-FP8","microsoft/Phi-4-multimodal-instruct","google/gemma-3-27b-it","meta-llama/Llama-4-Scout-17B-16E-Instruct"]
|
18 |
+
chutes_models={"Qwen3-235B":"Qwen/Qwen3-235B-A22B","MAI-DS-R1-FP8":"microsoft/MAI-DS-R1-FP8","DeepSeek-V3-0324":"deepseek-ai/DeepSeek-V3-0324","deepseek-reasoner":"deepseek-ai/DeepSeek-R1","GLM-4-32B-0414":"THUDM/GLM-4-32B-0414","GLM-Z1-32B-0414":"THUDM/GLM-Z1-32B-0414","DeepSeek-R1T-Chimera":"tngtech/DeepSeek-R1T-Chimera", "DeepSeek-R1-Zero":"deepseek-ai/DeepSeek-R1-Zero"}
|
19 |
github_models={"gpt4.1":"gpt-4.1","gpt-4o":"gpt-4o","o4-mini":"o4-mini"}
|
20 |
|
21 |
REASONING_CORRESPONDANCE = {"DeepSeek-R1-Glider":Glider, "DeepSeekR1-LAMBDA":LambdaChat,"DeepSeekR1":DeepInfraChat,"deepseek-slow":TypeGPT}
|
|
|
66 |
except Exception as e:
|
67 |
pass
|
68 |
yield ("RESULT: "+cunk)
|
69 |
+
elif model == "Qwen3-235B-A22B" or model == "Qwen3-30B-A3B" or model == "Qwen3-32B":
|
70 |
+
try:
|
71 |
+
response = client.chat.completions.create(
|
72 |
+
provider=DeepInfraChat,
|
73 |
+
model=f"Qwen/{model}",
|
74 |
+
messages=messages,
|
75 |
+
stream=True
|
76 |
|
77 |
+
)
|
78 |
+
for part in response:
|
79 |
+
cunk=cunk+(part.choices[0].delta.content or "")
|
80 |
+
if "```json" not in cunk or "```" not in cunk:
|
81 |
+
yield (part.choices[0].delta.content or "")
|
82 |
+
except Exception as e:
|
83 |
+
pass
|
84 |
+
yield ("RESULT: "+cunk)
|
85 |
elif model == "DeepSeekR1-togetherAI":
|
86 |
response = completion(model="together_ai/deepseek-ai/DeepSeek-R1", messages=messages, stream=True)
|
87 |
|
|
|
275 |
except Exception as e:
|
276 |
pass
|
277 |
print("STOPPING")
|
278 |
+
yield("RESULT: "+cunk)
|