Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/simonw/llm-markov
Plugin for LLM adding a Markov chain generating model
https://github.com/simonw/llm-markov
Last synced: 27 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 1 year ago)
- Default Branch: main
- Last Pushed: 2023-07-12T14:38:02.000Z (over 1 year ago)
- Last Synced: 2024-05-01T23:17:36.515Z (7 months 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
[![PyPI](https://img.shields.io/pypi/v/llm-markov.svg)](https://pypi.org/project/llm-markov/)
[![Changelog](https://img.shields.io/github/v/release/simonw/llm-markov?include_prereleases&label=changelog)](https://github.com/simonw/llm-markov/releases)
[![Tests](https://github.com/simonw/llm-markov/workflows/Test/badge.svg)](https://github.com/simonw/llm-markov/actions?query=workflow%3ATest)
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](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