Spaces:
Running
Running
Update gen.py
Browse files
gen.py
CHANGED
|
@@ -521,6 +521,8 @@ MODEL_MAP = {
|
|
| 521 |
"gpt-4o-mini": "OpenAI GPT 4o Mini",
|
| 522 |
"gpt-4.1": "OpenAI GPT 4.1",
|
| 523 |
"nemotron-3-super": "NVIDIA Nemotron 3 Super",
|
|
|
|
|
|
|
| 524 |
"openai/gpt-oss-120b": "OpenAI GPT-OSS 120B",
|
| 525 |
"openai/gpt-oss-20b": "OpenAI GPT-OSS 20B",
|
| 526 |
"qwen-3-235b-a22b-instruct-2507": "Qwen3 Instruct",
|
|
@@ -597,8 +599,8 @@ async def generate_text(
|
|
| 597 |
chosen_model = "nemotron-3-super"
|
| 598 |
provider = "navy"
|
| 599 |
elif score >= 4:
|
| 600 |
-
chosen_model = "
|
| 601 |
-
provider = "
|
| 602 |
else:
|
| 603 |
chosen_model = "openai/gpt-oss-20b"
|
| 604 |
provider = "groq"
|
|
@@ -610,11 +612,11 @@ async def generate_text(
|
|
| 610 |
provider = "navy"
|
| 611 |
|
| 612 |
elif score >= 4:
|
| 613 |
-
chosen_model = "
|
| 614 |
-
provider = "
|
| 615 |
|
| 616 |
elif score >= 4:
|
| 617 |
-
chosen_model = "
|
| 618 |
provider = "groq"
|
| 619 |
|
| 620 |
elif score >= 6:
|
|
@@ -624,8 +626,8 @@ async def generate_text(
|
|
| 624 |
if provider == "groq" and (
|
| 625 |
total_chars > MAX_GROQ_PROMPT_CHARS or total_bytes > MAX_GROQ_PROMPT_BYTES
|
| 626 |
):
|
| 627 |
-
provider = "
|
| 628 |
-
chosen_model = "gpt-
|
| 629 |
|
| 630 |
await check_chat_rate_limit(request, authorization, x_client_id)
|
| 631 |
|
|
@@ -883,12 +885,12 @@ async def analyze_prompt(
|
|
| 883 |
if kw in prompt_text:
|
| 884 |
score += 1
|
| 885 |
|
| 886 |
-
chosen_model = "llama-3.3-70b-
|
| 887 |
provider = "groq"
|
| 888 |
has_images = contains_images(messages)
|
| 889 |
|
| 890 |
if has_images:
|
| 891 |
-
chosen_model = "gpt-
|
| 892 |
provider = "navy vision"
|
| 893 |
else:
|
| 894 |
if score > 10:
|
|
@@ -898,8 +900,8 @@ async def analyze_prompt(
|
|
| 898 |
chosen_model = "nemotron-3-super"
|
| 899 |
provider = "navy"
|
| 900 |
elif score >= 4:
|
| 901 |
-
chosen_model = "
|
| 902 |
-
provider = "
|
| 903 |
else:
|
| 904 |
chosen_model = "openai/gpt-oss-20b"
|
| 905 |
provider = "groq"
|
|
@@ -911,11 +913,11 @@ async def analyze_prompt(
|
|
| 911 |
provider = "navy"
|
| 912 |
|
| 913 |
elif score >= 4:
|
| 914 |
-
chosen_model = "
|
| 915 |
-
provider = "
|
| 916 |
|
| 917 |
elif score >= 4:
|
| 918 |
-
chosen_model = "
|
| 919 |
provider = "groq"
|
| 920 |
|
| 921 |
elif score >= 6:
|
|
@@ -925,8 +927,8 @@ async def analyze_prompt(
|
|
| 925 |
if provider == "groq" and (
|
| 926 |
total_chars > MAX_GROQ_PROMPT_CHARS or total_bytes > MAX_GROQ_PROMPT_BYTES
|
| 927 |
):
|
| 928 |
-
provider = "
|
| 929 |
-
chosen_model = "gpt-
|
| 930 |
|
| 931 |
return { MODEL_MAP[chosen_model] }
|
| 932 |
|
|
|
|
| 521 |
"gpt-4o-mini": "OpenAI GPT 4o Mini",
|
| 522 |
"gpt-4.1": "OpenAI GPT 4.1",
|
| 523 |
"nemotron-3-super": "NVIDIA Nemotron 3 Super",
|
| 524 |
+
"gpt-oss-120b"; "OpenAI GPT-OSS 120B",
|
| 525 |
+
"zai-glm-4.7": "Z.AI GLM 4.7",
|
| 526 |
"openai/gpt-oss-120b": "OpenAI GPT-OSS 120B",
|
| 527 |
"openai/gpt-oss-20b": "OpenAI GPT-OSS 20B",
|
| 528 |
"qwen-3-235b-a22b-instruct-2507": "Qwen3 Instruct",
|
|
|
|
| 599 |
chosen_model = "nemotron-3-super"
|
| 600 |
provider = "navy"
|
| 601 |
elif score >= 4:
|
| 602 |
+
chosen_model = "gpt-oss-120b"
|
| 603 |
+
provider = "cerebras"
|
| 604 |
else:
|
| 605 |
chosen_model = "openai/gpt-oss-20b"
|
| 606 |
provider = "groq"
|
|
|
|
| 612 |
provider = "navy"
|
| 613 |
|
| 614 |
elif score >= 4:
|
| 615 |
+
chosen_model = "zai-glm-4.7"
|
| 616 |
+
provider = "cerebras"
|
| 617 |
|
| 618 |
elif score >= 4:
|
| 619 |
+
chosen_model = "openai/gpt-oss-120b"
|
| 620 |
provider = "groq"
|
| 621 |
|
| 622 |
elif score >= 6:
|
|
|
|
| 626 |
if provider == "groq" and (
|
| 627 |
total_chars > MAX_GROQ_PROMPT_CHARS or total_bytes > MAX_GROQ_PROMPT_BYTES
|
| 628 |
):
|
| 629 |
+
provider = "cerebras"
|
| 630 |
+
chosen_model = "gpt-oss-120b"
|
| 631 |
|
| 632 |
await check_chat_rate_limit(request, authorization, x_client_id)
|
| 633 |
|
|
|
|
| 885 |
if kw in prompt_text:
|
| 886 |
score += 1
|
| 887 |
|
| 888 |
+
chosen_model = "llama-3.3-70b-versatile"
|
| 889 |
provider = "groq"
|
| 890 |
has_images = contains_images(messages)
|
| 891 |
|
| 892 |
if has_images:
|
| 893 |
+
chosen_model = "gpt-4.1"
|
| 894 |
provider = "navy vision"
|
| 895 |
else:
|
| 896 |
if score > 10:
|
|
|
|
| 900 |
chosen_model = "nemotron-3-super"
|
| 901 |
provider = "navy"
|
| 902 |
elif score >= 4:
|
| 903 |
+
chosen_model = "gpt-oss-120b"
|
| 904 |
+
provider = "cerebras"
|
| 905 |
else:
|
| 906 |
chosen_model = "openai/gpt-oss-20b"
|
| 907 |
provider = "groq"
|
|
|
|
| 913 |
provider = "navy"
|
| 914 |
|
| 915 |
elif score >= 4:
|
| 916 |
+
chosen_model = "zai-glm-4.7"
|
| 917 |
+
provider = "cerebras"
|
| 918 |
|
| 919 |
elif score >= 4:
|
| 920 |
+
chosen_model = "openai/gpt-oss-120b"
|
| 921 |
provider = "groq"
|
| 922 |
|
| 923 |
elif score >= 6:
|
|
|
|
| 927 |
if provider == "groq" and (
|
| 928 |
total_chars > MAX_GROQ_PROMPT_CHARS or total_bytes > MAX_GROQ_PROMPT_BYTES
|
| 929 |
):
|
| 930 |
+
provider = "cerebras"
|
| 931 |
+
chosen_model = "gpt-oss-120b"
|
| 932 |
|
| 933 |
return { MODEL_MAP[chosen_model] }
|
| 934 |
|