https://github.com/yusukebe/my-first-rag
My first RAG application
https://github.com/yusukebe/my-first-rag
Last synced: 12 months ago
JSON representation
My first RAG application
- Host: GitHub
- URL: https://github.com/yusukebe/my-first-rag
- Owner: yusukebe
- Created: 2024-07-18T12:19:53.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-29T09:37:54.000Z (almost 2 years ago)
- Last Synced: 2025-03-29T06:51:15.548Z (about 1 year ago)
- Language: TypeScript
- Homepage:
- Size: 4.88 KB
- Stars: 10
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# My first RAG
This is my first RAG (Retrieval Augmented Generative) application. It uses Cloudflare Workers and Cloudflare's Workers AI.
This application is based on the [example](https://github.com/kristianfreeman/cloudflare-retrieval-augmented-generation-example) used in [Cloudflare's tutorial](https://developers.cloudflare.com/workers-ai/tutorials/build-a-retrieval-augmented-generation-ai/).
## Stack
The technology stack used includes:
- Cloudflare Workers
- Workers AI
- Vectorize
- D1
Additionally, SSE (Server-Sent Events) is used for rendering results, allowing text to be displayed in a stream.
## Demo
Using technical documents as the content for RAG yielded good results.

## Usage
### Installation
```sh
clone git@github.com:yusukebe/my-first-rag.git
cd my-first-rag
npm i
```
### Create the D1 database
```sh
npm run wrangler --remote d1 create database-my-first-rag
```
### Create the Vectorize database
```sh
npm run wrangler vectorize create vector-index-my-first-rag --dimensions=768 --metric=cosine
```
### Edit `wrangler.toml`
```toml
[[vectorize]]
binding = "VECTORIZE_INDEX"
index_name = "vector-index-my-first-rag"
[[d1_databases]]
binding = "DB"
database_name = "database-my-first-rag"
database_id = "xxxxxxxx" # <== edit!
```
### Start the application
```sh
npm run dev
```
## Author
Yusuke Wada
## License
MIT