Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/simonw/llm-plugin
A cookiecutter template for building plugins for LLM
https://github.com/simonw/llm-plugin
cookiecutter cookiecutter-template llm
Last synced: 26 days ago
JSON representation
A cookiecutter template for building plugins for LLM
- Host: GitHub
- URL: https://github.com/simonw/llm-plugin
- Owner: simonw
- Created: 2023-09-28T02:37:24.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-08-17T05:10:25.000Z (3 months ago)
- Last Synced: 2024-10-06T20:51:28.886Z (about 1 month ago)
- Topics: cookiecutter, cookiecutter-template, llm
- Language: Python
- Homepage:
- Size: 19.5 KB
- Stars: 17
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# llm-plugin cookiecutter template
A cookiecutter template for creating new [llm plugins](https://llm.datasette.io/en/stable/plugins/index.html).
`
## InstallationYou'll need to have [cookiecutter](https://cookiecutter.readthedocs.io/) installed. I recommend pipx for this:
pipx install cookiecutter
Regular `pip` will work OK too.
## Usage
Run `cookiecutter gh:simonw/llm-plugin` and then answer the prompts. Here's an example run:
```bash
cookiecutter gh:simonw/llm-plugin
```
```
plugin_name []: plugin template demo
description []: Demonstrating https://github.com/simonw/llm-plugin
hyphenated [plugin-template-demo]:
underscored [plugin_template_demo]:
github_username []: simonw
author_name []: Simon Willison
```
I strongly recommend accepting the suggested value for "hyphenated" and "underscored" by hitting enter on those prompts.This will create a directory called `llm-plugin-template-demo` - the plugin name you enter is converted to lowercase and uses hyphens instead of spaces.
## Developing your plugin
Having created the new plugin structure from the template, here's how to start working on the plugin.
You can install the plugin in "editable" mode like so:
```bash
llm install -e .
```
Run this in the `llm-plugin-template-demo` directory.You can also pass the path to that directory like this:
```bash
llm install -e path/to/llm-plugin-template-demo
```To confirm it is installed, run:
```bash
llm plugins
```You should see the following:
```json
[
{
"name": "llm-plugin-template-demo",
"hooks": [
"prepare_connection",
"register_commands"
],
"version": "0.1"
}
]
```
You can run the tests for your plugin with `python -m pytest` - follow the development environment instructions in the plugin's generated README for details.