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 Llama2, Palm, Cohere, Replicate, HuggingFace (Starcoder) Models - using litellm #19

Closed
wants to merge 1 commit into from

Conversation

ishaan-jaff
Copy link

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)

@ishaan-jaff
Copy link
Author

Addresses #18

@ishaan-jaff ishaan-jaff changed the title Add support for Llama2, Palm, Cohere, Replicate Models - using litellm Add support for Llama2, Palm, Cohere, Replicate, HuggingFace (Starcoder) Models - using litellm Aug 18, 2023
@ishaan-jaff
Copy link
Author

@silvanmelchior if this initial commit looks good. - happy to add docs / testing too

@silvanmelchior
Copy link
Owner

I'm actually not sure how this could work; except for OpenAI no other model was finetuned to call functions (in this case the code interpreter). That's why for llama I had to do all this parsing of the code block.
Did you test this with code execution?

@silvanmelchior silvanmelchior added the question Further information is requested label Aug 19, 2023
@silvanmelchior
Copy link
Owner

Close due to inactivity

@ishaan-jaff
Copy link
Author

@silvanmelchior we can help with this issue: #29

@ishaan-jaff
Copy link
Author

ahh I understand for non openai LLMs you'd need to extract just the executable code block ?

did I understand that correctly ?

@silvanmelchior
Copy link
Owner

Yes, or something smarter, if the model allows it

@ishaan-jaff
Copy link
Author

sounds good - i'm happy to add StableCode #28 if you think that would be useful for IncognitoPilot

@silvanmelchior
Copy link
Owner

I would recommend to first hack together a prototype, so we see if the performance is useful enough. I think llama is already at the limit of what is usable, since ot was not finetuned for tool usage like the interpreter. (Even though I think llama is great!).

If such a prototype shows that it indeed is useful, I'm open to adding other models

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants