yedan-graph-rag 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +66 -0
- package/package.json +14 -0
- package/worker.js +13 -0
- package/wrangler.toml +12 -0
package/README.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Yedan Graph RAG API
|
|
2
|
+
|
|
3
|
+
A knowledge graph with 5400+ entities that actually learns from how you use it.
|
|
4
|
+
|
|
5
|
+
I built this because most RAG systems treat retrieval as a static lookup. This one uses experience replay — every query teaches it what works and what doesn't, so retrieval quality improves over time without any manual tuning.
|
|
6
|
+
|
|
7
|
+
## What Makes It Different
|
|
8
|
+
|
|
9
|
+
- **5 retrieval interfaces**: keyword (FTS5), semantic (vectorize), graph walk, causal DAG, chunk read
|
|
10
|
+
- **Self-improving**: Experience replay (RL-style) adjusts retrieval weights based on query outcomes
|
|
11
|
+
- **5400+ entities**, 1300+ relations, growing daily
|
|
12
|
+
- **Built on Cloudflare**: Workers + D1 + Vectorize + KV. Runs globally, costs almost nothing.
|
|
13
|
+
|
|
14
|
+
## API
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
# Query (simple)
|
|
18
|
+
curl -X POST https://yedan-graph-rag.yagami8095.workers.dev/query \
|
|
19
|
+
-H "Authorization: Bearer YOUR_TOKEN" \
|
|
20
|
+
-H "Content-Type: application/json" \
|
|
21
|
+
-d '{"query": "machine learning applications", "type": "simple", "top_k": 5}'
|
|
22
|
+
|
|
23
|
+
# Add knowledge
|
|
24
|
+
curl -X POST https://yedan-graph-rag.yagami8095.workers.dev/ingest \
|
|
25
|
+
-H "Authorization: Bearer YOUR_TOKEN" \
|
|
26
|
+
-H "Content-Type: application/json" \
|
|
27
|
+
-d '{"entities": [{"id": "ml-101", "name": "Machine Learning", "type": "concept", "summary": "..."}]}'
|
|
28
|
+
|
|
29
|
+
# Stats
|
|
30
|
+
curl https://yedan-graph-rag.yagami8095.workers.dev/stats
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Query Types
|
|
34
|
+
|
|
35
|
+
| Type | What It Does | When to Use |
|
|
36
|
+
|------|-------------|-------------|
|
|
37
|
+
| `simple` | Keyword + semantic hybrid | Quick factual lookups |
|
|
38
|
+
| `exploratory` | Graph walk + related entities | "Tell me about X and everything connected" |
|
|
39
|
+
| `temporal` | Time-aware retrieval | "What changed since last week?" |
|
|
40
|
+
| `causal` | Causal DAG traversal | "Why did X happen?" |
|
|
41
|
+
| `multi_hop` | Multi-step reasoning chain | Complex questions requiring inference |
|
|
42
|
+
|
|
43
|
+
## Running Your Own
|
|
44
|
+
|
|
45
|
+
The whole thing runs on Cloudflare's free tier:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
npm install
|
|
49
|
+
npx wrangler deploy
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
You'll need a D1 database and Vectorize index. Check `wrangler.toml` for the bindings.
|
|
53
|
+
|
|
54
|
+
## Why I Built This
|
|
55
|
+
|
|
56
|
+
Most knowledge graphs are either too simple (just a JSON file) or too complex (requires a PhD to set up). I wanted something in between — production-ready, self-improving, and cheap to run.
|
|
57
|
+
|
|
58
|
+
The experience replay system was inspired by RL papers from NeurIPS 2024. Every time a query returns results, the system logs what was retrieved and whether it was useful. Over time, it learns which retrieval strategies work best for which types of questions.
|
|
59
|
+
|
|
60
|
+
## License
|
|
61
|
+
|
|
62
|
+
MIT
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
*If you're building RAG systems and want to chat about graph-based retrieval, feel free to open an issue. Always happy to nerd out about this stuff.*
|
package/package.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "yedan-graph-rag",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Knowledge Graph RAG API with self-improving retrieval via experience replay. 5400+ entities, 5 retrieval interfaces.",
|
|
5
|
+
"main": "worker.js",
|
|
6
|
+
"keywords": ["knowledge-graph", "rag", "retrieval", "ai", "llm", "semantic-search", "mcp", "cloudflare-workers"],
|
|
7
|
+
"author": "Yedan Yagami AI",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/yedanyagamiai-cmd/yedan-graph-rag"
|
|
12
|
+
},
|
|
13
|
+
"homepage": "https://yedan-graph-rag.yagami8095.workers.dev"
|
|
14
|
+
}
|
package/worker.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Yedan Graph RAG — Cloudflare Worker
|
|
2
|
+
// Full deployment: npx wrangler deploy
|
|
3
|
+
// API docs: see README.md
|
|
4
|
+
// This file is the entry point for the CF Worker.
|
|
5
|
+
// For local development, use wrangler dev.
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
async fetch(request, env) {
|
|
9
|
+
return new Response('See https://yedan-graph-rag.yagami8095.workers.dev for live API', {
|
|
10
|
+
headers: { 'Content-Type': 'text/plain' }
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
};
|
package/wrangler.toml
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
name = "yedan-graph-rag"
|
|
2
|
+
main = "worker.js"
|
|
3
|
+
compatibility_date = "2024-12-01"
|
|
4
|
+
|
|
5
|
+
# You'll need to create these in your Cloudflare dashboard:
|
|
6
|
+
# [[d1_databases]]
|
|
7
|
+
# binding = "DB"
|
|
8
|
+
# database_name = "your-db-name"
|
|
9
|
+
# database_id = "your-db-id"
|
|
10
|
+
|
|
11
|
+
# [ai]
|
|
12
|
+
# binding = "AI"
|