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 Azure, OpenAI, Palm, Anthropic, Cohere, Replicate Models - using litellm #20

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ishaan-jaff
Copy link

@ishaan-jaff ishaan-jaff commented Aug 4, 2023

This PR adds support for models from all the above mentioned providers using https://github.com/BerriAI/litellm

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

from litellm import completion, acompletion

## 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)

# async openai
response = acompletion(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
Copy link
Author

@pfliu-nlp @EthanC111 can you take a look at this when you get a chance? If this initial commit looks good - happy to update readme and add tests😊

@@ -27,6 +28,7 @@ def __init__(
top_p=1,
request_timeout=60,
):
# TODO: modify this to allow Anthropic, Claude, etc
if 'gpt' not in model_name:
Copy link
Contributor

Choose a reason for hiding this comment

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

If more types of LLMs are supported, we probably need to generalize this line of code

@pfliu-nlp
Copy link
Contributor

hi @ishaan-jaff
Thanks a lot for your attention on this project and nice PR, which looks good to me overall.
I left one comment. I think we can merge this PR once:

  • you can reflect this comment
  • fix the potential conflicts
  • test the newly-added feature successfully

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.

None yet

2 participants