Spaces:
Running
Running
Commit ·
1f652e8
1
Parent(s): 2cd9b1c
ok
Browse files- app/api/v1/chat.py +6 -7
app/api/v1/chat.py
CHANGED
|
@@ -38,13 +38,12 @@ async def create_chat_completion(
|
|
| 38 |
if msg["role"] not in ("system", "user", "assistant"):
|
| 39 |
raise HTTPException(status_code=400, detail=f"Invalid role '{msg['role']}'. Must be system, user, or assistant")
|
| 40 |
|
| 41 |
-
model: Any = body.get("model")
|
| 42 |
-
if model
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
)
|
| 48 |
|
| 49 |
provider: Any = body.get("provider")
|
| 50 |
if provider is not None:
|
|
|
|
| 38 |
if msg["role"] not in ("system", "user", "assistant"):
|
| 39 |
raise HTTPException(status_code=400, detail=f"Invalid role '{msg['role']}'. Must be system, user, or assistant")
|
| 40 |
|
| 41 |
+
model: Any = body.get("model", "agentdeck-1.0")
|
| 42 |
+
if not isinstance(model, str) or model not in VALID_MODELS:
|
| 43 |
+
raise HTTPException(
|
| 44 |
+
status_code=400,
|
| 45 |
+
detail=f"Invalid model '{model}'. Must be one of: {', '.join(VALID_MODELS)}",
|
| 46 |
+
)
|
|
|
|
| 47 |
|
| 48 |
provider: Any = body.get("provider")
|
| 49 |
if provider is not None:
|