mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-05-09 15:05:26 +03:00
Compare commits
3 Commits
6aafa0c6f9
...
4cdea4b93d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4cdea4b93d | ||
|
|
5b08dcb197 | ||
|
|
4f331b4f5e |
@ -54,8 +54,8 @@ function setup_homekit_config() {
|
|||||||
local config_path="$1"
|
local config_path="$1"
|
||||||
|
|
||||||
if [[ ! -f "${config_path}" ]]; then
|
if [[ ! -f "${config_path}" ]]; then
|
||||||
echo "[INFO] Creating empty HomeKit config file..."
|
echo "[INFO] Creating empty config file for HomeKit..."
|
||||||
echo 'homekit: {}' > "${config_path}"
|
echo '{}' > "${config_path}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Convert YAML to JSON for jq processing
|
# Convert YAML to JSON for jq processing
|
||||||
|
|||||||
@ -696,6 +696,9 @@ genai:
|
|||||||
# Optional additional args to pass to the GenAI Provider (default: None)
|
# Optional additional args to pass to the GenAI Provider (default: None)
|
||||||
provider_options:
|
provider_options:
|
||||||
keep_alive: -1
|
keep_alive: -1
|
||||||
|
# Optional: Options to pass during inference calls (default: {})
|
||||||
|
runtime_options:
|
||||||
|
temperature: 0.7
|
||||||
|
|
||||||
# Optional: Configuration for audio transcription
|
# Optional: Configuration for audio transcription
|
||||||
# NOTE: only the enabled option can be overridden at the camera level
|
# NOTE: only the enabled option can be overridden at the camera level
|
||||||
|
|||||||
@ -26,3 +26,6 @@ class GenAIConfig(FrigateBaseModel):
|
|||||||
provider_options: dict[str, Any] = Field(
|
provider_options: dict[str, Any] = Field(
|
||||||
default={}, title="GenAI Provider extra options."
|
default={}, title="GenAI Provider extra options."
|
||||||
)
|
)
|
||||||
|
runtime_options: dict[str, Any] = Field(
|
||||||
|
default={}, title="Options to pass during inference calls."
|
||||||
|
)
|
||||||
|
|||||||
@ -64,6 +64,7 @@ class OpenAIClient(GenAIClient):
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
timeout=self.timeout,
|
timeout=self.timeout,
|
||||||
|
**self.genai_config.runtime_options,
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning("Azure OpenAI returned an error: %s", str(e))
|
logger.warning("Azure OpenAI returned an error: %s", str(e))
|
||||||
|
|||||||
@ -35,10 +35,14 @@ class GeminiClient(GenAIClient):
|
|||||||
for img in images
|
for img in images
|
||||||
] + [prompt]
|
] + [prompt]
|
||||||
try:
|
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(
|
response = self.provider.generate_content(
|
||||||
data,
|
data,
|
||||||
generation_config=genai.types.GenerationConfig(
|
generation_config=genai.types.GenerationConfig(
|
||||||
candidate_count=1,
|
**generation_config_dict
|
||||||
),
|
),
|
||||||
request_options=genai.types.RequestOptions(
|
request_options=genai.types.RequestOptions(
|
||||||
timeout=self.timeout,
|
timeout=self.timeout,
|
||||||
|
|||||||
@ -58,11 +58,15 @@ class OllamaClient(GenAIClient):
|
|||||||
)
|
)
|
||||||
return None
|
return None
|
||||||
try:
|
try:
|
||||||
|
ollama_options = {
|
||||||
|
**self.provider_options,
|
||||||
|
**self.genai_config.runtime_options,
|
||||||
|
}
|
||||||
result = self.provider.generate(
|
result = self.provider.generate(
|
||||||
self.genai_config.model,
|
self.genai_config.model,
|
||||||
prompt,
|
prompt,
|
||||||
images=images if images else None,
|
images=images if images else None,
|
||||||
**self.provider_options,
|
**ollama_options,
|
||||||
)
|
)
|
||||||
logger.debug(
|
logger.debug(
|
||||||
f"Ollama tokens used: eval_count={result.get('eval_count')}, prompt_eval_count={result.get('prompt_eval_count')}"
|
f"Ollama tokens used: eval_count={result.get('eval_count')}, prompt_eval_count={result.get('prompt_eval_count')}"
|
||||||
|
|||||||
@ -61,6 +61,7 @@ class OpenAIClient(GenAIClient):
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
timeout=self.timeout,
|
timeout=self.timeout,
|
||||||
|
**self.genai_config.runtime_options,
|
||||||
)
|
)
|
||||||
if (
|
if (
|
||||||
result is not None
|
result is not None
|
||||||
|
|||||||
@ -15,6 +15,9 @@
|
|||||||
},
|
},
|
||||||
"provider_options": {
|
"provider_options": {
|
||||||
"label": "GenAI Provider extra options."
|
"label": "GenAI Provider extra options."
|
||||||
|
},
|
||||||
|
"runtime_options": {
|
||||||
|
"label": "Options to pass during inference calls."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user