Spaces:
Sleeping
Sleeping
version complète v06
Browse files
agent.py
CHANGED
|
@@ -15,21 +15,22 @@ os.environ["OPENAI_API_KEY"] = openai_api_key
|
|
| 15 |
|
| 16 |
# 🧠 Création de l'agent
|
| 17 |
llm = OpenAI(
|
| 18 |
-
model="gpt-
|
| 19 |
system_prompt=(
|
| 20 |
-
"Tu es un agent GAIA
|
| 21 |
-
"
|
| 22 |
-
"
|
| 23 |
-
"
|
| 24 |
-
"
|
| 25 |
-
"
|
| 26 |
-
"
|
| 27 |
-
"
|
| 28 |
-
"
|
| 29 |
-
"
|
| 30 |
),
|
| 31 |
-
max_tokens=
|
| 32 |
-
|
|
|
|
| 33 |
|
| 34 |
agent = ReActAgent.from_tools(
|
| 35 |
tools=TOOLS,
|
|
|
|
| 15 |
|
| 16 |
# 🧠 Création de l'agent
|
| 17 |
llm = OpenAI(
|
| 18 |
+
model="gpt-3.5-turbo",
|
| 19 |
system_prompt=(
|
| 20 |
+
"Tu es un agent GAIA. Tu DOIS utiliser les outils disponibles.\n"
|
| 21 |
+
"RÈGLES ABSOLUES :\n"
|
| 22 |
+
"1. JAMAIS dire 'je ne peux pas' ou 'problèmes techniques'\n"
|
| 23 |
+
"2. TOUJOURS utiliser web_search pour les questions factuelles\n"
|
| 24 |
+
"3. TOUJOURS essayer même si incertain\n"
|
| 25 |
+
"4. Ta réponse finale = EXACTEMENT ce qui est demandé\n"
|
| 26 |
+
"5. Pas d'excuses, pas d'explications, juste la réponse\n"
|
| 27 |
+
"6. Utilise tous les outils nécessaires pour répondre\n"
|
| 28 |
+
"7. Si une recherche échoue, essaie une autre approche\n"
|
| 29 |
+
"UTILISE LES OUTILS MAINTENANT !"
|
| 30 |
),
|
| 31 |
+
max_tokens=1500,
|
| 32 |
+
temperature=0.1
|
| 33 |
+
)
|
| 34 |
|
| 35 |
agent = ReActAgent.from_tools(
|
| 36 |
tools=TOOLS,
|
test.py
CHANGED
|
@@ -1,2 +1,20 @@
|
|
| 1 |
import os
|
| 2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import os
|
| 2 |
+
# Testez ceci dans un script séparé pour diagnostiquer :
|
| 3 |
+
from duckduckgo_search import DDGS
|
| 4 |
+
from agent import run_agent
|
| 5 |
+
print(os.getcwd())
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
try:
|
| 9 |
+
with DDGS() as ddgs:
|
| 10 |
+
results = list(ddgs.text("Mercedes Sosa albums", max_results=3))
|
| 11 |
+
print("✅ DuckDuckGo fonctionne:")
|
| 12 |
+
for r in results:
|
| 13 |
+
print(f"- {r.get('title', 'No title')}")
|
| 14 |
+
except Exception as e:
|
| 15 |
+
print(f"❌ Erreur DuckDuckGo: {e}")
|
| 16 |
+
|
| 17 |
+
# Testez avec une question simple
|
| 18 |
+
question_test = "How many studio albums were published by Mercedes Sosa between 2000 and 2009?"
|
| 19 |
+
response = run_agent(question_test)
|
| 20 |
+
print(f"Réponse: {response}")
|