mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-10-10 00:32:48 +03:00
Allow GenAI providers to be initialized lazily (#23482)
CI / AMD64 Build (push) Waiting to run
CI / ARM Build (push) Waiting to run
CI / Jetson Jetpack 6 (push) Waiting to run
CI / AMD64 Extra Build (push) Blocked by required conditions
CI / ARM Extra Build (push) Blocked by required conditions
CI / Assemble and push default build (push) Blocked by required conditions
CI / Synaptics Build (push) Blocked by required conditions
CI / AMD64 Build (push) Waiting to run
CI / ARM Build (push) Waiting to run
CI / Jetson Jetpack 6 (push) Waiting to run
CI / AMD64 Extra Build (push) Blocked by required conditions
CI / ARM Extra Build (push) Blocked by required conditions
CI / Assemble and push default build (push) Blocked by required conditions
CI / Synaptics Build (push) Blocked by required conditions
* allow GenAI providers to be initialized even if they failed on previous attempts * mypy
This commit is contained in:
@@ -62,7 +62,9 @@ class GenAIClientManager:
|
||||
def _get_client(self, name: str) -> "Optional[GenAIClient]":
|
||||
"""Return the client for *name*, creating it on first access."""
|
||||
if name in self._clients:
|
||||
return self._clients[name]
|
||||
client = self._clients[name]
|
||||
client.ensure_provider()
|
||||
return client
|
||||
|
||||
from frigate.genai import PROVIDERS
|
||||
|
||||
@@ -78,7 +80,7 @@ class GenAIClientManager:
|
||||
return None
|
||||
|
||||
try:
|
||||
client: "GenAIClient" = provider_cls(genai_cfg)
|
||||
client = provider_cls(genai_cfg)
|
||||
except Exception as e:
|
||||
logger.exception(
|
||||
"Failed to create GenAI client for provider %s: %s",
|
||||
|
||||
Reference in New Issue
Block a user