Luodian / Otter

🦦 Otter, a multi-modal model based on OpenFlamingo (open-sourced version of DeepMind's Flamingo), trained on MIMIC-IT and showcasing improved instruction-following and in-context learning ability.
https://otter-ntu.github.io/
MIT License
3.54k stars 242 forks source link

[model] Add support for Llama2, Palm, Cohere, Replicate Models - using litellm #244

Closed ishaan-jaff closed 11 months ago

ishaan-jaff commented 1 year ago

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)

# llama2 call
model_name = "replicate/llama-2-70b-chat:2c1608e18606fad2812020dc541930f2d0495ce32eee50074220b87300bc16e1"
response = completion(model_name, messages)

# cohere call
response = completion("command-nightly", messages)

# anthropic call
response = completion(model="claude-instant-1", messages=messages)

When you open a pull-request, please be sure to include the following

Thank you for your contributions!

ishaan-jaff commented 1 year ago

@ZhangYuanhan-AI @Luodian can I get a review on this PR 😊 ? Happy to add more tests/docs if needed

Luodian commented 1 year ago

Thanks for this PR! I will review it later and then consider merging it~

Luodian commented 11 months ago

@ishaan-jaff Thanks! The litellm looks soo cool. I am merging it now.