from abc import ABC, abstractmethod from typing import List, Dict, Any, Optional class BaseAgent(ABC): """ Classe de base pour les agents. """ def __init__(self, nom: str, llm: Any): self.nom = nom self.llm = llm self.historique: List[Dict[str, Any]] = [] def ajouter_historique(self, action: str, input_data: Any, output_data: Any): # Ajouter les informations sur le modèle et les paramètres utilisés metadata = { "model": getattr(self.llm, "modele", str(type(self.llm))), "duree_traitement": str(getattr(self.llm, "dureeTraitement", "N/A")) } self.historique.append({ "action": action, "input": input_data, "output": output_data, "metadata": metadata }) @abstractmethod def executer(self, *args, **kwargs) -> Any: pass