This is a demo project that showcases how to create a user and registering them using AI 🤖
, using NLUX
, NLBridge
, and the OpenAI
API.
- Create a simple AI assistant that can register user.
- Use
NLUX
React
for the user interface. - Use
NLBridge
Node.js
to connect to the OpenAI API and call a user defined function.
- Clone the repository.
- Navigate to the project directory
ai-calendar-booking/api
- Edit the
.env
file and add your OpenAI API key. - Run the following commands:
npm install
npm run dev
This will start the Node.js server on http://localhost:3000
.
- Navigate to the project directory
ai-calendar-booking/ui
- Run the following commands:
npm install
npm run dev
- The server side code is implemented using
NLBridge
andNode.js
.
@nlbridge/express
is the Node.js
middleware by NLKit, the same team that created NLUX
.
https://github.com/nlkitai/nlbridge
- The default NLBridge middleware is used to create a simple API endpoint that connects to the OpenAI API.
- The prompts used to instruct the LLM to interpret the user input are defined in the
api/src/instructions
.
3 prompts exist and be adjusted:
context.ts
— Give the overall context of the conversation, and what the AI can and cannot do.taskName.ts
— The prompt used to determine if the user wants to run a task, and if so, which task.taskParams.ts
— The prompt used to gather the parameters for the task.
- The client side code is implemented using
NLUX
andReact
. - The app is wrapped in
<MyAiContext.Provider>
to provide AI context used across the app. - In
App.tsx
, we useuseAiTask
to register a task that can be called by the AI assistant.
For further assistance, please refer to the official documentation of NLUX
and NLBridge
.
https://docs.nlux.ai