mirror of
https://github.com/Ladebeze66/llm_ticket3.git
synced 2025-12-15 22:06:50 +01:00
30 lines
920 B
Python
30 lines
920 B
Python
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
|