From 31bc7ef003a5ccfbe9536d52c8eb8c4fb0077aad Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Mon, 30 Mar 2026 08:13:36 -0500 Subject: [PATCH] coerce semantic search model string to enum Built-in model names (jinav1, jinav2) get converted to the enum, genai provider names that don't match stay as plain strings and follow the existing validation path --- frigate/config/classification.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/frigate/config/classification.py b/frigate/config/classification.py index e507a7817..48c140974 100644 --- a/frigate/config/classification.py +++ b/frigate/config/classification.py @@ -1,7 +1,7 @@ from enum import Enum from typing import Dict, List, Optional, Union -from pydantic import ConfigDict, Field +from pydantic import ConfigDict, Field, field_validator from .base import FrigateBaseModel @@ -178,6 +178,16 @@ class SemanticSearchConfig(FrigateBaseModel): title="Semantic search model or GenAI provider name", description="The embeddings model to use for semantic search (for example 'jinav1'), or the name of a GenAI provider with the embeddings role.", ) + + @field_validator("model", mode="before") + @classmethod + def coerce_model_enum(cls, v): + if isinstance(v, str): + try: + return SemanticSearchModelEnum(v) + except ValueError: + return v + return v model_size: str = Field( default="small", title="Model size",