llm_lab/tests/test_llama_vision90b.py
2025-03-26 15:02:58 +01:00

45 lines
1.8 KiB
Python

from core.factory import LLMFactory
from agents.roles import AGENTS
import sys
import os
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
# Cas d'utilisation 1: ANalyse d'une image seule (ex: capture d'erreur)
# Objectif FR: Demander au modèle ce que montre l'image pour vérifier sa compréhension visuelle.
model = LLMFactory.create("llamavision")
role = "diagnostic_assistant"
model.set_role(role, AGENTS[role])
response_en, response_fr = model.generate(
user_prompt="What do you see in the attached screenshot? Describe the main elements.",
images=["path"]
translate=True
)
print("[EN]", response_en)
print("[FR]", response_fr)
# Cas d'utilisation 2: Vérification de résolution d'un ticket avec image
# Objectif FR: Demander si le ticket semble résolu en se basant sur l'image et le fil de discussion.
role = "resolution_checker"
model.set_role(role, AGENTS[role])
response_en, response_fr = model.generate(
user_prompt="Based on the ticket and the attached image, has the issue been resolved? Explain why.",
images=["path"],
translate=True
)
print("[EN]", response_en)
print("[FR]", response_fr)
# Cas d'utilisation 3 : Analyse complète du ticket (JSON + image)
# Objectif FR : Résumer problème, cause probable et solution dans un format structuré.
role = "support_analyzer"
model.set_role(role, AGENTS[role])
response_en, response_fr = model.generate(
user_prompt="Analyze the support conversation and the image. Summarize the problem, the likely cause, and the solution in JSON format.",
images=["images/ticket_context.png"],
translate=True
)
print("[EN]", response_en)
print("[FR]", response_fr)# Cas d'utilisation 3: Analyse d'un ticket avec image et fil de discussion
# Objectif FR: Résumer le problème, cause probable et solution.