Skip to content

Commit d83dd5d

Browse files
committed
chore: 📝 update readme
1 parent 1a96c5f commit d83dd5d

File tree

2 files changed

+96
-33
lines changed

2 files changed

+96
-33
lines changed

.github/hybrid-rag.png

131 KB
Loading

README.md

Lines changed: 96 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,123 @@
1-
# Hello Edge
1+
# Chat with PDF 🗣️💬📄
22

3-
A minimal [Nuxt](https://nuxt.com) starter deployed on the Edge using [NuxtHub](https://hub.nuxt.com).
3+
Chat with PDF is a full-stack AI-powered application that lets you to ask questions to PDF documents.
44

5-
https://hello.nuxt.dev
5+
The application is running with server-side rendering on the edge using Cloudflare Pages.
66

7-
<a href="https://hello.nuxt.dev">
8-
<img src="https://github.com/nuxt-hub/hello-edge/assets/904724/99d1bd54-ef7e-4ac9-83ad-0a290f85edcf" alt="Hello World template for NuxtHub" />
9-
</a>
7+
You can deploy it with zero configuration on your Cloudflare account using NuxtHub:
108

11-
## Features
9+
[![Deploy to NuxtHub](https://hub.nuxt.com/button.svg)](https://hub.nuxt.com/new?template=chat-with-pdf)
1210

13-
- Server-Side rendering on Cloudflare Workers
14-
- ESLint setup
15-
- Ready to add a database, blob and KV storage
16-
- One click deploy on 275+ locations for free
11+
### 🚀 Key Features
1712

18-
## Setup
13+
- **Hybrid RAG**: Hybrid RAG using Full-Text Search on D1 and Vector Search on Vectorize
14+
- **Streamed Responses**: Information is streamed real-time to the UI using Server-Sent Events
15+
- **High-Performance**: Deployed on the edge with server-side rendering using Cloudflare Pages
1916

20-
Make sure to install the dependencies with [pnpm](https://pnpm.io/installation#using-corepack):
17+
<!-- ### 🎥 See It in Action
2118
22-
```bash
23-
pnpm install
24-
```
19+
https://github.com/Atinux/atidraw/assets/904724/85f79def-f633-40b7-97c2-3a8579e65af1
2520
26-
You can update the main text displayed by creating a `.env`:
21+
Ready to create? Visit [chat-with-pdf.nuxt.dev](https://chat-with-pdf.nuxt.dev) and share your best drawing! -->
2722

28-
```bash
29-
NUXT_PUBLIC_HELLO_TEXT="Hello my world!"
30-
```
23+
## 🛠 Tech Stack
3124

32-
## Development Server
25+
- [Nuxt](https://nuxt.com) - The Intuitive Vue Framework
26+
- [Nuxt UI](https://github.com/nuxt/ui) - Beautiful UI library with TailwindCSS
27+
- [Drizzle ORM](https://orm.drizzle.team/) - Powerful modern TypeScript ORM
28+
- [unpdf](https://github.com/unjs/unpdf) - Platform-agnostic version of [PDF.js](https://github.com/mozilla/pdf.js) for serverless environments
29+
- [NuxtHub Rate Limit](https://github.com/fayazara/nuxthub-ratelimit) - Ratelimiting requests
30+
- [NuxtHub](https://hub.nuxt.com) - Build & deploy to your Cloudflare account with zero configuration
31+
- [`hubBlob()`](https://hub.nuxt.com/docs/features/blob) to store PDFs in Cloudflare R2
32+
- [`hubDatabase()`](https://hub.nuxt.com/docs/features/blob) to store document chunks and full-text search on Cloudflare D1
33+
- [`hubAI()`](https://hub.nuxt.com/docs/features/ai) to run Cloudflare AI models for LLM chat and generating text embeddings
34+
- [`hubVectorize()`](https://hub.nuxt.com/docs/features/ai) to find relevant document context in Cloudflare Vectorize
35+
- [`hubKV()`](https://hub.nuxt.com/docs/features/ai) for IP ratelimiting
36+
- [`npx nuxthub deploy`](https://github.com/nuxt-hub/cli) - To deploy the app on your Cloudflare account for free
3337

34-
Start the development server on `http://localhost:3000`:
38+
## 🏎️ How does it work?
3539

36-
```bash
37-
pnpm dev
38-
```
40+
![Hybrid Search RAG](./.github/hybrid-rag.png)
41+
42+
This project uses a combination of classical Full Text Search (sparse) against Cloudflare D1 and Hybrid Search with embeddings against Vectorize (dense) to provide the best of both worlds providing the most applicable context to the LLM.
43+
44+
The way it works is this:
45+
46+
1. We take user input and we rewrite it to 5 different queries using an LLM
47+
2. We run each of these queries against our both datastores - D1 database using BM25 for full-text search and Vectorize for dense retrieval
48+
3. We take the results from both datastores and we merge them together using [Reciprocal Rank Fusion](https://www.elastic.co/guide/en/elasticsearch/reference/current/rrf.html) which provides us with a single list of results
49+
4. We then take the top 10 results from this list and we pass them to the LLM to generate a response
50+
51+
<sub>Credits: https://github.com/RafalWilinski/cloudflare-rag#hybrid-search-rag</sub>
52+
53+
## 🚀 Quick Start
54+
55+
1. Install dependencies with [pnpm](https://pnpm.io)
56+
```bash
57+
pnpm install
58+
```
59+
2. Create & link a NuxtHub project to enable running AI models on your Cloudflare account
60+
```bash
61+
npx nuxthub link
62+
```
63+
4. Deploy the application to your Cloudflare account
64+
```bash
65+
npx nuxthub deploy
66+
```
67+
4. Launch the dev server
68+
```bash
69+
pnpm dev --remote
70+
```
3971

40-
## Production
72+
Visit `http://localhost:3000` and start chatting with documents!
4173

42-
Build the application for production:
74+
## 🌐 Deploy to the World for Free
75+
76+
Host your Chat with PDF instance on a **free Cloudflare account** and **free NuxtHub account**.
77+
78+
Deploy it online in the NuxtHub UI:
79+
80+
[![Deploy to NuxtHub](https://hub.nuxt.com/button.svg)](https://hub.nuxt.com/new?repo=RihanArfan/chat-with-pdf)
81+
82+
Or locally with the [NuxtHub CLI](https://github.com/nuxt-hub/cli):
4383

4484
```bash
45-
pnpm build
85+
npx nuxthub deploy
4686
```
4787

48-
## Deploy
88+
This command will deploy your Chat with PDF instance to your Cloudflare account and provision a Cloudflare R2 bucket. You will also get a free `<your-app>.nuxt.dev` domain.
89+
90+
What's included in Cloudflare free plan:
91+
- 100,000 requests/day
92+
- 10 GB storage on Cloudflare R2
93+
- 10,000 tokens a day for Workers AI
94+
- 30 million queried vector dimensions / month
95+
- 5 million stored vector dimensions
4996
97+
Read more about the pricing on our [detailed pricing page](https://hub.nuxt.com/pricing).
5098
51-
Deploy the application on the Edge with [NuxtHub](https://hub.nuxt.com) on your Cloudflare account:
99+
You can also deploy using [Cloudflare Pages CI](https://hub.nuxt.com/docs/getting-started/deploy#cloudflare-pages-ci) or [GitHub actions](https://hub.nuxt.com/docs/getting-started/deploy#github-action).
100+
101+
### Remote Storage
102+
103+
Once your project is deployed, you can use [NuxtHub Remote Storage](https://hub.nuxt.com/docs/getting-started/remote-storage) to connect to your preview or production Cloudflare R2 bucket in development using the `--remote` flag:
52104
53105
```bash
54-
npx nuxthub deploy
106+
pnpm dev --remote
55107
```
56108
57-
Then checkout your server logs, analaytics and more in the [NuxtHub Admin](https://admin.hub.nuxt.com).
109+
## 🔗 Useful Links
110+
111+
- [Live Demo](https://chat-with-pdf.nuxt.dev)
112+
- [NuxtHub Documentation](https://hub.nuxt.com)
113+
- [Nuxt UI](https://ui.nuxt.com)
114+
- [Nuxt](https://nuxt.com)
115+
116+
## 📝 License
117+
118+
Published under the [MIT license](./LICENSE).
58119
59-
You can also deploy using [Cloudflare Pages CI](https://hub.nuxt.com/docs/getting-started/deploy#cloudflare-pages-ci).
120+
## 🙋 Credits
60121
122+
- [cloudflare-rag](https://github.com/RafalWilinski/cloudflare-rag) by [Rafal Wilinski](https://github.com/RafalWilinski) - Chat with PDF is a port of the cloudflare-rag project to NuxtHub and Nuxt UI. The core logic and functionality are derived from cloudflare-rag, adapted to work with NuxtHub.
123+
- [hub-chat](https://github.com/ra-jeev/hub-chat) by [Rajeev R Sharma](https://github.com/ra-jeev) - Parts of UI and inspiration for the streaming composable.

0 commit comments

Comments
 (0)