mirror of
https://github.com/Ladebeze66/llm_ticket3.git
synced 2025-12-16 00:16:51 +01:00
24 lines
1.0 KiB
Python
24 lines
1.0 KiB
Python
from .base_agent import BaseAgent
|
|
from typing import Any
|
|
import logging
|
|
|
|
logger = logging.getLogger("AgentImageAnalyser")
|
|
|
|
class AgentImageAnalyser(BaseAgent):
|
|
"""
|
|
Agent pour analyser les images et extraire les informations pertinentes.
|
|
"""
|
|
def __init__(self, llm):
|
|
super().__init__("AgentImageAnalyser", llm, "image_analyser")
|
|
logger.info("AgentImageAnalyser initialisé")
|
|
|
|
def executer(self, image_description: str, contexte: str) -> str:
|
|
logger.info(f"Analyse de l'image: {image_description} avec le contexte: {contexte}")
|
|
prompt = f"Analyse cette image en tenant compte du contexte suivant : {contexte}. Description de l'image : {image_description}"
|
|
|
|
logger.info("Envoi de la requête au LLM")
|
|
response = self.llm.interroger(prompt)
|
|
|
|
logger.info(f"Réponse reçue pour l'image {image_description}: {response[:100]}...")
|
|
self.ajouter_historique("analyse_image", {"image": image_description, "contexte": contexte}, response)
|
|
return response |