Naposledy aktivní 1728946041

Revize 27eb97aeedca4f1c54f2005ac848da06758b14bd

Swarm-readme-12.py Raw
1def 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
7agent = Agent(
8 functions=[print_hello]
9)
10
11client.run(
12 agent=agent,
13 messages=[{"role": "user", "content": "Usa greet() por favor."}],
14 context_variables={"user_name": "John"}
15)