msradam commited on
Commit
f4632b7
·
verified ·
1 Parent(s): 7859ba2

fix: conditional Ollama timeout — 5s when vLLM primary, 240s otherwise

Browse files
Files changed (1) hide show
  1. 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
- # 5s: fail fast so callers (mellea probe loop) aren't blocked waiting
101
- # for an Ollama that doesn't exist in the vLLM-primary HF Space.
102
- _ollama_timeout = 5
 
 
 
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: