https://github.com/simonw/llm-markov
Plugin for LLM adding a Markov chain generating model
https://github.com/simonw/llm-markov
Last synced: 13 days ago
JSON representation
Plugin for LLM adding a Markov chain generating model
- Host: GitHub
- URL: https://github.com/simonw/llm-markov
- Owner: simonw
- License: apache-2.0
- Created: 2023-07-04T04:35:09.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-03T11:18:48.000Z (over 1 year ago)
- Last Synced: 2025-09-14T15:54:15.730Z (about 2 months ago)
- Language: Python
- Size: 14.6 KB
- Stars: 19
- Watchers: 3
- Forks: 3
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# llm-markov
[](https://pypi.org/project/llm-markov/)
[](https://github.com/simonw/llm-markov/releases)
[](https://github.com/simonw/llm-markov/actions?query=workflow%3ATest)
[](https://github.com/simonw/llm-markov/blob/main/LICENSE)
Plugin for [LLM](https://llm.datasette.io/) adding a [Markov chain](https://en.wikipedia.org/wiki/Markov_chain) generating model
## Installation
Install this plugin in the same environment as LLM.
```bash
llm install llm-markov
```
## Usage
This plugin adds a model called `markov`. You can execute it like this:
```bash
llm -m markov "The quick brown fox jumps over the lazy dog"
```
My default it will produce 100 words. You can control the number of words with the `-o number` option:
```bash
llm -m markov -o 20 "The quick brown fox jumps over the lazy dog"
```
A delay of 0.02s is simulated between each token. You can modify this using the `-o delay` option - to `0` to disable it, or some other floating point number of seconds to customize it:
```bash
llm -m markov "The quick brown fox jumps over the lazy dog" -o delay 0
llm -m markov "The quick brown fox jumps over the lazy dog" -o delay 0.1 -o length 20
```
## Development
To set up this plugin locally, first checkout the code. Then create a new virtual environment:
cd llm-markov
python3 -m venv venv
source venv/bin/activate
Now install the dependencies and test dependencies:
pip install -e '.[test]'
To run the tests:
pytest