Skip to content

9P9/gpt4all-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Prerequisites

Node.js installed on your machine

Installation

Clone or download the code to your local machine.

Open a terminal or command prompt and navigate to the project directory.

Install the required dependencies by running the following command:

npm install

Different Platform Use:

If you're using a different platform ensure you use the correct binary for your OS from:

  • GPT4ALL Then Adjust the code in server.js to fit:
	let GPT = new GPT4('./ai/gpt4all-lora-quantized-win64'); //Windows
	let GPT = new GPT4('./ai/gpt4all-lora-quantized-OSX-m1'); //M1 Mac/OSX
	let GPT = new GPT4('./ai/gpt4all-lora-quantized-OSX-intel'); //Intel Mac/OSX
	let GPT = new GPT4('./ai/gpt4all-lora-quantized-linux-x86'); //Linux

How to get the GPT4ALL model!

Download the gpt4all-lora-quantized.bin file from Direct Link or [Torrent-Magnet].

Where to Put the Model:

Ensure the model is in the main directory! Along with exe

image

Usage

Start the server by running the following command:

npm start

This will start the Express server and listen for incoming requests on port 80.

To use the /gpt endpoint, make a POST request to http://localhost/gpt with a JSON object in the request body containing a prompt property. For example:

const axios = require('axios');

const prompt = 'How are you doing today?';

async function main(){
	let res = await axios.post('http://localhost/gpt', { prompt });
	console.log(res.data);
}
main();

This will return a JSON object containing the generated text and the time taken to generate it.

To use the /gpt/:prompt endpoint, make a GET request to http://localhost/gpt/:prompt, where :prompt is the prompt you want to use. For example:

    GET http://localhost/gpt/Hello,%20how%20are%20you?

    This will return a JSON object containing the generated text and the time taken to generate it.

    To stop the server, press Ctrl+C in the terminal or command prompt where it is running.

Related Repos: - GPT4ALL - Unmodified gpt4all Wrapper

About

A simple API for gpt4all

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published