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

Add support for Anthropic Claude models #2245

Merged
merged 9 commits into from
Apr 3, 2024

Conversation

levscaut
Copy link
Contributor

@levscaut levscaut commented Apr 1, 2024

Why are these changes needed?

AutoGen do not currently have support for the Anthropic API.

Related issue number

#2164

Checks

@levscaut levscaut marked this pull request as draft April 1, 2024 22:09
@levscaut
Copy link
Contributor Author

levscaut commented Apr 1, 2024

I'm actually not sure about where to put the AnthropicClient class. It will be much more convinient to use Anthropic API if we can treat this client as same level as OpenAIClient in autogen/oai/client.py, compared to have it as an extrernal custom client. @thinkall it will be great if I can have your advice!

Copy link
Collaborator

@ekzhu ekzhu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For such an important topic, it should be on the website rather than a notebook example.

notebook/agentchat_anthropic.ipynb Outdated Show resolved Hide resolved
@thinkall
Copy link
Collaborator

thinkall commented Apr 2, 2024

I'm actually not sure about where to put the AnthropicClient class. It will be much more convinient to use Anthropic API if we can treat this client as same level as OpenAIClient in autogen/oai/client.py, compared to have it as an extrernal custom client. @thinkall it will be great if I can have your advice!

Thanks for the contribution, @levscaut ! Currently, for the ease of maintainance, we only have openAI compatible client in the core. For non-OpenAI style client, a tutorial/notebook example would be simpler, but we could add it to the oai module if we find it's better.

Could you also add an example here: https://microsoft.github.io/autogen/docs/topics/non-openai-models/about-using-nonopenai-models? Create a page like Mistral AI. Thanks.

@ekzhu
Copy link
Collaborator

ekzhu commented Apr 2, 2024

Agree with @thinkall. we can start with a notebook and have people try it out. Once the code is stable and we get resources for testing non-openai APIs, we can formalize it into a first-class client.

Copy link
Member

@olgavrou olgavrou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree with the comments for moving in the right place, but other than that LGTM

@levscaut
Copy link
Contributor Author

levscaut commented Apr 2, 2024

Thanks for the advice! I've moved the notebook to website folder and added a link to it.

@levscaut levscaut marked this pull request as ready for review April 2, 2024 20:35
@levscaut levscaut marked this pull request as draft April 2, 2024 20:38
@codecov-commenter
Copy link

codecov-commenter commented Apr 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 37.94%. Comparing base (2053dd9) to head (9bf9cc9).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2245   +/-   ##
=======================================
  Coverage   37.94%   37.94%           
=======================================
  Files          77       77           
  Lines        7784     7784           
  Branches     1667     1667           
=======================================
  Hits         2954     2954           
  Misses       4580     4580           
  Partials      250      250           
Flag Coverage Δ
unittests 37.93% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@levscaut levscaut marked this pull request as ready for review April 3, 2024 15:41
@ekzhu ekzhu enabled auto-merge April 3, 2024 22:14
@ekzhu ekzhu added this pull request to the merge queue Apr 3, 2024
Merged via the queue into microsoft:main with commit f5e382a Apr 3, 2024
24 checks passed
@levscaut levscaut deleted the claude_support branch April 3, 2024 22:54
whiskyboy pushed a commit to whiskyboy/autogen that referenced this pull request Apr 17, 2024
* init notebook

* move notebook to website, remove set your api section

* add link to claude page

* replace config_from_json of raw python config

* update cost

---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants