chatgpt-npm
v1.0.6
Published
ChatGPT-NPM is a package that provides a chatbot functionality powered by the GPT language model architecture. It allows users to interact with the chatbot through natural language input, providing intelligent and personalized responses based on the user'
Downloads
8
Maintainers
Readme
chatgpt-npm NPM Package
chatgpt-npm is NPM package provide a powerful tool that allows Node.js developers to generate natural language responses using the OpenAI ChatGPT API.
Table of Contents
Installation
To install this package, simply run the following command in your Node.js project directory:
npm i chatgpt-npm
Usage
To use the generateChatGPTResponse function in your JavaScript code, you need to import it like this:
Example
const chatgpt = require('chatgpt-npm');
Once you've imported the function, you can use it to generate responses like this:
axios
let searchData = req.body.search;
const searchResult = await chatgpt.generateChatGPTResponse(searchData);
console.log(searchResult)
In this example, we are passing the searchData object from the request body to the generateChatGPTResponse function, which will use the OpenAI GPT-3 model to generate a response. The response is then logged to the console using console.log(searchResult).
Note that generateChatGPTResponse is an asynchronous function, so you need to use the await keyword when calling it. Also, make sure that you have properly configured the OpenAI API credentials in order to use the function.
The generateChatGPTResponse function takes a string prompt as input and returns a string response generated by the ChatGPT API. Note that you will need to set the OPENAI_API_KEY environment variable with your actual OpenAI API key before using this package.
OpenAI
let searchData = req.body.search;
const searchResult = await chatgpt.generateChatGPTOpenAIResponse(searchData);
console.log(searchResult)
You can use the generateChatGPTOpenAIResponse function from the chatgpt module to generate a response and store the conversation history using the OpenAI ChatGPT API.
Prerequisites
- Node.js >= 12.0.0
- npm
- OpenAI API key
License
This package is licensed under the MIT license. See the LICENSE file for more details.
How to reach me?
If you have any questions or comments about this package, feel free to reach out to me on:
About the Author
This package is made with ❤️ by Abhinav Kashyap. Abhinav is a javascript developer with extensive experience in developing chatbot applications using natural language processing (NLP) techniques.