New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

easygpt

Package Overview
Dependencies
Maintainers
2
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

easygpt

NPM module to communicate with the ChatGPT API

latest
Source
npmnpm
Version
1.6.2
Version published
Weekly downloads
12
100%
Maintainers
2
Weekly downloads
 
Created
Source

easyGPT: ChatGPT API wrapper 🤖

Generate human-like text effortlessly with easyGPT - the powerful ChatGPT API wrapper.

import EasyGPT from "easygpt";
const gpt = new EasyGPT();

gpt
    .setApiKey("<YOUR API KEY HERE>")
    .addMessage("Hello ChatGPT!");
    .then(response => console.log(response))    

Installation

Before installing make sure your Node.js version is at least v14.

Your project must be running ES Modules.

$ npm i easygpt

Docs

Quick Start

Import the package.

import EasyGpt from "easygpt";

Create a new instance of EasyGpt.

const gpt = new EasyGpt();

Set your API key.

gpt.setApiKey("your API key goes here.");

Create one for free @ https://platform.openai.com/account/api-keys

Basic Example

// Add a prompt you would like to say to ChatGPT.
gpt
  .addMessage("Hello ChatGPT!")
  // Give some instructions to the AI
  .addRule("Use emoticons in every answer and use a friendly tone.");

// Get the response from ChatGPT.
const response = await gpt.ask();

console.log(response.content);

Response

Hello! How can I assist you today? 😊

Multiple Messages Example

gpt.addMessage("Hello ChatGPT! My name is Adam!");

let response = await gpt.ask();

console.log(response.content);

// Add an additional  message to the stack.
gpt.addMessage("What was my name again?");

response = await gpt.ask();

console.log(response.content);

Responses

Hello Adam! It's nice to meet you. How can I assist you today?

Your name is Adam.

Further Examples

There is a long list of tested examples on our documentation site.

easygpt.dev/guide/examples

Created By

Francesco Gruosso - Github / LinkedIn / Website

Adam Govier - Github / LinkedIn / Website

Keywords

openai

FAQs

Package last updated on 26 Mar 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts