https://github.com/developersdigest/autogpt-langchain-nodejs
https://github.com/developersdigest/autogpt-langchain-nodejs
Last synced: 10 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/developersdigest/autogpt-langchain-nodejs
- Owner: developersdigest
- Created: 2023-04-28T19:06:58.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-06-12T22:36:49.000Z (over 2 years ago)
- Last Synced: 2025-05-15T04:33:31.286Z (10 months ago)
- Language: JavaScript
- Size: 12.7 KB
- Stars: 18
- Watchers: 3
- Forks: 10
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# AutoGPT with Langchain in Node.js
This repository contains a Node.js boilerplate for getting started with AutoGPT using Langchain. The project demonstrates how to set up and use the experimental AutoGPT implementation in a Node.js environment. It provides a foundation for building applications that leverage the power of generative language models and external APIs to create dynamic and interactive content.
## Prerequisites
- Node.js version 18 or higher
- OpenAI API key (obtain from https://platform.openai.com/account/api-keys)
- SERP API key (obtain from https://serpapi.com/)
## Getting Started
1. Clone the repository:
git clone https://github.com/your-username/autogpt-langchain-nodejs.git
cd autogpt-langchain-nodejs
2. Install dependencies:
npm install langchain hnswlib dotenv
3. Create a `.env` file in the root directory and add your API keys:
OPENAI_API_KEY=your_openai_api_key
SERPAPI_API_KEY=your_serp_api_key
4. Run the `index.js` script to see AutoGPT in action:
node index.js
## How It Works
The `index.js` script performs the following steps:
- Imports necessary modules from Langchain, including AutoGPT, ReadFileTool, WriteFileTool, SerpAPI, NodeFileStore, HNSWLib, OpenAIEmbeddings, and ChatOpenAI.
- Configures dotenv to manage environment variables.
- Instantiates NodeFileStore, tools for file operations and SERP API, and HNSWLib with OpenAI embeddings.
- Creates an AutoGPT instance with the ChatOpenAI model, tools, and memory.
- Demonstrates how to use AutoGPT to perform tasks and generate content.
## Customization
This boilerplate provides a starting point for your own projects. You can customize the code to create a wide range of applications, such as generating dynamic web content, creating interactive chatbots, and more. Feel free to experiment and explore the capabilities of AutoGPT and Langchain!