Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -379,16 +379,14 @@ C. ACGME 總結
|
|
| 379 |
{"role": "system", "content": SCORING_SYSTEM_PROMPT},
|
| 380 |
{"role": "user", "content": prompt},
|
| 381 |
],
|
| 382 |
-
"temperature":
|
| 383 |
"top_p": 0.95,
|
| 384 |
-
"max_tokens":
|
| 385 |
"stream": False,
|
| 386 |
"chat_template_kwargs": {
|
| 387 |
"enable_thinking": True
|
| 388 |
-
}
|
| 389 |
-
"reasoning_budget": 4096
|
| 390 |
}
|
| 391 |
-
|
| 392 |
response = requests.post(
|
| 393 |
NIM_API_URL,
|
| 394 |
headers=headers,
|
|
@@ -406,7 +404,11 @@ C. ACGME 總結
|
|
| 406 |
SCORE_CACHE[cache_key] = result
|
| 407 |
|
| 408 |
return result
|
| 409 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 410 |
except Exception as e:
|
| 411 |
return f"【模型呼叫或解析回應失敗】{e}"
|
| 412 |
|
|
|
|
| 379 |
{"role": "system", "content": SCORING_SYSTEM_PROMPT},
|
| 380 |
{"role": "user", "content": prompt},
|
| 381 |
],
|
| 382 |
+
"temperature": 1.0,
|
| 383 |
"top_p": 0.95,
|
| 384 |
+
"max_tokens": 16384,
|
| 385 |
"stream": False,
|
| 386 |
"chat_template_kwargs": {
|
| 387 |
"enable_thinking": True
|
| 388 |
+
}
|
|
|
|
| 389 |
}
|
|
|
|
| 390 |
response = requests.post(
|
| 391 |
NIM_API_URL,
|
| 392 |
headers=headers,
|
|
|
|
| 404 |
SCORE_CACHE[cache_key] = result
|
| 405 |
|
| 406 |
return result
|
| 407 |
+
except requests.exceptions.HTTPError as e:
|
| 408 |
+
return (
|
| 409 |
+
f"【NVIDIA NIM API 錯誤】"
|
| 410 |
+
f"{e.response.status_code}: {e.response.text}"
|
| 411 |
+
)
|
| 412 |
except Exception as e:
|
| 413 |
return f"【模型呼叫或解析回應失敗】{e}"
|
| 414 |
|