stochasticai / xTuring

Build, customize and control you own LLMs. From data pre-processing to fine-tuning, xTuring provides an easy way to personalize open-source LLMs. Join our discord community: https://discord.gg/TgHXuSJEk6
https://xturing.stochastic.ai
Apache License 2.0
2.61k stars 207 forks source link

Add support for Palm, Claude-2, Llama2, CodeLlama, Sagemaker (100+LLMs) - using LiteLLM #255

Open ishaan-jaff opened 1 year ago

ishaan-jaff commented 1 year ago

This PR adds support for the above mentioned LLMs using LiteLLM https://github.com/BerriAI/litellm/ LiteLLM allows you to use any LLM as a drop in replacement for gpt-3.5

Example

from litellm import completion

## set ENV variables
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 1 year ago

@sarthaklangde @StochasticRomanAgeev can you please take a look at this pr when possible ?

if the initial commit looks good I will add docs/testing too !