Skip to main content

Built and signed on GitHub Actions

Works with
This package works with Cloudflare Workers, Node.js, Deno, BunIt is unknown whether this package works with Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
It is unknown whether this package works with Browsers
JSR Score100%
Published9 months ago (0.1.1)

Add magic spells to your code.

incant

JSR

Add magic spells to your code.

dancing

usage

Incant gives you primtivies to integrate language model invocations safely.

Warning

All data provided as input to incant primitives will be sent to upstream inferene providers. Avoid sending personal and sensitive information.

// incant looks in your env array for an OPENAI_API_KEY & other vars // easy for end users to configure for your cli const { createSelector, createFilter } = createIncant({ env: Deno.env.toObject(), }); 

selectors

// create a function to pick the highest number const pickHighestNumber = createSelector<number>("Pick the highest number"); const input = [ 1, 10, 3, 10000, 5, 999, ]; // type-safe and hallucination-safe – output is guaranteed to be one of input array const highestNumber = await pickHighestNumber(input); 

filters

// make a function to filter only male names const filterMaleNames = createFilter<string>("Return male names"); const maleNames = await filterMaleNames([ "John", "Jack", "Jane", "Beatrice", "Mike", "Emily", "Charlie", "Robin", "Alex", ]); // original array ordering is preserved // no hallucinations possible: output is guaranteed to be subset of input array // [ "John", "Jack", "Mike", "Charlie", "Alex" ] 
Built and signed on
GitHub Actions

Add Package

deno add jsr:@monty/incant 

Import symbol

import * as incant from "@monty/incant"; 
or

Import directly with a jsr specifier

import * as incant from "jsr:@monty/incant";