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

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

Conversation

ishaan-jaff
Copy link

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

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
Author

@rmfan would love your feedback on this 😊

@rmfan
Copy link
Collaborator

rmfan commented Aug 4, 2023

Can you verify that for all the models, the responses are in the format:

({"Relevancy score": "an integer score out of 10", "Reasons for match": "1-2 sentence short reasonings"})

We've only tested this for gpt-3.5-turbo, and before we officially support any other LLM, we need to make sure that it will follow that format given the prompt in src/relevancy_prompt.txt

@ishaan-jaff
Copy link
Author

for some lower quality models output is not guaranteed to always be
({"Relevancy score": "an integer score out of 10", "Reasons for match": "1-2 sentence short reasonings"})

perhaps we can add a check in the output text and see if it is
type==dict and ('Relevancy score' in output_dict and 'Reasons for match' in output_dict)

@ishaan-jaff
Copy link
Author

this way - you can add support for new models while maintaining ur output guarantees

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.

2 participants