This is a POC for a form assistant is a assistant that shall help the user to fill out some form.
- On-Demand Form Generation: Users trigger form creation using natural language (e.g.,
!createForm Jira user story ticket). The system uses Structured Outputs (Zod-validated) to ensure the generated UI components match the specific domain requirements. - Adaptive Schema: The form is not set in stone. Users can dynamically modify field types (e.g., converting a text field to a dropdown) as the requirements evolve during the conversation.
The assistant implementation follow the Human-in-the-Loop idea in the sense that the assistant proposes form states and the user can accept or reject them rather than overwriting state directly. This allows the user to have more control over the form generation process and to ensure that the generated form meets their needs. For this purpose, the LLM is provided with one tool per form field type:
proposeStateForFreetextQuestionToolproposeStateForChooserQuestionToolproposeStateForMultipleChoiceQuestionToolproposeStateForBooleanQuestionTool
- Start postgres with
docker-compose up -d - Run
npm installto install dependencies - Run
npm run db:initializeto initialize the database - Run
npm run devto start the server in development mode
- Node >= 20
- Docker / Docker Compose (for running Postgres)
- OpenAI API Key or Azure OpenAI API Key (depending on your choice)
- A .env file with the following variables:
USE_AZURE="false" # Set to "true" to use Azure OpenAI, otherwise uses OpenAI
AZURE_OPENAI_API_KEY=
AZURE_OPENAI_ENDPOINT=
AZURE_OPENAI_VERSION=
AZURE_OPENAI_LLM_DEPLOYMENT_NAME_gpt_4o= # Should also work with other model names - i only tested with gpt-4o & gpt-5-nano. Preffered 4o
OPENAI_MODEL_NAME=
OPENAI_EMBEDDING_MODEL_NAME="text-embedding-ada-002"
POSTGRES_USER=postgres
POSTGRES_PASSWORD=password
POSTGRES_PORT=5432
DATABASE_URL="postgres://postgres:password@localhost:5432/formassistant"
OPENAI_API_KEY=


