llm_ticket3/agents/agent_image_analyser.py
2025-04-06 15:02:20 +02:00

15 lines
665 B
Python

from .base_agent import BaseAgent
from typing import Any
class AgentImageAnalyser(BaseAgent):
"""
Agent pour analyser les images et extraire les informations pertinentes.
"""
def __init__(self, llm):
super().__init__("AgentImageAnalyser", llm)
def executer(self, image_description: str, contexte: str) -> str:
prompt = f"Analyse cette image en tenant compte du contexte suivant : {contexte}. Description de l'image : {image_description}"
response = self.llm.interroger(prompt)
self.ajouter_historique("analyse_image", {"image": image_description, "contexte": contexte}, response)
return response