1.0.8 • Published 1 year ago

@savant/prompting v1.0.8

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

@savant/prompting

A library for composing LLM Prompts and executing them.

Variables

Variables can be defined within a prompt in the following format:

{{{variableName}}}

PtPrompt

const { PtPrompt } = require('@savant/prompting');
const prompt = await PtPrompt.load("./path/to/prompt.pt"); // creates a prompt from a file (.pt or .prompt)
const prompt = new PtPrompt(promptString); // creates a prompt from a string
const builtPromptStr = await prompt.build(anyVariablesInPrompt); // builds the prompt with the given variables

Model Modes

Chat

const { Chat } = require('@savant/prompting');
const chat = new Chat(prompt, messages, openai);
const response = await chat.execute(anyVariablesInPrompt, userMessageAsPrompt); // response is saved in messages

Completion

const { Completion } = require('@savant/prompting');
const completion = new Completion(prompt, openai);
const response = await completion.execute(anyVariablesInPrompt);
1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago