diff --git a/agent_factory_llama.py b/agent_factory_llama.py new file mode 100644 index 0000000..401ea9e --- /dev/null +++ b/agent_factory_llama.py @@ -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) + } + \ No newline at end of file diff --git a/main_llama.py b/main_llama.py new file mode 100644 index 0000000..e69de29