ai-cli icon indicating copy to clipboard operation
ai-cli copied to clipboard

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

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

This PR adds support for models from all the above mentioned providers using litellm https://github.com/BerriAI/litellm - a simple & light package to call OpenAI, Azure, Cohere, Anthropic API Endpoints

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 06 '23 16:08 ishaan-jaff

@yufeikang can you pls take a look at this PR? Happy to add more docs/tests if this initial commit looks good 😊

ishaan-jaff avatar Aug 06 '23 16:08 ishaan-jaff