Don't default to openai

This commit is contained in:
Nicolas Mowen 2025-08-11 11:05:24 -06:00
parent 6678d167f4
commit cfb540e7e2
2 changed files with 8 additions and 4 deletions

View File

@ -22,6 +22,6 @@ class GenAIConfig(FrigateBaseModel):
api_key: Optional[EnvString] = Field(default=None, title="Provider API key.")
base_url: Optional[str] = Field(default=None, title="Provider base url.")
model: str = Field(default="gpt-4o", title="GenAI model.")
provider: GenAIProviderEnum = Field(
default=GenAIProviderEnum.openai, title="GenAI provider."
provider: GenAIProviderEnum | None = Field(
default=None, title="GenAI provider."
)

View File

@ -1,5 +1,6 @@
"""Generative AI module for Frigate."""
import datetime
import importlib
import logging
import os
@ -47,9 +48,9 @@ class GenAIClient:
- Including **reasonable, evidence-based inferences** about the likely activity or context, but only if directly supported by visible details.
When forming your description:
- **Facts first**: Describe the physical setting, people, and objects exactly as seen.
- **Facts first**: Describe the time, physical setting, people, and objects exactly as seen.
- **Then context**: Briefly note plausible purposes or activities (e.g., appears to be delivering a package if carrying a box to a door).
- Clearly separate certain facts (A person is holding a ladder) from reasonable inferences (likely performing maintenance).
- Clearly separate certain facts (A person is holding an object with horizontal rungs) from reasonable inferences (likely a ladder).
- Do not speculate beyond what is visible, and do not imply hostility, criminal intent, or other strong judgments unless there is unambiguous visual evidence.
Here is information already known:
@ -116,6 +117,9 @@ class GenAIClient:
def get_genai_client(config: FrigateConfig) -> Optional[GenAIClient]:
"""Get the GenAI client."""
if not config.genai.provider:
return None
load_providers()
provider = PROVIDERS.get(config.genai.provider)
if provider: