mirror of
https://github.com/Ladebeze66/llm_lab.git
synced 2025-12-13 10:46:50 +01:00
25 lines
818 B
Python
25 lines
818 B
Python
from core.mistral7b import Mistral7B
|
|
from core.llama_vision90b import LlamaVision90B
|
|
from core.mistral_api import MistralAPI
|
|
|
|
class LLMFactory:
|
|
"""
|
|
Factory pour créer des instances de modèles LLM dynamiquement en fonction d'un identifiant text
|
|
"""
|
|
_registry = {
|
|
"mistral7b": Mistral7B,
|
|
"llamavision": LlamaVision90B,
|
|
"mistralapi": MistralAPI,
|
|
# Ajouter d'autres modèles LLM ici
|
|
}
|
|
|
|
@staticmethod
|
|
def create(model_name: str):
|
|
"""
|
|
Crée une instance d'un modèle LLM en fonction de l'identifiant textuel
|
|
"""
|
|
model_name = model_name.lower()
|
|
if model_name not in LLMFactory._registry:
|
|
raise ValueError(f"Modèle LLM non supporté: {model_name}")
|
|
return LLMFactory._registry[model_name]()
|
|
|