You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Can CrewAI's agents process images and provide results based on them? I know that CrewAI uses GPT-4 Turbo, which can handle both text and images, but I'm not sure how to pass an image to the agent and get a result.
The text was updated successfully, but these errors were encountered:
I've used this function, and it worked well. (I'm using Gemini.)
class Vision: @tool("Doc Verification")
def vision(prompt: str, path: str):
"""
C'est un outil utilisé pour analyser les images en fonction d'une instruction à l'aide de Gemini.
Paramètres :
- prompt (str) : L'instruction textuelle pour l'analyse de l'image.
- path (str) : Le chemin complet vers le fichier image.
Renvoie :
- str : Le texte de réponse généré par le modèle de vision Gemini.
"""
# Vérifier la disponibilité de la clé API (à remplacer par votre gestion des erreurs)
if not GOOGLE_API_KEY:
raise ValueError("Clé API Gemini non fournie.")
try:
# Ouvrir l'image
image = Image.open(path)
# Créer une instance de modèle génératif (en supposant que 'genai' est la bibliothèque)
model = genai.GenerativeModel(model_name="gemini-pro-vision")
# Générer du contenu en utilisant l'instruction et l'image
response = model.generate_content([prompt, image])
return response.text
except FileNotFoundError:
return "Erreur : Fichier image introuvable."
except Exception as e: # Attraper d'autres erreurs potentielles
return f"Erreur : {e}"
Can CrewAI's agents process images and provide results based on them? I know that CrewAI uses GPT-4 Turbo, which can handle both text and images, but I'm not sure how to pass an image to the agent and get a result.
The text was updated successfully, but these errors were encountered: