thekevinscott / Contortionist

Control what LLMs can, and can't, say

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

Control what LLMs can, and can't, say.

Install

npm install contortionist

Usage

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

About

Control what LLMs can, and can't, say

License:MIT License


Languages

Language:TypeScript 95.3%Language:HTML 3.6%Language:JavaScript 1.0%Language:CSS 0.1%