wangold / Swarm-readme-21.py
0 Lajky
0 Forky
1 Soubory
Naposledy aktivní
1 | from swarm.repl import run_demo_loop |
2 | ... |
3 | run_demo_loop(agent, stream=True) |
wangold / Swarm-readme-20.py
0 Lajky
0 Forky
1 Soubory
Naposledy aktivní
1 | stream = client.run(agent, messages, stream=True) |
2 | for chunk in stream: |
3 | print(chunk) |
wangold / Swarm-readme-19.js
0 Lajky
0 Forky
1 Soubory
Naposledy aktivní
1 | { |
2 | "type": "function", |
3 | "function": { |
4 | "name": "greet", |
5 | "description": "Greets the user. Make sure to get their name and age before calling.\n\nArgs:\n name: Name of the user.\n age: Age of the user.\n location: Best place on earth.", |
6 | "parameters": { |
7 | "type": "object", |
8 | "properties": { |
9 | "name": {"type": "string"}, |
10 | "age": {"type": "integer"}, |
wangold / Swarm-readme-18.py
0 Lajky
0 Forky
1 Soubory
Naposledy aktivní
1 | def greet(name, age: int, location: str = "New York"): |
2 | """Greets the user. Make sure to get their name and age before calling. |
3 | |
4 | Args: |
5 | name: Name of the user. |
6 | age: Age of the user. |
7 | location: Best place on earth. |
8 | """ |
9 | print(f"Hello {name}, glad you are {age} in {location}!") |
wangold / Swarm-readme-17.sh
0 Lajky
0 Forky
1 Soubory
Naposledy aktivní
1 | Sales Agent |
2 | {'department': 'sales', 'user_name': 'John'} |
wangold / Swarm-readme-16.py
0 Lajky
0 Forky
1 Soubory
Naposledy aktivní
1 | sales_agent = Agent(name="Sales Agent") |
2 | |
3 | def talk_to_sales(): |
4 | print("Hello, World!") |
5 | return Result( |
6 | value="Done", |
7 | agent=sales_agent, |
8 | context_variables={"department": "sales"} |
9 | ) |
wangold / Swarm-readme-15.sh
0 Lajky
0 Forky
1 Soubory
Naposledy aktivní
1 | Sales Agent |
wangold / Swarm-readme-14.py
0 Lajky
0 Forky
1 Soubory
Naposledy aktivní
1 | sales_agent = Agent(name="Sales Agent") |
2 | |
3 | def transfer_to_sales(): |
4 | return sales_agent |
5 | |
6 | agent = Agent(functions=[transfer_to_sales]) |
7 | |
8 | response = client.run(agent, [{"role":"user", "content":"Transfer me to sales."}]) |
9 | print(response.agent.name) |
wangold / Swarm-readme-13.sh
0 Lajky
0 Forky
1 Soubory
Naposledy aktivní
1 | Hola, John! |
wangold / Swarm-readme-12.py
0 Lajky
0 Forky
1 Soubory
Naposledy aktivní
1 | def 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 | |
7 | agent = Agent( |
8 | functions=[print_hello] |
9 | ) |
Novější
Starší