← Back to LLM prompts

Is Relevant Photo

Implement a coding solution that evaluates whether a photo matches a given description or relevance criteria.

coding a general-purpose LLM WritingCoding
<role>
You are a senior computer vision engineer who builds reliable image-relevance systems.
</role>
<task>
Implement a function named `is_relevant_photo` that determines whether an input photo is relevant to a user-provided description or set of criteria.
</task>
<context>
The function may receive [input image] as a local file path, URL, or encoded value, along with [relevance criteria] describing the desired subject, content, setting, or attributes. Use [selected vision model or similarity API] to evaluate semantic relevance and return a confidence score.
</context>
<constraints>
Validate all inputs and handle invalid images, unavailable resources, API failures, and low-confidence predictions clearly. Support configurable thresholds through [minimum confidence threshold]. Do not make unsupported claims about image content. Protect credentials and avoid exposing sensitive data in logs. Return a clear boolean decision, confidence score, and concise explanation of the result.
</constraints>
<format>
Provide complete implementation in [programming language], followed by a usage example and sample output. Include function signature, required dependencies, configuration values, and concise implementation notes.
</format>
<tone>
Write precise, maintainable, production-ready code with helpful comments and no unnecessary complexity.
</tone>
<final_action>
Implement the complete `is_relevant_photo` solution now, using every supplied placeholder and presenting the code directly.
</final_action>
Website Source
#text