wangold a révisé ce gist . Aller à la révision
1 file changed, 15 insertions
Swarm-readme-12.py(fichier créé)
@@ -0,0 +1,15 @@ | |||
1 | + | def greet(context_variables, language): | |
2 | + | user_name = context_variables["user_name"] | |
3 | + | greeting = "Hola" if language.lower() == "spanish" else "Hello" | |
4 | + | print(f"{greeting}, {user_name}!") | |
5 | + | return "Done" | |
6 | + | ||
7 | + | agent = Agent( | |
8 | + | functions=[print_hello] | |
9 | + | ) | |
10 | + | ||
11 | + | client.run( | |
12 | + | agent=agent, | |
13 | + | messages=[{"role": "user", "content": "Usa greet() por favor."}], | |
14 | + | context_variables={"user_name": "John"} | |
15 | + | ) |
Plus récent
Plus ancien