You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We can provide one code snippet for each major model provider, instead of asking user to edit code, it should just run perfectly.
The new code example:
fromautogen_agentchat.agentsimportAssistantAgentfromautogen_agentchat.uiimportConsolefromautogen_ext.models.openaiimportOpenAIChatCompletionClient# Define a toolasyncdefget_weather(city: str) ->str:
returnf"The weather in {city} is 73 degrees and Sunny."asyncdefmain() ->None:
# Define an agentweather_agent=AssistantAgent(
name="weather_agent",
model_client=OpenAIChatCompletionClient(
model="gpt-4o-2024-08-06",
# api_key="YOUR_API_KEY",
),
tools=[get_weather],
)
# Run a querystream=weather_agent.run_stream(task="What's the weather like in Seattle, WA")
# Display output in consoleawaitConsole(stream)
# NOTE: if running this inside a Python script you'll need to use asyncio.run(main()).awaitmain()
Repeat this for each model provider:
Azure Open AI
Azure AI Foundary
Gemini
Ollama
The text was updated successfully, but these errors were encountered:
The new code example:
Repeat this for each model provider:
The text was updated successfully, but these errors were encountered: