GPTCache icon indicating copy to clipboard operation
GPTCache copied to clipboard

Add support for Bard, Anthropic, Cohere, Azure, OpenAI Models - using litellm

Open ishaan-jaff opened this issue 2 years ago • 6 comments

I'm the maintainer of litellm https://github.com/BerriAI/litellm - a simple & light package to call Bard, Anthropic, Cohere, Azure, OpenAI LLM Models

This PR adds support for models from all the above mentioned providers, in this pr I made a new adapter called litellm.py

Here's a sample of how it's used:

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["COHERE_API_KEY"] = "cohere key"

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

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

# cohere call
response = completion("command-nightly", messages)

# anthropic call
response = completion(model="claude-instant-1", messages=messages)

ishaan-jaff avatar Aug 03 '23 20:08 ishaan-jaff

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: ishaan-jaff To complete the pull request process, please assign simfg after the PR has been reviewed. You can assign the PR to them by writing /assign @simfg in a comment when ready.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

sre-ci-robot avatar Aug 03 '23 20:08 sre-ci-robot

Welcome @ishaan-jaff! It looks like this is your first PR to zilliztech/GPTCache 🎉

sre-ci-robot avatar Aug 03 '23 20:08 sre-ci-robot

@cxie @SimFG @xiaofan-luan saw adding new LLM models was on the roadmap, made a PR to integrate with liteLLM which adds new LLM models. if this looks good would love to add support to GPTCache

ishaan-jaff avatar Aug 03 '23 20:08 ishaan-jaff

@ishaan-jaff thanks for your pr, please make the dev branch as the target

SimFG avatar Aug 04 '23 02:08 SimFG

what would next steps on this PR be? @ishaan-jaff @SimFG

krrishdholakia avatar Aug 05 '23 05:08 krrishdholakia

@ishaan-jaff please add some test cases for your pull request

SimFG avatar Aug 07 '23 02:08 SimFG