prr icon indicating copy to clipboard operation
prr copied to clipboard

Update Anthropic Client

Open krrishdholakia opened this issue 2 years ago • 1 comments

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

https://github.com/Forward-Operators/prr/blob/3dcceb91e3b0daf93775bbdefe4f7b9a6e6fde53/prr/services/providers/anthropic/complete.py#L22


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)

krrishdholakia avatar Aug 01 '23 21:08 krrishdholakia

cc: @meal

krrishdholakia avatar Aug 01 '23 21:08 krrishdholakia