Wilker commited on
Commit ·
fdffce3
1
Parent(s): b0bc4f5
feat: aumenta teto de max_tokens (16k→1M) e timeout de APIs (60s→600s)
Browse files
app.py
CHANGED
|
@@ -294,7 +294,7 @@ class ChatRequest(BaseModel):
|
|
| 294 |
web: Optional[bool] = Field(default=False, description="Usar busca web")
|
| 295 |
free_mode: Optional[bool] = Field(default=False, description="Modo livre - pula RAG e persona")
|
| 296 |
messages: List[Message] = Field(min_length=1, description="Lista de mensagens")
|
| 297 |
-
max_tokens: Optional[int] = Field(default=8192, ge=1, le=
|
| 298 |
temperature: Optional[float] = Field(default=0.7, ge=0.0, le=2.0, description="Temperatura de geração")
|
| 299 |
|
| 300 |
@field_validator("model")
|
|
@@ -599,7 +599,7 @@ def chat_completions(req: ChatRequest):
|
|
| 599 |
"https://api.kilo.ai/api/gateway/v1/chat/completions",
|
| 600 |
json=payload,
|
| 601 |
headers=headers,
|
| 602 |
-
timeout=
|
| 603 |
)
|
| 604 |
return resp
|
| 605 |
|
|
@@ -648,7 +648,7 @@ def chat_completions(req: ChatRequest):
|
|
| 648 |
"https://openrouter.ai/api/v1/chat/completions",
|
| 649 |
json=payload,
|
| 650 |
headers=headers,
|
| 651 |
-
timeout=
|
| 652 |
)
|
| 653 |
return resp
|
| 654 |
|
|
@@ -700,7 +700,7 @@ def chat_completions(req: ChatRequest):
|
|
| 700 |
"https://api.groq.com/openai/v1/chat/completions",
|
| 701 |
json=payload,
|
| 702 |
headers=headers,
|
| 703 |
-
timeout=
|
| 704 |
)
|
| 705 |
return resp
|
| 706 |
|
|
@@ -749,7 +749,7 @@ def chat_completions(req: ChatRequest):
|
|
| 749 |
"https://api.mistral.ai/v1/chat/completions",
|
| 750 |
json=payload,
|
| 751 |
headers=headers,
|
| 752 |
-
timeout=
|
| 753 |
)
|
| 754 |
return resp
|
| 755 |
|
|
@@ -800,7 +800,7 @@ def chat_completions(req: ChatRequest):
|
|
| 800 |
url,
|
| 801 |
json=gemini_payload,
|
| 802 |
headers={"Content-Type": "application/json"},
|
| 803 |
-
timeout=
|
| 804 |
)
|
| 805 |
return resp
|
| 806 |
|
|
|
|
| 294 |
web: Optional[bool] = Field(default=False, description="Usar busca web")
|
| 295 |
free_mode: Optional[bool] = Field(default=False, description="Modo livre - pula RAG e persona")
|
| 296 |
messages: List[Message] = Field(min_length=1, description="Lista de mensagens")
|
| 297 |
+
max_tokens: Optional[int] = Field(default=8192, ge=1, le=1000000, description="Máximo de tokens")
|
| 298 |
temperature: Optional[float] = Field(default=0.7, ge=0.0, le=2.0, description="Temperatura de geração")
|
| 299 |
|
| 300 |
@field_validator("model")
|
|
|
|
| 599 |
"https://api.kilo.ai/api/gateway/v1/chat/completions",
|
| 600 |
json=payload,
|
| 601 |
headers=headers,
|
| 602 |
+
timeout=600.0,
|
| 603 |
)
|
| 604 |
return resp
|
| 605 |
|
|
|
|
| 648 |
"https://openrouter.ai/api/v1/chat/completions",
|
| 649 |
json=payload,
|
| 650 |
headers=headers,
|
| 651 |
+
timeout=600.0,
|
| 652 |
)
|
| 653 |
return resp
|
| 654 |
|
|
|
|
| 700 |
"https://api.groq.com/openai/v1/chat/completions",
|
| 701 |
json=payload,
|
| 702 |
headers=headers,
|
| 703 |
+
timeout=600.0,
|
| 704 |
)
|
| 705 |
return resp
|
| 706 |
|
|
|
|
| 749 |
"https://api.mistral.ai/v1/chat/completions",
|
| 750 |
json=payload,
|
| 751 |
headers=headers,
|
| 752 |
+
timeout=600.0,
|
| 753 |
)
|
| 754 |
return resp
|
| 755 |
|
|
|
|
| 800 |
url,
|
| 801 |
json=gemini_payload,
|
| 802 |
headers={"Content-Type": "application/json"},
|
| 803 |
+
timeout=600.0,
|
| 804 |
)
|
| 805 |
return resp
|
| 806 |
|