KokoMind icon indicating copy to clipboard operation
KokoMind copied to clipboard

Update Anthropic Client

Open krrishdholakia opened this issue 2 years ago • 2 comments

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

https://github.com/CHATS-lab/KokoMind/blob/e694cda2d9469ddbbd41699beee1b154dad1ef93/eval/qa_baseline_claude.py#L20

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

~100 lines of code, 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 20:08 krrishdholakia

@Liang-Qiu @lupantech

krrishdholakia avatar Aug 01 '23 20:08 krrishdholakia

@krrishdholakia Thank you for bringing this up! Do you mind submitting a PR for this change? I didn't specify the anthropic package version in requirement. Claude v2 should be a separate baseline IMO and we can run another evaluation in the next iteration.

Liang-Qiu avatar Aug 01 '23 20:08 Liang-Qiu