diff --git a/scene_search/captioner.py b/scene_search/captioner.py index 976e8d7..99dba2f 100644 --- a/scene_search/captioner.py +++ b/scene_search/captioner.py @@ -56,8 +56,15 @@ class OllamaCaptioner: self.max_tokens = max_tokens self.session = requests.Session() - def caption(self, image_path: Path) -> str: + def caption(self, image_path: Path, context_hint: str | None = None) -> str: image_b64 = base64.b64encode(image_path.read_bytes()).decode("ascii") + prompt = self.prompt + if context_hint: + prompt = ( + f"{prompt}\n\nMetadata context for this video: {context_hint}\n" + "Use this only as a vocabulary/context hint. Do not claim a tagged " + "detail is visible unless it is actually visible in the frame." + ) response = self.session.post( f"{self.url}/api/chat", json={ @@ -66,7 +73,7 @@ class OllamaCaptioner: "messages": [ { "role": "user", - "content": self.prompt, + "content": prompt, "images": [image_b64], } ],