2204-14:19

This commit is contained in:
Ladebeze66 2025-04-22 14:19:48 +02:00
parent 90484b71f7
commit baaee5cb32
2 changed files with 69 additions and 0 deletions

69
agent_factory_llama.py Normal file
View File

@ -0,0 +1,69 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Factory pour les agents LLM dédié exclusivement à Llama_vision.
Permet d'isoler les comportements spécifiques pour ce multimodal.
"""
import logging
import time
from typing import Dict, Any, Optional
from agents.llama_vision.agent_ticket_analyser import AgentTicketAnalyser
from agents.llama_vision.agent_image_sorter import AgentImageSorter
from agents.llama_vision.agent_image_analyser import AgentImageAnalyser
from agents.llama_vision.agent_report_generator import AgentReportGenerator
from llm_classes.llama_vision import LlamaVision
logger = logging.getLogger("AgentFactoryLlamaVision")
class AgentFactoryLlamaVision:
"""
Factory pour les agents LLM dédié à Llama_vision
"""
@staticmethod
def create_llm() -> LlamaVision:
logger.info("Initialisation du modèle llama_vision")
start_time = time.time()
model = LlamaVision()
init_time = time.time() - start_time
logger.info(f"Modèle llama_vision initialisé en {init_time:.2f} secondes")
return model
@staticmethod
def create_ticket_analyser(llm: LlamaVision) -> AgentTicketAnalyser:
logger.info("Création de l'agent de tickets (llama_vision)")
return AgentTicketAnalyser(llm)
@staticmethod
def create_image_sorter(llm: LlamaVision) -> AgentImageSorter:
logger.info("Création de l'agent de tri des images (llama_vision)")
return AgentImageSorter(llm)
@staticmethod
def create_image_analyser(llm: LlamaVision) -> AgentImageAnalyser:
logger.info("Création de l'agent d'analyse des images (llama_vision)")
return AgentImageAnalyser(llm)
@staticmethod
def create_report_generator(llm: LlamaVision) -> AgentReportGenerator:
logger.info("Création de l'agent de génération de rapports (llama_vision)")
return AgentReportGenerator(llm)
@staticmethod
def create_all_agents() -> Dict[str, Any]:
"""
Crée tous les agents nécessaires pour Llama_vision.
"""
llm = AgentFactoryLlamaVision.create_llm()
return {
"ticket_analyser": AgentFactoryLlamaVision.create_ticket_analyser(llm),
"image_sorter": AgentFactoryLlamaVision.create_image_sorter(llm),
"image_analyser": AgentFactoryLlamaVision.create_image_analyser(llm),
"report_generator": AgentFactoryLlamaVision.create_report_generator(llm)
}

0
main_llama.py Normal file
View File