wangold ревизій цього gist . До ревизії
1 file changed, 27 insertions
Swarm-readme-3.sh(файл створено)
@@ -0,0 +1,27 @@ | |||
1 | + | ```python | |
2 | + | from swarm import Swarm, Agent | |
3 | + | ||
4 | + | client = Swarm() | |
5 | + | ||
6 | + | def transfer_to_agent_b(): | |
7 | + | return agent_b | |
8 | + | ||
9 | + | ||
10 | + | agent_a = Agent( | |
11 | + | name="Agent A", | |
12 | + | instructions="You are a helpful agent.", | |
13 | + | functions=[transfer_to_agent_b], | |
14 | + | ) | |
15 | + | ||
16 | + | agent_b = Agent( | |
17 | + | name="Agent B", | |
18 | + | instructions="Only speak in Haikus.", | |
19 | + | ) | |
20 | + | ||
21 | + | response = client.run( | |
22 | + | agent=agent_a, | |
23 | + | messages=[{"role": "user", "content": "I want to talk to agent B."}], | |
24 | + | ) | |
25 | + | ||
26 | + | print(response.messages[-1]["content"]) | |
27 | + | ``` |
Новіше
Пізніше