gpt-code-assistant
gpt-code-assistant copied to clipboard
Add support for Azure, OpenAI, Palm, Anthropic, Cohere, Replicate Models - using litellm
This PR adds support for models from all the above mentioned providers using https://github.com/BerriAI/litellm
TLDR: gpt-code-assistant gets:
- more LLM models out of the box
- instant integration of models by modifying the
modelparam (Easy to add models in the future) - log I/O to Posthog, Sentry, Helicone, Supabase without making any code changes & get API Key management
Here's a sample of how litellm completion is 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)
cc @narenmanoharan can you please take a look at this when you get the chance ?
Happy to add docs/tests if this initial commit looks good😊
@ishaan-jaff Thanks for the PR. litellm seems super helpful. I was thinking about adding support for claude recently and was looking into it. This makes it super straightforward.
There's a couple of changes required to make this work:
- You need to modify the
load_selected_modelinconfig.pyto expose other models from cohere and anthropic to allow users to select it. - Also, now that this support other models than open_ai, might be good to rename
open_ai.pytoai.py - Update the readme with the supported models and how to set the api keys for each
I can merge this PR then and release a new version! Again, thanks for the contribution! ❤️
Also, does this package collect any analytics by default?