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

guidescript

v0.0.4

Published

An easy usage for LLM's GuideScript

Downloads

1,684

Readme

This package is an early alpha version and is undergoing frequent updates

GuideScript is a JavaScript/TypeScript library that brings the concept of Guidance to your applications. Inspired by Microsoft's Guidance package, GuideScript allows you to control language models more effectively and efficiently, but now in a JavaScript or TypeScript environment.

Features

  • Intuitive syntax: Define your language model interactions in a simple and clear way.
  • Supports role-based chat models: Use constructs like system, user, and assistant to define interactive dialogs.
  • Seamless integration with OpenAI models: Specifically supports 'gpt-4' and 'gpt-3.5-turbo' models.
  • Enables structured output: Interleave generation, prompting, and logical control for a richly structured interaction flow.

Installation

npm install guidescript

Example Usage

Here's a basic example of how to use GuideScript to structure a chat with the language model.

import GuideScript, { assistant, generate, system, user } from "guidescript";

// Initialize GuideScript with your OpenAI API Key and desired model
const guidescript = new GuideScript("OPENAI_API_KEY", "gpt-3.5-turbo");

// Define a question
const question = "What is the meaning of life?";

// Define the chat flow
const chatFlow = [
  system`You are a helpful assistant.`,
  user`I would like to know the answer to the following question:
  ${question}
  Can you suggest 3 world-class experts (past or present) who would be great at answering this question? Please don't provide an answer or comment on the question at this point.`,
  assistant`${generate("experts", { temperature: 0, maxTokens: 300 })}`,
  user`Thanks for the suggestions. Now, please provide an answer as if these experts had collaborated in writing a joint anonymous answer. Their identities should not be revealed, and it should not be obvious that a panel of experts provided the answer. If the experts would disagree, present their different positions as alternatives in the answer itself (e.g., 'Some might argue... others might argue...'). Begin your answer with the word "ANSWER:"`,
  assistant`${generate("answer", { temperature: 0, maxTokens: 500 })}`,
];

// Execute the chat and log the response
guidescript.chat(chatFlow).then(response => console.log(response));

In this example, we define a question, structure a chat around this question, and use the chat method to execute this chat with the language model.