DataBassGit / AgentForge

Extensible AGI Framework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Update Anthropic Client

krrishdholakia opened this issue · comments

Anthropic changed their python sdk - making this code line outdated.

client = anthropic.Client(API_KEY)

Would love to know if this might help - https://github.com/BerriAI/litellm

~Simple I/O library, that standardizes all the llm api calls to the OpenAI call

from litellm import completion

## set ENV variables
# ENV variables can be set in .env file, too. Example in .env.example
os.environ["OPENAI_API_KEY"] = "openai key"
os.environ["ANTHROPIC_API_KEY"] = "anthropic key"

messages = [{ "content": "Hello, how are you?","role": "user"}]

# openai call
response = completion(model="gpt-3.5-turbo", messages=messages)

# anthropic call
response = completion("claude-v-2", messages)

Hey, Thanks for the heads up. We hadn't noticed a difference because we are still using claude v1. We're going to be cleaning up a few things here soon, and the way users select the model to be used will be updated. What we will likely do is create a v1 script and a v2 script. I'll let you know when it's done.

Are you using v2 and getting errors? Can you provide the error message?

I don't think it throws errors - but it's been deprecated, so i'd probably upgrade

Curious - why separate them out vs. using a single library like lite https://github.com/BerriAI/litellm

Privacy. One of the main tenets of my development strategy is privacy first. We try to only include libraries that communicate with large corps when we have to. While we can't control every library, we can reduce the libraries that we do call. (Which reminds me I need move the openai library to extras.)

I'm not saying that litellm is bad or stealing data. But, If you are using oobabooga and chroma, for example, the entire system runs locally. I know this because we are using the requests library. I can't control what litellm uses. Of course, it is possible to verify what libraries they are using. There's not enough time to verify every change log every time a library I use is updated, however. Moreso if I use someone else's library for every solution I need.

This has been updated in the dev branch and should be deployed next push.