Build ChatGPT-like chatbots that are aware of your data
View Demo on YouTube (1.4 min) »
Tech Stack
·
Getting Started
·
Contributing
Report Bug
·
Request Feature
Table of content
Full stack web application, written in Next.js App Router. Create custom ChatGPT-like chatbots for your data.
- Data organization - organize learning files in folders to easily tell Agents what to learn
- Fully customizable agents - choose AI model, write System Prompt, choose temperature, select folders it should know and start talking with it!
- Convenient chat interface - create separate chats for agents and start talking with them, with features like response streaming and answer regeneration
- Response sources - view which chunks of your data AI used to generate every answer and percentage value on how similar it was to the topic of your question
- TypeScript
- React
- Next.js - React framework for full-stack applications
- Auth.js - user authentication
- Prisma - Typescript-first ORM
- PostgreSQL - SQL Database
- Vercel - Complete CI/CD and deployment
- TailwindCSS - utility-first CSS framework
- shadcn/ui - components template library on top of Radix-UI
- Lucide - icons library
- ai - Vercel AI SDK, used for AI Model response streaming from the backend
- Langchain - library for AI, used for creating embeddings
- Zod - TypeScript-first schema validation with static type inference
- React Hook Form - Performant, flexible and extensible forms with easy-to-use validation
The project is self-hosted only, we might enable cloud hosting later if there will be a demand for this.
To run the project, you will need the following env variables:
- URL string to connect to the database. The project is configured for PostgreSQL, but you can easily change it to any SQL database or MongoDB (the project was not tested with other databases). Prisma docs about database connectors: ..link..
- OpenAI API Key. You can change or add other providers in the code (src/app/api/kb/files/[fileId]/embeddings/route.ts and src/app/api/chat/[chatId]/route.ts files)
- OAuth secrets for Auth.js. Project configured for GitHub OAuth, but you can easily change it to any other OAuth provider. email or credentials auth. Auth.js docs on providers: ..link..
-
Clone this project via
git clone https://github.com/denbondd/clarix.git
-
Go to the project folder
cd clarix
-
Install packages with npm
npm install
-
Set up your
.env
file- Duplicate
.env.example
to.env
- Use
openssl rand -base64 32
or https://generate-secret.vercel.app/32 to generate a key and add it underNEXTAUTH_SECRET
in the.env
file.
- Duplicate
-
Set up your database running /sql/schema.sql
-
Start using with
npm run dev
You can deploy it to Vercel with one click, but the free plan has only a 5s duration limit for serverless functions, which will throw 504 (Request Timeout) on embeddings creation (file creation) for large content. Also, keep in mind that your Database needs to be accessible from the web:
- Store large files' content in the files in S3 or any other object storage. Currently, content is stored in the
files
table. The get-content endpoint is separated from the get-file for this reason - Add the possibility to upload files in other formats (PDF, website crawl, video, etc)
- Add the possibility to create a prompt template for agents. Require {context} and {question} fields
- Configure adaptive mobile layout for every page (currently only for PC)
- Enforse Server Side Rendering everywhere and create child client components for interactivity where needed
- Your feature?
Contributions are what makes the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
The source code in this repository is made available under the MPL-2.0 License.
Denys Bondarenko - @denbondd - denbon04@gmail.com