Skip to content

Add example using Llama2, Palm, Cohere, Replicate Models - using litellm #125

@ishaan-jaff

Description

@ishaan-jaff

I'm the maintainer of litellm https://github.com/BerriAI/litellm/ - a lightweight package to simplify LLM API calls - Azure, OpenAI, Cohere, Anthropic, Replicate. Manages input/output translation

and was hoping to work on an example on how to make an app using multiple LLMs

Here's how litellm calls work:

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions