fix: conditional Ollama timeout — 5s when vLLM primary, 240s otherwise
Browse files- app/llm.py +6 -3
app/llm.py
CHANGED
|
@@ -97,9 +97,12 @@ def _build_router() -> Router:
|
|
| 97 |
# stream_timeout (per-chunk) stays tight since subsequent tokens are fast.
|
| 98 |
_vllm_first_token_timeout = int(
|
| 99 |
os.environ.get("RIPRAP_LITELLM_TIMEOUT_S", "360"))
|
| 100 |
-
#
|
| 101 |
-
#
|
| 102 |
-
|
|
|
|
|
|
|
|
|
|
| 103 |
|
| 104 |
for alias, (vllm_name, ollama_tag) in _LOGICAL.items():
|
| 105 |
if use_vllm:
|
|
|
|
| 97 |
# stream_timeout (per-chunk) stays tight since subsequent tokens are fast.
|
| 98 |
_vllm_first_token_timeout = int(
|
| 99 |
os.environ.get("RIPRAP_LITELLM_TIMEOUT_S", "360"))
|
| 100 |
+
# When vLLM is primary: Ollama fallback should fail fast so the mellea
|
| 101 |
+
# probe loop (not Ollama's timeout) controls retry timing.
|
| 102 |
+
# When Ollama is primary: use the full configured timeout (default 240s).
|
| 103 |
+
_ollama_timeout = int(os.environ.get(
|
| 104 |
+
"RIPRAP_OLLAMA_TIMEOUT_S",
|
| 105 |
+
"5" if use_vllm else "240"))
|
| 106 |
|
| 107 |
for alias, (vllm_name, ollama_tag) in _LOGICAL.items():
|
| 108 |
if use_vllm:
|