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 Models - using litellm #77

Merged
merged 3 commits into from
Aug 5, 2023

Conversation

ishaan-jaff
Copy link
Contributor

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

This PR adds support for models from all the above mentioned providers (by creating a class liteLLMChatGPTBot)

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
Copy link
Contributor Author

cc @iuiaoin can i get a review on this

# https://litellm.readthedocs.io/en/latest/supported/
from bot.litellm import liteLLMChatGPTBot
self.bot = liteLLMChatGPTBot()

from bot.chatgpt import ChatGPTBot

self.bot = ChatGPTBot()
Copy link
Owner

Choose a reason for hiding this comment

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

The self.bot will always be assigned by ChatGPTBot instance, seems there needs to be an else block here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch updated this

@iuiaoin
Copy link
Owner

iuiaoin commented Aug 4, 2023

@ishaan-jaff Thanks for your pull request! I got a comment for you

@ishaan-jaff
Copy link
Contributor Author

@iuiaoin thanks for the review, I updated the code + added some more info on the readme

@iuiaoin
Copy link
Owner

iuiaoin commented Aug 5, 2023

@ishaan-jaff LGMT,approved. Yet seems ci failed

@ishaan-jaff
Copy link
Contributor Author

@iuiaoin fixed lint errors

@iuiaoin iuiaoin merged commit dc42e65 into iuiaoin:main Aug 5, 2023
1 check passed
@iuiaoin iuiaoin mentioned this pull request Aug 8, 2023
1 task
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