Add support for Azure, OpenAI, Palm, Anthropic, Cohere Models - using litellm #15

Open
ishaan-jaff wants to merge 1 commit from ishaan-jaff/master into master
ishaan-jaff commented 2023-08-03 19:29:22 -04:00 (Migrated from github.com)

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

This PR adds support for models from all the above mentioned providers. I added a condition to check if the provided model is supported by litellm -> if so it uses litellm for the completion call.

If not it maintains your openai call

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)
I'm the maintainer of litellm https://github.com/BerriAI/litellm - a simple & light package to call OpenAI, Azure, Cohere, Anthropic API Endpoints This PR adds support for models from all the above mentioned providers. I added a condition to check if the provided model is supported by litellm -> if so it uses litellm for the completion call. If not it maintains your openai call 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 commented 2023-08-03 19:33:34 -04:00 (Migrated from github.com)

@yakeJiang @ericxinwu would love some feedback on if this looks good. Happy to make your openai call as the default one and if the model is not supported by the openai call we can direct it to litellm

@yakeJiang @ericxinwu would love some feedback on if this looks good. Happy to make your openai call as the default one and if the model is not supported by the openai call we can direct it to litellm
booboosui commented 2023-08-03 21:30:56 -04:00 (Migrated from github.com)

thank you very much. we will consider your proposal as soon as possible

thank you very much. we will consider your proposal as soon as possible
ericxinwu commented 2023-08-07 05:11:11 -04:00 (Migrated from github.com)

@yakeJiang @ericxinwu would love some feedback on if this looks good. Happy to make your openai call as the default one and if the model is not supported by the openai call we can direct it to litellm

Thanks a lot for your PR, we will review it ASAP.

> @yakeJiang @ericxinwu would love some feedback on if this looks good. Happy to make your openai call as the default one and if the model is not supported by the openai call we can direct it to litellm Thanks a lot for your PR, we will review it ASAP.
ishaan-jaff commented 2023-08-11 11:48:26 -04:00 (Migrated from github.com)

@ericxinwu @booboosui any updates on this ?

@ericxinwu @booboosui any updates on this ?
Balor-TheDemon commented 2023-08-22 20:19:10 -04:00 (Migrated from github.com)

which other api keys can be used for this tool

which other api keys can be used for this tool
ishaan-jaff commented 2023-09-05 21:00:37 -04:00 (Migrated from github.com)
@Balor-TheDemon see: https://docs.litellm.ai/docs/providers
ishaan-jaff commented 2023-10-03 13:20:23 -04:00 (Migrated from github.com)

Hi @ericxinwu @booboosui any update on this? Is there something missing in LiteLLM for your use case?

Hi @ericxinwu @booboosui any update on this? Is there something missing in LiteLLM for your use case?
This pull request has changes conflicting with the target branch.
  • backend/app/pkgs/tools/llm_basic.py
  • requirements.txt
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin ishaan-jaff/master:ishaan-jaff/master
git switch ishaan-jaff/master

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch master
git merge --no-ff ishaan-jaff/master
git switch ishaan-jaff/master
git rebase master
git switch master
git merge --ff-only ishaan-jaff/master
git switch ishaan-jaff/master
git rebase master
git switch master
git merge --no-ff ishaan-jaff/master
git switch master
git merge --squash ishaan-jaff/master
git switch master
git merge --ff-only ishaan-jaff/master
git switch master
git merge ishaan-jaff/master
git push origin master
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
kuafuai/DevOpsGPT!15
No description provided.