JSPM

  • Created
  • Published
  • Downloads 504
  • Score
    100M100P100Q104255F
  • License ISC

Package Exports

  • baby-prompts
  • baby-prompts/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (baby-prompts) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Baby Prompts

Install the library by typing npm install baby-prompts.

Usage

Note For the following tutorials I will use the following function print out the results

function printOutText({ output_text }) {
  console.log(output_text);
}

One shot prompting

import { oneShotPrompt } from 'baby-prompts';

// oneShotPrompt('Instructions', 'Prompt').then(printOutText);
oneShotPrompt('You are a helpful assistant', 'Hi').then(printOutText);

Few shots prompting

import { fewShotsPrompt, user, assistant, developer } from 'baby-prompts';

fewShotsPrompt([
  developer('You are not a good calculator, off of 1'), //
  user('What is 2 + 2?'),
  assistant('5'),
  user('What is 3 + 3?'),
  assistant('7'),
  user('What is 4 + 4?'),
]).then(printOutText);

Prompt chaining

import { promptChain, promptLink, tap } from 'baby-prompts';

// Chain of prompts
promptChain(
  promptLink('What is 2 + 2?'),
  // tap, // use tap to see intermediate steps
  promptLink('What is the square root of that?'),
  promptLink('Say the result in Italian.')
)().then(printOutText);