This github project is a demo to help non-devs to get started executing their rivet graphs in node.js As the official docs require us to run a TypeScript application this might prove a considerable challenge to any non-developer. So this project includes everything you need to be able to run it immediately in Visual Studio Code with a few simple steps.
Video-Tutorial: https://youtu.be/YC2zYA7cZJ4
- Install Visual Studio Code: https://code.visualstudio.com/download
- Install node.js + node package manager: https://nodejs.org/en/download/ (in the install process, make sure you also install npm package manager!)
- (Optional) Install Github: https://desktop.github.com/
- Go to https://github.com/ai-made-approachable/rivet-node-basic-example
- Either press "<> Code", "Download ZIP" and unzip the project somewhere OR use
git clone https://github.com/ai-made-approachable/rivet-node-basic-example.git
- Go to /.vscode/ folder
- Rename "launch_sample.json" to "launch.json"
- Open "launch.json" and replace the value for OPEN_API_KEY with your OpenAI Key
- Open "Terminal -> New Terminal" and enter
npm install
Just press "Run -> Start Debugging" in Visual Studio Code. Results can be seen in the "DEBUG CONSOLE"
- Add your own Rivet projects to the root folder of the project
- Edit "rivet.ts" in /src" folder and update "project" and "graph" variables
- Change inputs (can also be left empty =
"inputs": {}
) - Adjust output "result.response.value" accordingly to your graph outputs (if you have any)
If you want to use plugins, you need to import and register them first.
Example for mongoDB Plugin
import rivetMongoDbPlugin from 'rivet-plugin-mongodb';
import * as Rivet from '@ironclad/rivet-node';
Rivet.globalRivetNodeRegistry.registerPlugin(rivetMongoDbPlugin(Rivet));