Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Anthropic Client in AutoGen v0.4 and Studio #5708

Closed
Tracked by #4006
victordibia opened this issue Feb 25, 2025 · 2 comments · Fixed by #5695
Closed
Tracked by #4006

Support Anthropic Client in AutoGen v0.4 and Studio #5708

victordibia opened this issue Feb 25, 2025 · 2 comments · Fixed by #5695

Comments

@victordibia
Copy link
Collaborator

victordibia commented Feb 25, 2025

Support Anthropic Client in AutoGen v0.4
Expected behaviour below

from dotenv import load_dotenv
import os 

load_dotenv()

from autogen_agentchat.agents import AssistantAgent
from autogen_agentchat.ui import Console
from autogen_ext.models.openai import OpenAIChatCompletionClient
from autogen_ext.models.anthropic import AnthropicChatCompletionClient 
model_client =   AnthropicChatCompletionClient(
        model="claude-3-7-sonnet-20250219" 
    )

async def get_weather(city: str) -> str:
    """Get the weather for a given city."""
    return f"The weather in {city} is 73 degrees and Sunny."

 
agent = AssistantAgent(
    name="weather_agent",
    model_client=model_client,
    tools=[get_weather],
    system_message="You are a helpful assistant.", 
    # model_client_stream=True,   
)

# Run the agent and stream the messages to the console.
async def main() -> None:
    await Console(agent.run_stream(task="What is the weather in New York?"))
await main()
@pengjunfeng11
Copy link
Contributor

Hello, has this been developed? I want to try to contribute to the community, can I do it?

@victordibia
Copy link
Collaborator Author

There is a PR here .. you can help with testing and providing feedback.
#5695

@victordibia victordibia changed the title Support Anthropic Client in AutoGen v0.4 Support Anthropic Client in AutoGen v0.4 and Studio Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants