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-agent

v0.1.0

Published

Simple task management library, leveraging GPT capabilities while abstracting away natural language complexities

Downloads

2

Readme

gpt-agent

Simple task management library, leveraging GPT capabilities while abstracting away natural language complexities

github stars npm version npm downloads license

Getting Started

Install the module with: npm install gpt-agent

Basic Usage

import { Agent } from 'gpt-agent'

// We'll store the paragraphs here
const paragraphs = []

// Create new agent instance, passing in your OpenAI API key
const agent = new Agent({
  apiKey: process.env.OPENAI_API_KEY
})

// Set a goal for the agent
agent.setGoal('Write 3 paragraphs about the history of the internet')

// Add a task to the agent to write a paragraph
agent.addTask('write_paragraph', (response, next) => {
  console.log(`Paragraph ${paragraphs.length + 1} of 3 received.`)
  paragraphs.push(response)
  next()
})

// Add a task to the agent to finish (important!)
agent.addTask('finish', () => {
  console.log('Finished!')
  console.log(paragraphs.map((p, i) => `${i + 1}. ${p}`).join('\n'))
})

// Start the agent
agent.start()

Output:

Paragraph 1 of 3 received.
Paragraph 2 of 3 received.
Paragraph 3 of 3 received.
Finished!
1. The history of the internet dates back to the 1960s when the U.S. Department of Defense initiated a research project called the ARPANET. It was developed as a communication system that would be resistant to a nuclear attack, and consisted of a collection of computers communicating with one another using a protocol called NCP.
2. Over the next few decades, the ARPANET grew in popularity, and in the 1980s, a new protocol called TCP/IP was developed which allowed multiple networks to be interconnected. This paved the way for the birth of the internet as we know it today. In 1983, the ARPANET switched over to using TCP/IP, and the term 'internet' was first used shortly thereafter.
3. Throughout the 1990s, the internet exploded in popularity, and many companies began offering internet services to the general public. This led to the development of the World Wide Web, which was introduced in 1991 by computer scientist Sir Tim Berners-Lee. The World Wide Web allowed for easy access to information via hyperlinks and made the internet much more user-friendly. Today, the internet is an essential tool for communication, commerce, and entertainment, and it continues to evolve and expand every day.

Configuration

The Agent constructor takes an optional configuration object with the following properties:

  • apiKey - Your OpenAI API key. If not provided, an error will be thrown.
  • model - The GPT-3 model to use. Defaults to gpt-3.5-turbo.
  • delay - The delay between requests to the OpenAI API, in milliseconds. Defaults to 0.
  • debug - Whether to log debug information to the console. Defaults to false.

License

This project is licensed under the GPL-3.0 License - see the LICENSE file for details.