16 lines
No EOL
503 B
Python
16 lines
No EOL
503 B
Python
import asyncio
|
|
from autogen_ext.models.openai import OpenAIChatCompletionClient
|
|
from autogen_ext.teams.magentic_one import MagenticOne
|
|
from autogen_agentchat.ui import Console
|
|
|
|
|
|
async def example_usage():
|
|
client = OpenAIChatCompletionClient(model="gpt-4o", api_key="")
|
|
m1 = MagenticOne(client=client)
|
|
task = "Write a Python script to fetch data from an API."
|
|
result = await Console(m1.run_stream(task=task))
|
|
print(result)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(example_usage()) |