What's Tiny-RAG?
Tiny-RAG is a lite system built with NestJS and React which aims to provide you fast enough deployment and knowledge management convenience for your side projects.
Sometimes you just don't need that "heavy, complex" system to build a RAG project.
Sometimes you don't need any AI Agent building system. Q&A is well enough for most scenarios.
Sometimes you just don't need the infrastructure heavy:
- Too much resources included: pg, redis, mysql, milvus, tons of apis needed.
- This project only uses limited dependencies mysql, nothing else.
- To integrate with new AI provider, either do some pull requests, or you create an issue for the contributor to do that for you, it can usually take up to days waiting.
- We use DSL to define the abstracted standard based on the best practices amoung all those popular AI provider. (e.g. openAI's
/v1/chat/completion. P.S. Why still no one pointing that this "v1" design is trash? Is it really good enough for isolation between versions? BTW almost 3 years past, where's the V2 api. I don't think it's a good idea to bring a over-designed pattern to a not yet planned thing. It only makes things more complicated.)
- We use DSL to define the abstracted standard based on the best practices amoung all those popular AI provider. (e.g. openAI's
- Once you decide to modify codes, you'll still run into troubles of having no clue about the project at all.
- Hereby I suggest a pattern called
IDD(interface driven development). You just get to know those simple enough interfaces, all you need to do is to implement the corresponding interfaces that you want to modify/enhance. Typescript will give you the proper instructions.
- Hereby I suggest a pattern called
I'll try to drain my rest time on this project. So we'll only do the features below to make sure it keeps as
Tinyas possible.
- Prepare knowledge-base.
- Upload knowledges:
- Sync from the most popular online docs. e.g. Google doc, Feishu doc.(I'm a Chinese, have to mention Feishu is really popular amoung Chinese companies, which is produced by Tiktok's mother company - ByteDance.)
- sync interval configuration
- Media file hosting.
- Upload PDFs
- a P.S.: We won't do any composing knowledge ability, for that's already been done nicely by Google Docs, Microsoft Office. Let's not be silly asking for those functionalities.
- Sync from the most popular online docs. e.g. Google doc, Feishu doc.(I'm a Chinese, have to mention Feishu is really popular amoung Chinese companies, which is produced by Tiktok's mother company - ByteDance.)
- Split docs into Chunks.
- Embedding all those chunks.(Removing stop keywords.)
- Index all those embedded results.
- Store them into database.
- An input box as a way to test if knowledges can be retrived correctly
- Upload knowledges:
- API management:
- You just use this system to build up some knowledge ability. Actually if you want to make
Tiny-RAGbe used by your side project, you'll need to create some API keys to make RPCs.
- You just use this system to build up some knowledge ability. Actually if you want to make
- AI integrations: To integrate with any AI provider you want.
- Popular AI providers: OpenAI's ChatGPT, Google's Gemini, OpenRouter, etc.
- Customized AI providers: there're always excellent AI providers we haven't known yet. So follow our
IDDpattern you'll feel it integrated easily.- DSL:
- URL: path, host configuration
- Way it should be called:
- Result mapping: You can map fields in the results to our pre-defined data interface. P.S. No matter what results it returned eventually, make sure it has everything we asked for in the predefined data interface, otherwise to integrate is impossible.
- DSL:
We wish Tiny-RAG has the ability to be deployed on actual production environment, so we will choose those infrastructures who have the ability to scale on server resources.
There're two options.
| Value | Best for |
|---|---|
| 'mysql' | For Business |
| 'sqlite' | Small dataset (<10k words) |
What we'll be using SQL Database for:
- AI integration configurations.
- Knowledge contents.
- API keys.
P.S. If you decided to use
sqliteplease make sure yourpythonversion is3.9, so thatpnpm rebuildcan run successfully.
There're two options.
| Value | Best for |
|---|---|
| 'milvus' | For Business |
| 'local-vector' | Small dataset (<10k words) |
What we'll be using Milvus for:
- Knowledge retrieving.
- Initiate
bash ./init.sh- You'll need two terminals to start nodejs and browserjs.
cd packages/server && pnpm run start:devcd packages/app && pnpm run start:dev- Build on server and deploy it.
On your server side, execute:
pnpm run init
pnpm run run:build- Build on local machine first, then deploy to server.
On your local machine, execute:
bash ./build_local.sh
Then on your server side, execute:
pnpm run init
pnpm run run:nobuild