Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gpt-script

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gpt-script

Simple GPT

  • 1.0.501
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

For Linux and Mac OS

Install

npm i gpt-script

or

yarn add gpt-script

Setup model

  1. Download model (https://gpt4all.io/models/ggml-gpt4all-j-v1.3-groovy.bin or more https://gpt4all.io)
  2. Create a model folder in the root of the project and move the model to model

Examples

Code

const path                = require('path')
    , GPTScript           = require('../src/index')
    , findAnswer          = require('./examples/libs/find-answer')  
    , filterAnswer        = require('./examples/libs/filter-answer')  
    , dialogPrompt        = require('./examples/libs/dialog-prompt')
    , adultDialogPrompt   = require('./examples/libs/adult-dialog-prompt')

const model = path.join(__dirname, 'models/ggml-gpt4all-j-v1.3-groovy.bin')

const gpt = new GPTScript(model, {
  langSystem: 'gpt-j',
  debug: false
})

gpt.setAttemptError(5)
gpt.setPrompt(dialogPrompt)
// gpt.setPrompt(adultDialogPrompt)
gpt.use(findAnswer)
gpt.use(filterAnswer)

gpt.execute('Hello bro!')
  .then(text => {  
    if (text) {
      console.log(text) // What's up, dude?
    } else {
      console.log('There were enough attempts, the answer could not be generated, do you want to try again?')
    }
  })

Script

yarn simple-chat 

or

npm run simple-chat 

...

See more examples

Keywords

FAQs

Package last updated on 14 May 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc