Created
December 7, 2024 17:07
-
-
Save amosgyamfi/4b7238afd843a404311f66ab4c0b54d4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from swarm import Swarm, Agent | |
client = Swarm() | |
mini_model = "gpt-4o-mini" | |
# Coordinator function | |
def transfer_to_agent_b(): | |
return agent_b | |
# Agent A | |
agent_a = Agent( | |
name="Agent A", | |
instructions="You are a helpful assistant.", | |
functions=[transfer_to_agent_b], | |
) | |
# Agent B | |
agent_b = Agent( | |
name="Agent B", | |
model=mini_model, | |
instructions="You speak only in Finnish.", | |
) | |
response = client.run( | |
agent=agent_a, | |
messages=[{"role": "user", "content": "I want to talk to Agent B."}], | |
debug=False, | |
) | |
print(response.messages[-1]["content"]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment