A demo project for leveraging LLM to query a database with natural languages, and render charts for the results. The implementation also takes care of access control and ensures users only see data they are allowed to see.
Find more information in this blog post.
- Remix.run as full-stack framework
- Langchain for interfacing with OpenAI API
- Prisma ORM for data modeling database access
- ZenStack for access control
- Charts.js for creating diagrams
-
npm install
-
Prepare environment variables copy ".env.example" to ".env" and fill in OPENAI_API_KEY
-
Run ZenStack code generation
npm run generate
-
Deploy Prisma migrations
npx prisma migrate deploy
-
Seed the database
npx prisma db seed
-
Start dev server
npm run dev
Login with one of the following users:
- Username: "tom@test.com", Password: "12345678". This user only sees orders from "Washington" region.
- Username: "jerry@test.com", Password: "12345678". This user only sees orders from "California" region.