Skip to content

Commit 6b05a44

Browse files
authored
Refine image identification prompt for clarity and specificity (#6)
1 parent 6718ed2 commit 6b05a44

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

api/memoryalpha/rag.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -328,16 +328,15 @@ def search_image(self, image_path: str, top_k: int = 5,
328328

329329
# 6. Pass all info to the model, attach images
330330
prompt = (
331-
"You are an expert Star Trek analyst. Your task is to identify the user-provided image (attached as Image 0) as specifically as possible. "
332-
"Among the retrieved images and their metadata below, determine which image best matches Image 0. "
333-
"Use the metadata (image name, source page, description, similarity score, and text context) of the closest match to identify the user image. "
334-
"Do NOT mention the match number, just provide the identification. "
331+
"You are an expert Star Trek analyst. Look at the first attached image and determine which of the retrieved images below most closely matches it. "
332+
"Use the metadata (image name, source page, description, similarity score, and text context) of the closest match to identify what is shown. "
333+
"Provide a direct identification without mentioning image numbers, matches, or references to user images. "
335334
"If no close match is found, say so clearly.\n\n"
336335
)
337336
prompt += "\n".join(formatted_images)
338337
if text_contexts:
339338
prompt += "\n".join(text_contexts)
340-
prompt += "\nRespond with one or two lines identifying the user-provided image, based on the closest match and its metadata."
339+
prompt += "\nRespond with one or two lines directly identifying what is shown in the image, based on the closest match and its metadata."
341340

342341
messages = [
343342
{"role": "system", "content": "You are an expert Star Trek analyst."},

0 commit comments

Comments
 (0)