From 78b22d722e5ada0191843f027bef55f0c0558696 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Fri, 3 Apr 2026 15:32:54 -0600 Subject: [PATCH] Fallback and try llama-swap format --- frigate/genai/llama_cpp.py | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/frigate/genai/llama_cpp.py b/frigate/genai/llama_cpp.py index ed939d0c63..da69286846 100644 --- a/frigate/genai/llama_cpp.py +++ b/frigate/genai/llama_cpp.py @@ -101,15 +101,26 @@ class LlamaCppClient(GenAIClient): e, ) - # Query /props for context size, modalities, and tool support + # Query /props for context size, modalities, and tool support. + # The standard /props?model= endpoint works with llama-server. + # If it fails, try the llama-swap per-model passthrough endpoint which + # returns props for a specific model without requiring it to be loaded. try: - response = requests.get( - f"{base_url}/props", - params={"model": configured_model}, - timeout=10, - ) - response.raise_for_status() - props = response.json() + try: + response = requests.get( + f"{base_url}/props", + params={"model": configured_model}, + timeout=10, + ) + response.raise_for_status() + props = response.json() + except Exception: + response = requests.get( + f"{base_url}/upstream/{configured_model}/props", + timeout=10, + ) + response.raise_for_status() + props = response.json() # Context size from server runtime config default_settings = props.get("default_generation_settings", {})