Inferable from Scratch
A step-by-step guide to create a minimal NodeJS project without scaffolding
This guide will walk you through creating a minimal NodeJS project to integrate with Inferable. This is an example that steps through the core concepts of Inferable.
Prerequisites
Make sure you have Node.js installed and have set up your Inferable machine key as an environment variable (INFERABLE_API_SECRET
).
You can get your API secret by running:
Install dependencies
Install the necessary packages:
Initialize the Inferable client
Create a new file called index.ts
and add the following code to initialize the Inferable client:
Register a function
Now, let’s add a function that greets users:
Start the service
Finally, let’s start the service:
Run the project
To run this example, save the file as app.js
and execute it using Node.js:
Interacting with the service
Now that you have the service running, you can interact with it via:
- The Inferable App Web UI
- The Inferable CLI with
inf runs create "YOUR PROMPT"
- The Inferable API.
Was this page helpful?