This project was created in order to streamline the creation and editing of forms by new CHEFS users. Allowing the user to type, in natural language, a request for generating or altering an existing form. Features included in this proof of concept include:
- Context: Adding documentation or source material for the forms product, in this case custom form components, and passing this information as reference to the Large Language Model. The large language model then can utilize this specialised information which may not have been in its training data.
- Form Compression: This was implemented to reduce the number of tokens used in the LLM requests. A token is the name for the base unit of data for LLM processing. In a text context a token could be a word, a section of a word, or a single character. In sending an edit request the entire existing form which may consist of thousands of tokens is sent to the LLM. Shrinking these forms allows for a more efficient use of the LLM's processing.
- Output Sanitizing: Reducing the response space into a form JSON aids in preventing unintended usage of the LLM.
To run this project, you will need to alter the following environment variables in the sample.env file and rename to .env
Backend
backend/sample.env
:
OPENAI_API_KEY=YOUR_OPENAI_API_KEY
: See instructions below for generating an API Key
Frontend
For frontend/sample.env
:
REACT_APP_BACKEND=http://{Your IP Address}:3081
-
Sign Up or Log In: Visit OpenAI Platform and sign in to your OpenAI account. If you don’t have an account, you’ll need to sign up first.
-
Access the API Section: Once logged in, navigate to the API keys section. This is usually accessible through the main navigation menu as shown below.
- Generate New API Key: Using the
+ Create new Secret key
button we can create a new Token. This token can be shared across the team. Also we can create an organisation and invite members to the team so can create secret keys for users as well. You can control the Organisation and Team from the Settings menu.
- Add credit card to Billing Section: Within the OpenAI account page, find and navigate to the Settings section. You can add the payment method in here.
- Model Selection and Pricing: You can find OpenAI API pricing here at Pricing. We have defaulted to the GPT 3.5 Turbo Model. Below you can see the pricing and rate limits for the selected model.
- Reviewing Usage: To review the usage on your OpenAI account, you can click here Platform Account Usage
Ensure you have the latest version of Docker Desktop installed with the command line interface.
Navigate to /docker/
Update the /docker/sample.env
file and rename it to .env
Run docker-compose up --build -d
To test if the backend is up and running, you can navigate to http://localhost:3001/health.
To validate it running correctly, you can navigate to http://localhost to use your dockerized instance of the frontend.
Next, in a terminal, navigate to /backend/
.
run npm install
and node server.js
to run the backend.'
To test if the backend is up and running, you can navigate to http://localhost:3001/health.
in a new terminal window, navigate to /frontend/
run npm install
and npm start
to run the frontend.
You can then navigate to http://localhost:3000 to use your local instance.