Spaces:
Build error
Build error
File size: 875 Bytes
0821095 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Simple SmoLAgent - Un script simple pour tester l'authentification avec Hugging Face
"""
import os
import asyncio
from dotenv import load_dotenv
from huggingface_hub import login
from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel
# Charger les variables d'environnement depuis le fichier .env
load_dotenv()
# Récupérer le token Hugging Face
hf_token = os.getenv("HUGGING_FACE_HUB_TOKEN")
def main():
"""Fonction principale pour tester l'authentification avec Hugging Face."""
agent = CodeAgent(tools=[DuckDuckGoSearchTool()], model=HfApiModel())
response = agent.run("Search for the best music recommendations for a party at the Wayne's mansion.")
# Tester l'agent avec une requête simple
print(f"Réponse de l'agent: {response}")
if __name__ == "__main__":
main()
|