npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@gpt-mind/prompts

v0.1.6

Published

A collection of prompts for the gpt-mind library

Downloads

2

Readme

GPT Mind Prompts

This repository contains a collection of prompts for the GPT-3 API.

Installing

npm install @gpt-mind/prompts

Usage

const prompts = require('@gpt-mind/prompts');


const definition = prompts.getPromptDefinition(`given the following three statements:
"{{statement1}}"
"{{statement2}}", and 
"{{statement3}}", which top two statements are most likely to be true?`);

const statements = {
  statement1: 'The sky is blue.',
  statement2: 'The sky is green.',
  statement3: 'The sky is red.',
};

if (definition.validate(statements)) { // check that all required params are present
  const response = await definition.complete(params, apiKey, {}, ['mostlikely', 'nextmostlikely']);
  console.log(response); // { "mostlikely": "The sky is blue.", "nextmostlikely": "The sky is green." }
}

Function Signature

function getPromptDefinition(prompt: string): PromptDefinition

Description

This function gets the prompt definition object based on a given prompt string. It extracts replacement tokens from the prompt string, and creates an object with properties for prompt, params, validate, replace, and complete.

The validate property checks if all required parameters are present in the params object. The replace property replaces all replacement tokens in the prompt string with their corresponding values from the params object. The complete property uses an OpenAI API to complete the given prompt with a valid response.

Parameters

prompt - A string representing the prompt to generate the prompt definition object for. Return Value Returns an object of type PromptDefinition which contains the following properties:

prompt

A string representing the original prompt.

  • params - An array of strings representing the replacement tokens in the prompt string.

validate

A function that validates the params object to make sure all required params are present. It takes one parameter:

  • params - An object containing the parameter values. Returns a boolean value indicating whether the params object is valid or not.

replace

A function that replaces all replacement tokens in the prompt string with their corresponding values from the params object. It takes one parameter:

  • params - An object containing the parameter values. Returns a string representing the prompt with replacement tokens replaced by their values.

complete

A function that uses the OpenAI API to complete the given prompt with a valid response. It takes three parameters:

  • params - An object containing the parameter values.
  • apiKey - A string representing the API key to use for the OpenAI API.
  • settings - An optional object containing additional settings to use for the OpenAI API.
  • responseFields - An optional array of strings representing the fields to return from the OpenAI API response. Defaults to ['results']. Returns a Promise that resolves to a string representing the completed prompt.

Example Usage

const apiKey = 'my-api-key';

const prompt = 'My name is {{name}} and I like {{food}}.';
const params = { name: 'John', food: 'pizza' };
const promptDefinition = getPromptDefinition(prompt);

if (promptDefinition.validate(params)) {
  const completedPrompt = await promptDefinition.complete(params, apiKey);
  console.log(promptDefinition.replace(params) + completedPrompt);
}

Prompts

  • meaningOfStatement - What does this statement mean?
  • provideEvidence - Provide evidence for this statement.
  • truthfulness - Is this statement true?
  • provideImplications - Provide implications for this statement.
  • provideContext - Provide context for this statement.
  • provideCounterExamples - Provide counter examples for this statement.
  • provideEvidenceComparison - Provide evidence for this statement compared to this other statement.
  • logicalContradiction - Is this statement a logical contradiction?
  • provideImplicationsComparison - Provide implications for this statement compared to this other statement.
  • orderStatementsByGenerality - Order these statements by generality.
  • provideStatementRelationship - Provide a relationship between these two statements.
  • logicalContradictionMultiple - Is this statement a logical contradiction with these other statements?
  • provideEvidenceRelationship - Provide evidence for this statement compared to this other statement.
  • isStatementVisualizable - Is this statement visualizable?
  • describeImageFromStatement - Describe an image from the statement
  • identifyChallengesVisualizingStatement - Identify challenges visualizing this statement.
  • feelingAgent - provide a conversational response given an emotional state and current conversation
  • leftBrainAgent - provide a conversational response given a left brain state and current conversation
  • rightBrainAgent - provide a conversational response given a right brain state and current conversation
  • expandedContext - provide a conversational response given a context and current conversation
  • concensus - provide a conversational response given a concensus and current conversation
  • testComprehension - provide a conversational response given a test and current conversation
  • testComprehensionScale - provide a conversational response given a test and current conversation
  • conversationThoughts - provide a conversational response given a thought and current conversation
  • thoughtFeelings - provide a conversational response given a thought and current conversation

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for more information.


summary with usage:

GPT Mind Prompts

A library for generating prompts for the GPT-3 API. contains a number of pre-generated prompts as well as a function for generating your own. The function allows you to create prompts with replacement tokens that can be replaced with values from a params object, giving an easy programmatic interface for calling propmpts.

Installing

npm install @gpt-mind/prompts

Usage

Example 1

const prompts = require('@gpt-mind/prompts');
const definition = prompts.getPromptDefinition(prompts.meaningOfStatement);

const params = {
  statement: 'The sky is blue.',
};

if (definition.validate(params)) {
  const completedPrompt = await definition.complete(params, apiKey);
  console.log(definition.replace(params) + completedPrompt);
}

Example 2

const prompts = require('@gpt-mind/prompts');
const definition = prompts.getPromptDefinition(`My name is {{name}} and I like {{food}}.`);
const params = { name: 'John', food: 'pizza' };

if (definition.validate(params)) {
  const completedPrompt = await definition.complete(params, apiKey);
  console.log(definition.replace(params) + completedPrompt);
}