An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          

# Contortionist

Latest Contortionist NPM Version
License for contortionist
Downloads per week on NPM for contortionist
Status of tests for contortionist repository
Code Coverage for contortionist
DeepSource issues for contortionist

![alt text](./packages/contort/assets/eye.webp)

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;
}
});
```