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

Switch from OpenAI SDK to LiteLLM for Model Completions #3

Merged
merged 3 commits into from
Mar 27, 2024

Conversation

mentat-butler[bot]
Copy link
Contributor

@mentat-butler mentat-butler bot commented Mar 27, 2024

In response to the need for a more flexible and inclusive approach to interacting with various language models, this PR introduces a significant shift from using the OpenAI SDK to employing LiteLLM. LiteLLM offers a common interface that supports a wide range of models, making it easier for users to interact with different language models without being restricted to a specific provider.

Key Changes:

  • Integration of LiteLLM: The core functionality that previously relied on the OpenAI SDK has been updated to use LiteLLM. This change is reflected in the plugin/chatvim.py file, where LiteLLM's completion method is now used to obtain model completions.
  • Dynamic Model Specification: Users can now specify the model they wish to interact with directly in their input, using the full model string (e.g., gpt-3.5-turbo>>) instead of a shorthand version. This enhancement, implemented in the _get_chat_history method of plugin/chatvim.py, allows for greater flexibility and supports the diverse naming schemes of various language models.
  • Documentation Updates: The Readme.md and doc/chatvim.txt files have been updated to reflect the new way of specifying models and the switch to LiteLLM. These updates provide clear instructions for users on how to interact with the updated system.
  • Dependencies Update: The requirements.txt file has been modified to replace the OpenAI SDK dependency with LiteLLM, ensuring that the necessary packages are installed for the plugin to function correctly.

These changes were made to enhance the plugin's flexibility and usability, allowing users to easily switch between different language models and take advantage of the unique features each model offers. By adopting LiteLLM, we are also preparing the plugin for future expansions and integrations with an ever-growing list of language models.

Closes issue #2

mentat-butler bot and others added 3 commits March 27, 2024 15:03
In response to the need for a more flexible and inclusive approach to interacting with various language models, this PR introduces a significant shift from using the OpenAI SDK to employing LiteLLM. LiteLLM offers a common interface that supports a wide range of models, making it easier for users to interact with different language models without being restricted to a specific provider.

### Key Changes:
- **Integration of LiteLLM**: The core functionality that previously relied on the OpenAI SDK has been updated to use LiteLLM. This change is reflected in the `plugin/chatvim.py` file, where LiteLLM's `completion` method is now used to obtain model completions.
- **Dynamic Model Specification**: Users can now specify the model they wish to interact with directly in their input, using the full model string (e.g., `gpt-3.5-turbo>>`) instead of a shorthand version. This enhancement, implemented in the `_get_chat_history` method of `plugin/chatvim.py`, allows for greater flexibility and supports the diverse naming schemes of various language models.
- **Documentation Updates**: The `Readme.md` and `doc/chatvim.txt` files have been updated to reflect the new way of specifying models and the switch to LiteLLM. These updates provide clear instructions for users on how to interact with the updated system.
- **Dependencies Update**: The `requirements.txt` file has been modified to replace the OpenAI SDK dependency with LiteLLM, ensuring that the necessary packages are installed for the plugin to function correctly.

These changes were made to enhance the plugin's flexibility and usability, allowing users to easily switch between different language models and take advantage of the unique features each model offers. By adopting LiteLLM, we are also preparing the plugin for future expansions and integrations with an ever-growing list of language models.
@jakethekoenig jakethekoenig merged commit c786274 into master Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant