wangold 修订了这个 Gist . 跳至此修订
1 file changed, 13 insertions
Swarm-readme-10.py(file created)
@@ -0,0 +1,13 @@ | |||
1 | + | def instructions(context_variables): | |
2 | + | user_name = context_variables["user_name"] | |
3 | + | return f"Help the user, {user_name}, do whatever they want." | |
4 | + | ||
5 | + | agent = Agent( | |
6 | + | instructions=instructions | |
7 | + | ) | |
8 | + | response = client.run( | |
9 | + | agent=agent, | |
10 | + | messages=[{"role":"user", "content": "Hi!"}], | |
11 | + | context_variables={"user_name":"John"} | |
12 | + | ) | |
13 | + | print(response.messages[-1]["content"]) |
更新
更早