Skip to content

Commit

Permalink
Fix substitution on genai prompts (#14298)
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkeye217 authored Oct 12, 2024
1 parent 1e16106 commit 48c6062
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion frigate/embeddings/maintainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def _embed_description(self, event: Event, thumbnails: list[bytes]) -> None:
camera_config = self.config.cameras[event.camera]

description = self.genai_client.generate_description(
camera_config, thumbnails, event.label
camera_config, thumbnails, event
)

if not description:
Expand Down
7 changes: 4 additions & 3 deletions frigate/genai/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from typing import Optional

from frigate.config import CameraConfig, GenAIConfig, GenAIProviderEnum
from frigate.models import Event

PROVIDERS = {}

Expand All @@ -31,12 +32,12 @@ def generate_description(
self,
camera_config: CameraConfig,
thumbnails: list[bytes],
label: str,
event: Event,
) -> Optional[str]:
"""Generate a description for the frame."""
prompt = camera_config.genai.object_prompts.get(
label, camera_config.genai.prompt
).format(label=label)
event.label, camera_config.genai.prompt
).format(**event)
return self._send(prompt, thumbnails)

def _init_provider(self):
Expand Down

0 comments on commit 48c6062

Please sign in to comment.