Compare commits

...

3 Commits

Author SHA1 Message Date
Nicolas Mowen
4cdea4b93d Docs 2026-01-12 20:22:35 -07:00
Nicolas Mowen
5b08dcb197 Add option to set runtime options for LLM providers 2026-01-12 20:22:35 -07:00
Josh Hawkins
4f331b4f5e push empty go2rtc config to avoid homekit error in log 2026-01-12 18:10:18 -06:00
8 changed files with 24 additions and 5 deletions

View File

@ -54,8 +54,8 @@ function setup_homekit_config() {
local config_path="$1"
if [[ ! -f "${config_path}" ]]; then
echo "[INFO] Creating empty HomeKit config file..."
echo 'homekit: {}' > "${config_path}"
echo "[INFO] Creating empty config file for HomeKit..."
echo '{}' > "${config_path}"
fi
# Convert YAML to JSON for jq processing

View File

@ -696,6 +696,9 @@ genai:
# Optional additional args to pass to the GenAI Provider (default: None)
provider_options:
keep_alive: -1
# Optional: Options to pass during inference calls (default: {})
runtime_options:
temperature: 0.7
# Optional: Configuration for audio transcription
# NOTE: only the enabled option can be overridden at the camera level

View File

@ -26,3 +26,6 @@ class GenAIConfig(FrigateBaseModel):
provider_options: dict[str, Any] = Field(
default={}, title="GenAI Provider extra options."
)
runtime_options: dict[str, Any] = Field(
default={}, title="Options to pass during inference calls."
)

View File

@ -64,6 +64,7 @@ class OpenAIClient(GenAIClient):
},
],
timeout=self.timeout,
**self.genai_config.runtime_options,
)
except Exception as e:
logger.warning("Azure OpenAI returned an error: %s", str(e))

View File

@ -35,10 +35,14 @@ class GeminiClient(GenAIClient):
for img in images
] + [prompt]
try:
# Merge runtime_options into generation_config if provided
generation_config_dict = {"candidate_count": 1}
generation_config_dict.update(self.genai_config.runtime_options)
response = self.provider.generate_content(
data,
generation_config=genai.types.GenerationConfig(
candidate_count=1,
**generation_config_dict
),
request_options=genai.types.RequestOptions(
timeout=self.timeout,

View File

@ -58,11 +58,15 @@ class OllamaClient(GenAIClient):
)
return None
try:
ollama_options = {
**self.provider_options,
**self.genai_config.runtime_options,
}
result = self.provider.generate(
self.genai_config.model,
prompt,
images=images if images else None,
**self.provider_options,
**ollama_options,
)
logger.debug(
f"Ollama tokens used: eval_count={result.get('eval_count')}, prompt_eval_count={result.get('prompt_eval_count')}"

View File

@ -61,6 +61,7 @@ class OpenAIClient(GenAIClient):
},
],
timeout=self.timeout,
**self.genai_config.runtime_options,
)
if (
result is not None

View File

@ -15,6 +15,9 @@
},
"provider_options": {
"label": "GenAI Provider extra options."
},
"runtime_options": {
"label": "Options to pass during inference calls."
}
}
}
}