in code/embedding-function/utilities/helpers/embedders/push_embedder.py [0:0]
def __generate_image_caption(self, source_url):
logger.info(f"Generating image caption for URL: {source_url}")
model = self.env_helper.AZURE_OPENAI_VISION_MODEL
caption_system_message = """You are an assistant that generates rich descriptions of images.
You need to be accurate in the information you extract and detailed in the descriptons you generate.
Do not abbreviate anything and do not shorten sentances. Explain the image completely.
If you are provided with an image of a flow chart, describe the flow chart in detail.
If the image is mostly text, use OCR to extract the text as it is displayed in the image."""
messages = [
{"role": "system", "content": caption_system_message},
{
"role": "user",
"content": [
{
"text": "Describe this image in detail. Limit the response to 500 words.",
"type": "text",
},
{"image_url": {"url": source_url}, "type": "image_url"},
],
},
]
response = self.llm_helper.get_chat_completion(messages, model)
caption = response.choices[0].message.content
logger.info("Caption generation completed")
return caption