mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-08-22 13:47:29 +02:00
Fix substitution on genai prompts (#14298)
This commit is contained in:
parent
1e1610671e
commit
48c60621b6
@ -259,7 +259,7 @@ class EmbeddingMaintainer(threading.Thread):
|
|||||||
camera_config = self.config.cameras[event.camera]
|
camera_config = self.config.cameras[event.camera]
|
||||||
|
|
||||||
description = self.genai_client.generate_description(
|
description = self.genai_client.generate_description(
|
||||||
camera_config, thumbnails, event.label
|
camera_config, thumbnails, event
|
||||||
)
|
)
|
||||||
|
|
||||||
if not description:
|
if not description:
|
||||||
|
@ -5,6 +5,7 @@ import os
|
|||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from frigate.config import CameraConfig, GenAIConfig, GenAIProviderEnum
|
from frigate.config import CameraConfig, GenAIConfig, GenAIProviderEnum
|
||||||
|
from frigate.models import Event
|
||||||
|
|
||||||
PROVIDERS = {}
|
PROVIDERS = {}
|
||||||
|
|
||||||
@ -31,12 +32,12 @@ class GenAIClient:
|
|||||||
self,
|
self,
|
||||||
camera_config: CameraConfig,
|
camera_config: CameraConfig,
|
||||||
thumbnails: list[bytes],
|
thumbnails: list[bytes],
|
||||||
label: str,
|
event: Event,
|
||||||
) -> Optional[str]:
|
) -> Optional[str]:
|
||||||
"""Generate a description for the frame."""
|
"""Generate a description for the frame."""
|
||||||
prompt = camera_config.genai.object_prompts.get(
|
prompt = camera_config.genai.object_prompts.get(
|
||||||
label, camera_config.genai.prompt
|
event.label, camera_config.genai.prompt
|
||||||
).format(label=label)
|
).format(**event)
|
||||||
return self._send(prompt, thumbnails)
|
return self._send(prompt, thumbnails)
|
||||||
|
|
||||||
def _init_provider(self):
|
def _init_provider(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user