wangold / Swarm-readme-11.sh
0 likes
0 forks
1 files
Last active
1 | Hi John, how can I assist you today? |
wangold / Swarm-readme-10.py
0 likes
0 forks
1 files
Last active
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!"}], |
wangold / Swarm-readme-9.py
0 likes
0 forks
1 files
Last active
1 | agent = Agent( |
2 | instructions="You are a helpful agent." |
3 | ) |
wangold / Swarm-readme-8.md
0 likes
0 forks
1 files
Last active
Field | Type | Description | Default |
---|---|---|---|
name | str |
The name of the agent. | "Agent" |
model | str |
The model to be used by the agent. | "gpt-4o" |
instructions | str or func() -> str |
Instructions for the agent, can be a string or a callable returning a string. | "You are a helpful agent." |
functions | List |
A list of functions that the agent can call. | [] |
tool_choice | str |
The tool choice for the agent, if any. | None |
wangold / Swarm-readme-7.md
0 likes
0 forks
1 files
Last active
Field | Type | Description |
---|---|---|
messages | List |
A list of message objects generated during the conversation. Very similar to Chat Completions messages , but with a sender field indicating which Agent the message originated from. |
agent | Agent |
The last agent to handle a message. |
context_variables | dict |
The same as the input variables, plus any changes. |
wangold / Swarm-readme-6.md
0 likes
0 forks
1 files
Last active
Argument | Type | Description | Default |
---|---|---|---|
agent | Agent |
The (initial) agent to be called. | (required) |
messages | List |
A list of message objects, identical to Chat Completions messages |
(required) |
context_variables | dict |
A dictionary of additional context variables, available to functions and Agent instructions | {} |
max_turns | int |
The maximum number of conversational turns allowed | float("inf") |
model_override | str |
An optional string to override the model being used by an Agent | None |
execute_tools | bool |
If False , interrupt execution and immediately returns tool_calls message when an Agent tries to call a function |
True |
stream | bool |
If True , enables streaming responses |
False |
debug | bool |
If True , enables debug logging |
False |
wangold / Swarm-readme-5.py
0 likes
0 forks
1 files
Last active
1 | from swarm import Swarm |
2 | |
3 | client = Swarm() |
wangold / Swarm-readme-4.sh
0 likes
0 forks
1 files
Last active
1 | Hope glimmers brightly, |
2 | New paths converge gracefully, |
3 | What can I assist? |
wangold / Swarm-readme-3.sh
0 likes
0 forks
1 files
Last active
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( |
wangold / Swarm-readme-2.sh
0 likes
0 forks
1 files
Last active
1 | pip install git+https://github.com/openai/swarm.git |