https://github.com/thekevinscott/contortionist
Control what LLMs can, and can't, say
https://github.com/thekevinscott/contortionist
gbnf llamacpp llamafile llm transformersjs
Last synced: 5 months ago
JSON representation
Control what LLMs can, and can't, say
- Host: GitHub
- URL: https://github.com/thekevinscott/contortionist
- Owner: thekevinscott
- License: mit
- Created: 2024-03-19T13:08:37.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-13T20:00:26.000Z (about 2 years ago)
- Last Synced: 2024-04-14T01:13:00.590Z (about 2 years ago)
- Topics: gbnf, llamacpp, llamafile, llm, transformersjs
- Language: TypeScript
- Homepage:
- Size: 854 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Contortionist

Control what LLMs can, and can't, say.
## Install
```bash
npm install contortionist
```
## Usage
```javascript
import Contortionist from 'contortionist';
const grammar = 'root ::= "foo"';
const contortionist = new Contortionist({
grammar,
model: {
protocol: 'llama.cpp',
endpoint: 'http://localhost:4445',
},
});
const result = await contortionist.execute(prompt, {
n: 40,
stream: true,
callback: ({ partial }) => {
output.textContent = partial;
}
});
```