https://github.com/simonw/llm-markov
Plugin for LLM adding a Markov chain generating model
https://github.com/simonw/llm-markov
Last synced: 3 months 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 (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-07-12T14:38:02.000Z (almost 2 years ago)
- Last Synced: 2024-05-01T23:17:36.515Z (about 1 year ago)
- Language: Python
- Size: 14.6 KB
- Stars: 10
- Watchers: 3
- Forks: 1
- Open Issues: 2
-
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
```
## UsageThis 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/activateNow install the dependencies and test dependencies:
pip install -e '.[test]'
To run the tests:
pytest