Plugins¶
Using plugins¶
File-based plugins¶
Place the plugin file in either:
The main
plugins
directory of this moduleA
plugins
directory in your profile
Use the/configfiles
command to see a list of currently configured plugin paths.
Package-based plugins¶
Install the plugin package – see below for a list of package plugins.
Enabling plugins¶
Enable the plugin in your configuration:
plugins:enabled:# This is a list of plugins to enable, each list item# should be the name of a plugin file.# For file-based plugins, this is the filename without the# extension.# For package-based plugins, see the installation instructions# for the package.-test
Note that settingplugins.enabled
will overwrite the default enabled plugins. Use the/plugins
command for a list of currently enabled plugins.
Reloading plugins¶
To dynamically reload a plugin:
/pluginreload[plugin_name]
Reloading a plugin will also clear the main cache file for the plugin – as some provider plugins cache data on current models, this command can be used to refresh the available models for the provider. For example:
/pluginreloadprovider_chat_fireworks
Core plugins¶
These plugins are built into LWE core:
echo: Simple echo plugin, echos back the text you give it
examples: Easily install example configuration files (seeInstalling examples)
provider_chat_openai_compat: Allows access to third-party providers that offer an OpenAI compatible API.
They can be disabled by removing them fromplugins.enabled
in your configuration file.
LWE maintained plugins¶
These plugins are maintained by the LWE team, and are not part of LWE core – they must be installed.
Instructions for installing and configuring each plugin can be found at the referenced repository for each plugin.
Shell command plugins¶
These plugins add additional commands to the shell:
- awesome: Use prompts fromAwesome ChatGPT Prompts
- database: Send natural language commands to a databaseWARNING: POTENTIALLY DANGEROUS – DATA INTEGRITY CANNOT BE GUARANTEED.
- data_query: Send natural language commands to a loaded file of structured data
https://github.com/llm-workflow-engine/lwe-plugin-data-query
- gist: Post a conversation tohttps://gist.github.com
- pastebin: Post a conversation tohttps://pastebin.com
- shell: Transform natural language into a shell command, and optionally execute itWARNING: POTENTIALLY DANGEROUS – YOU ARE RESPONSIBLE FOR VALIDATING THE COMMAND RETURNED BY THE LLM, AND THE OUTCOME OF ITS EXECUTION.
- test: Test plugin, echos back the command you give it
Provider plugins¶
These plugins add additional LLM providers:
NOTE: Most provider plugins are NOT chat-based, and instead return a single response to any text input.These inputs and responses are still managed as ‘conversations’ for storage purposes, using the same storagemechanism the chat-based providers use.
Supported providers¶
NOTE: While these provider integrations are working, none have been well-tested yet.
- provider_ai21: Access toChat AI21 models
https://github.com/llm-workflow-engine/lwe-plugin-provider-chat-ai21
- provider_azure_openai_chat: Access toAzure OpenAI chat models
https://github.com/llm-workflow-engine/lwe-plugin-provider-azure-openai-chat
- provider_chat_anthropic: Access toAnthropic chat models
https://github.com/llm-workflow-engine/lwe-plugin-provider-chat-anthropic
- provider_chat_anyscale: Access toAnyscale chat models
https://github.com/llm-workflow-engine/lwe-plugin-provider-chat-anyscale
- provider_chat_cohere: Access toCohere chat models
https://github.com/llm-workflow-engine/lwe-plugin-provider-chat-cohere
- provider_chat_fireworks: Access toFireworks chat models.
https://github.com/llm-workflow-engine/lwe-plugin-provider-chat-fireworks
- provider_chat_google_genai: Access toGoogle GenAI chat models.
https://github.com/llm-workflow-engine/lwe-plugin-provider-chat-google-genai
- provider_chat_groq: Access toGroq chat models.
https://github.com/llm-workflow-engine/lwe-plugin-provider-chat-groq
- provider_chat_mistralai: Access toMistralAI chat models
https://github.com/llm-workflow-engine/lwe-plugin-provider-chat-mistralai
- provider_chat_ollama: Access toOllama chat models
https://github.com/llm-workflow-engine/lwe-plugin-provider-chat-ollama
- provider_chat_together: Access toTogether chat models
https://github.com/llm-workflow-engine/lwe-plugin-provider-chat-together
- provider_chat_vertexai: Access toGoogle Vertex AI chat models.
https://github.com/llm-workflow-engine/lwe-plugin-provider-chat-vertexai
- provider_chat_xai: Access toxAI chat models.
https://github.com/llm-workflow-engine/lwe-plugin-provider-chat-xai
- provider_huggingface_hub: Access toHugging Face Hub models
https://github.com/llm-workflow-engine/lwe-plugin-provider-huggingface-hub
- provider_openai: Access to non-chatOpenAI models (GPT-3, etc.)
https://github.com/llm-workflow-engine/lwe-plugin-provider-openai
- provider_openrouter: Access toOpenRouter models
https://github.com/llm-workflow-engine/lwe-plugin-provider-openrouter
- provider_requesty: Access toRequesty models
https://github.com/llm-workflow-engine/lwe-plugin-provider-requesty
- provider_vertexai: Access toGoogle Vertex AI text/code models.
https://github.com/llm-workflow-engine/lwe-plugin-provider-vertexai
Usage¶
Use the/providers
command for a list of currently enabled providers.
See/helpprovider
for how to switch providers/models on the fly.
Example:
/provider openai/model model_name text-davinci-003
Writing plugins¶
There is currently no developer documentation for writing plugins.
Theplugins
directory has some default plugins, examining those will give a good idea for how to design a new one.In particular, theecho
plugin is well commented. The package plugins listed above also contain many differentapproaches you can learn from.
To write new provider plugins, investigate the existing provider plugins as examples.
Currently, plugins for the shell can only add new commands.
Plugin structure¶
In order for plugins to load, a few simple conventions must be followed:
All plugins must inherit from the basePlugin class,and provide implementations of the
setup()
anddefault_config()
methods.Class name should be a camel-cased version of the plugin name:fromlwe.core.pluginimportPluginclassExamplePlugin(Plugin):""" An example plugin, does blah blah blah... """# Implement these...@abstractmethoddefsetup(self):pass@abstractmethoddefdefault_config(self):pass
The first line of the class docstring will be used as the plugin description.
- Naming conventions: Consider a plugin named
example_plugin
: File-based plugin: The filename must be the plugin name with a
.py
extension,example_plugin.py
Package-based plugin: The the entry point must be
lwe_plugins
, and the plugin name must be prefixed withlwe-plugin-
:setup(name="lwe-plugin-example-plugin",# Other setup options...entry_points={"lwe_plugins":["lwe_plugin_example_plugin = lwe_plugin_example_plugin.plugin:ExamplePlugin"]},)
- Naming conventions: Consider a plugin named
Available objects¶
An instantiated plugin has access to these objects.
self.config
: The current instantiated Config objectself.log
: The instantiated Logger objectself.backend
: The instantiated backendself.shell
: The instantiated shell