deeprefine-cli 0.1.3__tar.gz → 0.1.4__tar.gz
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.
- deeprefine_cli-0.1.4/PKG-INFO +308 -0
- deeprefine_cli-0.1.4/README.md +282 -0
- {deeprefine_cli-0.1.3 → deeprefine_cli-0.1.4}/SKILL.md +4 -2
- deeprefine_cli-0.1.4/deeprefine_cli.egg-info/PKG-INFO +308 -0
- {deeprefine_cli-0.1.3 → deeprefine_cli-0.1.4}/deeprefine_skill/SKILL.md +4 -2
- {deeprefine_cli-0.1.3 → deeprefine_cli-0.1.4}/deeprefine_skill/__init__.py +1 -1
- {deeprefine_cli-0.1.3 → deeprefine_cli-0.1.4}/deeprefine_skill/paths.py +14 -8
- {deeprefine_cli-0.1.3 → deeprefine_cli-0.1.4}/deeprefine_skill/refine_runner.py +20 -2
- {deeprefine_cli-0.1.3 → deeprefine_cli-0.1.4}/pyproject.toml +5 -5
- deeprefine_cli-0.1.3/PKG-INFO +0 -223
- deeprefine_cli-0.1.3/README.md +0 -197
- deeprefine_cli-0.1.3/deeprefine_cli.egg-info/PKG-INFO +0 -223
- {deeprefine_cli-0.1.3 → deeprefine_cli-0.1.4}/LICENSE +0 -0
- {deeprefine_cli-0.1.3 → deeprefine_cli-0.1.4}/MANIFEST.in +0 -0
- {deeprefine_cli-0.1.3 → deeprefine_cli-0.1.4}/deeprefine_cli.egg-info/SOURCES.txt +0 -0
- {deeprefine_cli-0.1.3 → deeprefine_cli-0.1.4}/deeprefine_cli.egg-info/dependency_links.txt +0 -0
- {deeprefine_cli-0.1.3 → deeprefine_cli-0.1.4}/deeprefine_cli.egg-info/entry_points.txt +0 -0
- {deeprefine_cli-0.1.3 → deeprefine_cli-0.1.4}/deeprefine_cli.egg-info/requires.txt +0 -0
- {deeprefine_cli-0.1.3 → deeprefine_cli-0.1.4}/deeprefine_cli.egg-info/top_level.txt +0 -0
- {deeprefine_cli-0.1.3 → deeprefine_cli-0.1.4}/deeprefine_skill/adapter_graphify.py +0 -0
- {deeprefine_cli-0.1.3 → deeprefine_cli-0.1.4}/deeprefine_skill/cli.py +0 -0
- {deeprefine_cli-0.1.3 → deeprefine_cli-0.1.4}/deeprefine_skill/history.py +0 -0
- {deeprefine_cli-0.1.3 → deeprefine_cli-0.1.4}/deeprefine_skill/installers.py +0 -0
- {deeprefine_cli-0.1.3 → deeprefine_cli-0.1.4}/setup.cfg +0 -0
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: deeprefine-cli
|
|
3
|
+
Version: 0.1.4
|
|
4
|
+
Summary: CLI and Cursor skill to refine graphify knowledge graphs with DeepRefine
|
|
5
|
+
Author: HKUST-KnowComp
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/HKUST-KnowComp/DeepRefine-Skill
|
|
8
|
+
Project-URL: Documentation, https://github.com/HKUST-KnowComp/DeepRefine-Skill#readme
|
|
9
|
+
Project-URL: Repository, https://github.com/HKUST-KnowComp/DeepRefine-Skill
|
|
10
|
+
Project-URL: Issues, https://github.com/HKUST-KnowComp/DeepRefine-Skill/issues
|
|
11
|
+
Keywords: deeprefine,graphify,knowledge-graph,rag,cursor,agent-skill
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Intended Audience :: Science/Research
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
21
|
+
Requires-Python: >=3.10
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Requires-Dist: openai>=1.0
|
|
25
|
+
Dynamic: license-file
|
|
26
|
+
|
|
27
|
+
<div align="center">
|
|
28
|
+
|
|
29
|
+
# DeepRefine-Skill
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
[](https://pypi.org/project/deeprefine-cli/0.1.4/)
|
|
33
|
+
[](https://pypi.org/project/deeprefine-cli/0.1.4/)
|
|
34
|
+
[](https://arxiv.org/pdf/2605.10488)
|
|
35
|
+
[](https://github.com/HKUST-KnowComp/DeepRefine)
|
|
36
|
+
|
|
37
|
+
</div>
|
|
38
|
+
|
|
39
|
+
Type `/deeprefine` in your AI coding assistant after you've built a **[graphify](https://github.com/safishamsi/graphify)** knowledge base — it patches `graphify-out/graph.json` from your session's query history to evolve your LLM-Wiki.
|
|
40
|
+
|
|
41
|
+
Works in **Cursor** (install the skill once with `deeprefine cursor install`). The same workflow is available from any terminal via the `deeprefine` CLI ([`deeprefine-cli` on PyPI](https://pypi.org/project/deeprefine-cli/)).
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
/deeprefine
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**Typical flow:** `graphify .` → `graphify query "..."` → record the question → `/deeprefine`.
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
deeprefine history add --query "your question" # or let the agent do this
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
That's it. Under `graphify-out/.deeprefine/` you get:
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
graphify-out/
|
|
57
|
+
├── graph.json updated graph (graphify reads this)
|
|
58
|
+
└── .deeprefine/
|
|
59
|
+
├── history.jsonl queries queued for refinement
|
|
60
|
+
├── refinement_results_*.jsonl run logs
|
|
61
|
+
└── graph.json.bak backup before each refine
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
> **Standalone repo.** Model code (`autorefiner`, `atlas_rag`) lives in a separate [DeepRefine](https://github.com/HKUST-KnowComp/DeepRefine) checkout.
|
|
65
|
+
> `pip install deeprefine-cli` ships the CLI and `SKILL.md`. `deeprefine refine` still needs DeepRefine + `atlastune`, with default inference from your current API model setup; you can override with custom base URL and API key.
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## Roadmap
|
|
70
|
+
|
|
71
|
+
**Inference today:** default to your current API model setup.
|
|
72
|
+
|
|
73
|
+
**Optional:** set custom OpenAI-compatible base URL and API key for LLM / embeddings.
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## Quick start
|
|
78
|
+
|
|
79
|
+
| Step | What |
|
|
80
|
+
|:----:|------|
|
|
81
|
+
| 1 | Install [DeepRefine](https://github.com/HKUST-KnowComp/DeepRefine) in `atlastune` |
|
|
82
|
+
| 2 | `pip install deeprefine-cli` |
|
|
83
|
+
| 3 | `deeprefine cursor install` in your KB project |
|
|
84
|
+
| 4 | (Optional) start local vLLM, or use your API provider |
|
|
85
|
+
| 5 | `deeprefine history add` → `deeprefine refine` |
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
# 1) DeepRefine (once)
|
|
89
|
+
conda activate atlastune
|
|
90
|
+
cd /path/to/DeepRefine && pip install -e .
|
|
91
|
+
|
|
92
|
+
# 2) CLI (once per env)
|
|
93
|
+
pip install deeprefine-cli
|
|
94
|
+
|
|
95
|
+
# 3) Cursor skill (KB project root)
|
|
96
|
+
cd /path/to/your-kb-project
|
|
97
|
+
deeprefine cursor install
|
|
98
|
+
|
|
99
|
+
# 4) Optional local vLLM (each session, from DeepRefine repo)
|
|
100
|
+
bash /path/to/DeepRefine/scripts/vllm_serve/qwen3-0.6b-emb.sh
|
|
101
|
+
bash /path/to/DeepRefine/scripts/vllm_serve/qwen3-8b-vllm-reafiner.sh
|
|
102
|
+
|
|
103
|
+
# OR use your API provider (no local vLLM)
|
|
104
|
+
export DEEPREFINE_LLM_URL=your-llm-endpoint
|
|
105
|
+
export DEEPREFINE_EMBED_URL=your-embed-endpoint
|
|
106
|
+
export DEEPREFINE_LLM_API_KEY=your_llm_api_key
|
|
107
|
+
export DEEPREFINE_EMBED_API_KEY=your_embed_api_key
|
|
108
|
+
export DEEPREFINE_MODEL=your_llm_model
|
|
109
|
+
export DEEPREFINE_EMBED_MODEL=your_embed_model
|
|
110
|
+
# optional (if your provider uses one key for both):
|
|
111
|
+
# export DEEPREFINE_API_KEY=your_shared_api_key
|
|
112
|
+
# optional model overrides:
|
|
113
|
+
|
|
114
|
+
# 5) Refine
|
|
115
|
+
deeprefine history add --query "your question"
|
|
116
|
+
deeprefine refine
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## Pipeline
|
|
122
|
+
|
|
123
|
+
| Stage | Tool | Input | Output |
|
|
124
|
+
|:-----:|------|-------|--------|
|
|
125
|
+
| Build | **graphify** | Project files | `graphify-out/graph.json` |
|
|
126
|
+
| Query | **graphify** | Questions | `graphify query "..."` |
|
|
127
|
+
| Refine | **deeprefine** | Graph + query history | Updated `graph.json`, logs |
|
|
128
|
+
|
|
129
|
+
```text
|
|
130
|
+
project files
|
|
131
|
+
│
|
|
132
|
+
▼ graphify
|
|
133
|
+
graph.json ◄────────────────────────┐
|
|
134
|
+
│ │
|
|
135
|
+
▼ graphify query │ deeprefine refine
|
|
136
|
+
(Q&A session) │
|
|
137
|
+
│ │
|
|
138
|
+
▼ deeprefine history add │
|
|
139
|
+
history.jsonl ──────────────────────┘
|
|
140
|
+
│
|
|
141
|
+
▼ graphify query (verify)
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
DeepRefine does not build the graph; it patches `graph.json` so later `graphify query` retrieves better.
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## Repository layout
|
|
149
|
+
|
|
150
|
+
```text
|
|
151
|
+
DeepRefine-Skill/ ← this repo (PyPI: deeprefine-cli)
|
|
152
|
+
├── deeprefine_skill/ ← package (SKILL.md bundled)
|
|
153
|
+
└── scripts/deeprefine.py
|
|
154
|
+
|
|
155
|
+
DeepRefine/ ← separate clone
|
|
156
|
+
├── autorefiner/
|
|
157
|
+
├── AutoSchemaKG/
|
|
158
|
+
└── scripts/vllm_serve/
|
|
159
|
+
|
|
160
|
+
your-kb-project/
|
|
161
|
+
└── graphify-out/
|
|
162
|
+
├── graph.json
|
|
163
|
+
└── .deeprefine/ ← history, logs, FAISS cache
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
**Recommended sibling layout** (auto-detects `../DeepRefine` when `DEEPREFINE_REPO` is unset):
|
|
167
|
+
|
|
168
|
+
```text
|
|
169
|
+
www/code/
|
|
170
|
+
├── DeepRefine/
|
|
171
|
+
└── DeepRefine-Skill/
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## Installation
|
|
177
|
+
|
|
178
|
+
### 1. DeepRefine (`atlastune`)
|
|
179
|
+
|
|
180
|
+
See [DeepRefine — Environment](https://github.com/HKUST-KnowComp/DeepRefine#environment).
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
conda activate atlastune
|
|
184
|
+
cd /path/to/DeepRefine
|
|
185
|
+
pip install -e .
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### 2. CLI
|
|
189
|
+
|
|
190
|
+
| Method | Command |
|
|
191
|
+
|--------|---------|
|
|
192
|
+
| **PyPI** (recommended) | `pip install deeprefine-cli` |
|
|
193
|
+
| **Source** | `pip install -e /path/to/DeepRefine-Skill` |
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
deeprefine --help # verify
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### 3. DeepRefine path (optional)
|
|
200
|
+
|
|
201
|
+
Only if `DeepRefine` is not `../DeepRefine` and not found by walking up from cwd:
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
export DEEPREFINE_REPO=/path/to/DeepRefine
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### 4. Inference
|
|
208
|
+
|
|
209
|
+
Default: use your API provider from environment.
|
|
210
|
+
|
|
211
|
+
Optional local vLLM (from the **DeepRefine** repo):
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
conda activate atlastune
|
|
215
|
+
bash /path/to/DeepRefine/scripts/vllm_serve/qwen3-0.6b-emb.sh
|
|
216
|
+
bash /path/to/DeepRefine/scripts/vllm_serve/qwen3-8b-vllm-reafiner.sh
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
| Variable | Default |
|
|
220
|
+
|----------|---------|
|
|
221
|
+
| `DEEPREFINE_LLM_URL` | *(empty; SDK default endpoint)* |
|
|
222
|
+
| `DEEPREFINE_EMBED_URL` | *(empty; SDK default endpoint)* |
|
|
223
|
+
| `DEEPREFINE_API_KEY` | fallback to `OPENAI_API_KEY` |
|
|
224
|
+
| `DEEPREFINE_LLM_API_KEY` | fallback to `DEEPREFINE_API_KEY` |
|
|
225
|
+
| `DEEPREFINE_EMBED_API_KEY` | fallback to `DEEPREFINE_API_KEY` |
|
|
226
|
+
| `DEEPREFINE_MODEL` | `gpt-4.1-mini` |
|
|
227
|
+
| `DEEPREFINE_EMBED_MODEL` | `text-embedding-3-small` |
|
|
228
|
+
|
|
229
|
+
### 5. Cursor skill
|
|
230
|
+
|
|
231
|
+
Run at **KB project root** (folder with or that will have `graphify-out/`):
|
|
232
|
+
|
|
233
|
+
| Command | Scope |
|
|
234
|
+
|---------|-------|
|
|
235
|
+
| `deeprefine cursor install` | `.cursor/skills/` (this project) |
|
|
236
|
+
| `deeprefine cursor install --user` | `~/.cursor/skills/` (all projects) |
|
|
237
|
+
| `deeprefine install` | alias for `cursor install` |
|
|
238
|
+
| `deeprefine cursor uninstall` | remove skill |
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
## Workflow with graphify
|
|
243
|
+
|
|
244
|
+
**One-time**
|
|
245
|
+
|
|
246
|
+
```bash
|
|
247
|
+
pip install graphifyy deeprefine-cli # deeprefine-cli in atlastune
|
|
248
|
+
|
|
249
|
+
cd /path/to/your-kb-project
|
|
250
|
+
graphify cursor install
|
|
251
|
+
deeprefine cursor install
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
**Each session** (KB project root)
|
|
255
|
+
|
|
256
|
+
| # | Action |
|
|
257
|
+
|:-:|--------|
|
|
258
|
+
| 1 | `graphify .` or `/graphify .` → `graphify-out/graph.json` |
|
|
259
|
+
| 2 | `graphify query "..."` |
|
|
260
|
+
| 3 | `deeprefine history add --query "..."` |
|
|
261
|
+
| 4 | `deeprefine refine` or `/deeprefine` |
|
|
262
|
+
| 5 | *(optional)* `graphify query "..."` to verify |
|
|
263
|
+
|
|
264
|
+
---
|
|
265
|
+
|
|
266
|
+
## Commands
|
|
267
|
+
|
|
268
|
+
All commands below run from **KB project root**.
|
|
269
|
+
|
|
270
|
+
| Command | Description |
|
|
271
|
+
|---------|-------------|
|
|
272
|
+
| `deeprefine history add --query "..."` | Record a query after graph Q&A |
|
|
273
|
+
| `deeprefine history list` | List all history entries |
|
|
274
|
+
| `deeprefine history list --pending` | List unrefined queries only |
|
|
275
|
+
| `deeprefine refine` | Refine all pending queries |
|
|
276
|
+
| `deeprefine refine --query "..."` | Refine one query (also recorded) |
|
|
277
|
+
| `deeprefine refine --rebuild-index` | Rebuild FAISS before refine |
|
|
278
|
+
| `deeprefine index --rebuild` | Rebuild FAISS cache only |
|
|
279
|
+
| `deeprefine cursor install \| uninstall` | Manage Cursor skill |
|
|
280
|
+
|
|
281
|
+
**Artifacts** (`graphify-out/.deeprefine/`)
|
|
282
|
+
|
|
283
|
+
| File | Purpose |
|
|
284
|
+
|------|---------|
|
|
285
|
+
| `history.jsonl` | Query history |
|
|
286
|
+
| `refinement_results_*.jsonl` | Refinement logs |
|
|
287
|
+
| `graph.json.bak` | Backup before refine |
|
|
288
|
+
| `reafiner.pkl` | FAISS index cache |
|
|
289
|
+
|
|
290
|
+
Cursor agent instructions: [SKILL.md](./SKILL.md) → installed as `.cursor/skills/deeprefine/SKILL.md`.
|
|
291
|
+
|
|
292
|
+
---
|
|
293
|
+
|
|
294
|
+
## Where to run what
|
|
295
|
+
|
|
296
|
+
| What | Where |
|
|
297
|
+
|------|-------|
|
|
298
|
+
| `pip install deeprefine-cli` | Anywhere (`atlastune` for refine) |
|
|
299
|
+
| `pip install -e .../DeepRefine` | DeepRefine repo |
|
|
300
|
+
| `graphify` / `deeprefine cursor install` | **KB project root** |
|
|
301
|
+
| `deeprefine refine` / `history` | **KB project root** |
|
|
302
|
+
| vLLM serve scripts | **DeepRefine repo** |
|
|
303
|
+
|
|
304
|
+
---
|
|
305
|
+
|
|
306
|
+
## License
|
|
307
|
+
|
|
308
|
+
MIT — see [LICENSE](./LICENSE).
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# DeepRefine-Skill
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
[](https://pypi.org/project/deeprefine-cli/0.1.4/)
|
|
7
|
+
[](https://pypi.org/project/deeprefine-cli/0.1.4/)
|
|
8
|
+
[](https://arxiv.org/pdf/2605.10488)
|
|
9
|
+
[](https://github.com/HKUST-KnowComp/DeepRefine)
|
|
10
|
+
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
Type `/deeprefine` in your AI coding assistant after you've built a **[graphify](https://github.com/safishamsi/graphify)** knowledge base — it patches `graphify-out/graph.json` from your session's query history to evolve your LLM-Wiki.
|
|
14
|
+
|
|
15
|
+
Works in **Cursor** (install the skill once with `deeprefine cursor install`). The same workflow is available from any terminal via the `deeprefine` CLI ([`deeprefine-cli` on PyPI](https://pypi.org/project/deeprefine-cli/)).
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
/deeprefine
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
**Typical flow:** `graphify .` → `graphify query "..."` → record the question → `/deeprefine`.
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
deeprefine history add --query "your question" # or let the agent do this
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
That's it. Under `graphify-out/.deeprefine/` you get:
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
graphify-out/
|
|
31
|
+
├── graph.json updated graph (graphify reads this)
|
|
32
|
+
└── .deeprefine/
|
|
33
|
+
├── history.jsonl queries queued for refinement
|
|
34
|
+
├── refinement_results_*.jsonl run logs
|
|
35
|
+
└── graph.json.bak backup before each refine
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
> **Standalone repo.** Model code (`autorefiner`, `atlas_rag`) lives in a separate [DeepRefine](https://github.com/HKUST-KnowComp/DeepRefine) checkout.
|
|
39
|
+
> `pip install deeprefine-cli` ships the CLI and `SKILL.md`. `deeprefine refine` still needs DeepRefine + `atlastune`, with default inference from your current API model setup; you can override with custom base URL and API key.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Roadmap
|
|
44
|
+
|
|
45
|
+
**Inference today:** default to your current API model setup.
|
|
46
|
+
|
|
47
|
+
**Optional:** set custom OpenAI-compatible base URL and API key for LLM / embeddings.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Quick start
|
|
52
|
+
|
|
53
|
+
| Step | What |
|
|
54
|
+
|:----:|------|
|
|
55
|
+
| 1 | Install [DeepRefine](https://github.com/HKUST-KnowComp/DeepRefine) in `atlastune` |
|
|
56
|
+
| 2 | `pip install deeprefine-cli` |
|
|
57
|
+
| 3 | `deeprefine cursor install` in your KB project |
|
|
58
|
+
| 4 | (Optional) start local vLLM, or use your API provider |
|
|
59
|
+
| 5 | `deeprefine history add` → `deeprefine refine` |
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
# 1) DeepRefine (once)
|
|
63
|
+
conda activate atlastune
|
|
64
|
+
cd /path/to/DeepRefine && pip install -e .
|
|
65
|
+
|
|
66
|
+
# 2) CLI (once per env)
|
|
67
|
+
pip install deeprefine-cli
|
|
68
|
+
|
|
69
|
+
# 3) Cursor skill (KB project root)
|
|
70
|
+
cd /path/to/your-kb-project
|
|
71
|
+
deeprefine cursor install
|
|
72
|
+
|
|
73
|
+
# 4) Optional local vLLM (each session, from DeepRefine repo)
|
|
74
|
+
bash /path/to/DeepRefine/scripts/vllm_serve/qwen3-0.6b-emb.sh
|
|
75
|
+
bash /path/to/DeepRefine/scripts/vllm_serve/qwen3-8b-vllm-reafiner.sh
|
|
76
|
+
|
|
77
|
+
# OR use your API provider (no local vLLM)
|
|
78
|
+
export DEEPREFINE_LLM_URL=your-llm-endpoint
|
|
79
|
+
export DEEPREFINE_EMBED_URL=your-embed-endpoint
|
|
80
|
+
export DEEPREFINE_LLM_API_KEY=your_llm_api_key
|
|
81
|
+
export DEEPREFINE_EMBED_API_KEY=your_embed_api_key
|
|
82
|
+
export DEEPREFINE_MODEL=your_llm_model
|
|
83
|
+
export DEEPREFINE_EMBED_MODEL=your_embed_model
|
|
84
|
+
# optional (if your provider uses one key for both):
|
|
85
|
+
# export DEEPREFINE_API_KEY=your_shared_api_key
|
|
86
|
+
# optional model overrides:
|
|
87
|
+
|
|
88
|
+
# 5) Refine
|
|
89
|
+
deeprefine history add --query "your question"
|
|
90
|
+
deeprefine refine
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Pipeline
|
|
96
|
+
|
|
97
|
+
| Stage | Tool | Input | Output |
|
|
98
|
+
|:-----:|------|-------|--------|
|
|
99
|
+
| Build | **graphify** | Project files | `graphify-out/graph.json` |
|
|
100
|
+
| Query | **graphify** | Questions | `graphify query "..."` |
|
|
101
|
+
| Refine | **deeprefine** | Graph + query history | Updated `graph.json`, logs |
|
|
102
|
+
|
|
103
|
+
```text
|
|
104
|
+
project files
|
|
105
|
+
│
|
|
106
|
+
▼ graphify
|
|
107
|
+
graph.json ◄────────────────────────┐
|
|
108
|
+
│ │
|
|
109
|
+
▼ graphify query │ deeprefine refine
|
|
110
|
+
(Q&A session) │
|
|
111
|
+
│ │
|
|
112
|
+
▼ deeprefine history add │
|
|
113
|
+
history.jsonl ──────────────────────┘
|
|
114
|
+
│
|
|
115
|
+
▼ graphify query (verify)
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
DeepRefine does not build the graph; it patches `graph.json` so later `graphify query` retrieves better.
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## Repository layout
|
|
123
|
+
|
|
124
|
+
```text
|
|
125
|
+
DeepRefine-Skill/ ← this repo (PyPI: deeprefine-cli)
|
|
126
|
+
├── deeprefine_skill/ ← package (SKILL.md bundled)
|
|
127
|
+
└── scripts/deeprefine.py
|
|
128
|
+
|
|
129
|
+
DeepRefine/ ← separate clone
|
|
130
|
+
├── autorefiner/
|
|
131
|
+
├── AutoSchemaKG/
|
|
132
|
+
└── scripts/vllm_serve/
|
|
133
|
+
|
|
134
|
+
your-kb-project/
|
|
135
|
+
└── graphify-out/
|
|
136
|
+
├── graph.json
|
|
137
|
+
└── .deeprefine/ ← history, logs, FAISS cache
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
**Recommended sibling layout** (auto-detects `../DeepRefine` when `DEEPREFINE_REPO` is unset):
|
|
141
|
+
|
|
142
|
+
```text
|
|
143
|
+
www/code/
|
|
144
|
+
├── DeepRefine/
|
|
145
|
+
└── DeepRefine-Skill/
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## Installation
|
|
151
|
+
|
|
152
|
+
### 1. DeepRefine (`atlastune`)
|
|
153
|
+
|
|
154
|
+
See [DeepRefine — Environment](https://github.com/HKUST-KnowComp/DeepRefine#environment).
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
conda activate atlastune
|
|
158
|
+
cd /path/to/DeepRefine
|
|
159
|
+
pip install -e .
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### 2. CLI
|
|
163
|
+
|
|
164
|
+
| Method | Command |
|
|
165
|
+
|--------|---------|
|
|
166
|
+
| **PyPI** (recommended) | `pip install deeprefine-cli` |
|
|
167
|
+
| **Source** | `pip install -e /path/to/DeepRefine-Skill` |
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
deeprefine --help # verify
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### 3. DeepRefine path (optional)
|
|
174
|
+
|
|
175
|
+
Only if `DeepRefine` is not `../DeepRefine` and not found by walking up from cwd:
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
export DEEPREFINE_REPO=/path/to/DeepRefine
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### 4. Inference
|
|
182
|
+
|
|
183
|
+
Default: use your API provider from environment.
|
|
184
|
+
|
|
185
|
+
Optional local vLLM (from the **DeepRefine** repo):
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
conda activate atlastune
|
|
189
|
+
bash /path/to/DeepRefine/scripts/vllm_serve/qwen3-0.6b-emb.sh
|
|
190
|
+
bash /path/to/DeepRefine/scripts/vllm_serve/qwen3-8b-vllm-reafiner.sh
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
| Variable | Default |
|
|
194
|
+
|----------|---------|
|
|
195
|
+
| `DEEPREFINE_LLM_URL` | *(empty; SDK default endpoint)* |
|
|
196
|
+
| `DEEPREFINE_EMBED_URL` | *(empty; SDK default endpoint)* |
|
|
197
|
+
| `DEEPREFINE_API_KEY` | fallback to `OPENAI_API_KEY` |
|
|
198
|
+
| `DEEPREFINE_LLM_API_KEY` | fallback to `DEEPREFINE_API_KEY` |
|
|
199
|
+
| `DEEPREFINE_EMBED_API_KEY` | fallback to `DEEPREFINE_API_KEY` |
|
|
200
|
+
| `DEEPREFINE_MODEL` | `gpt-4.1-mini` |
|
|
201
|
+
| `DEEPREFINE_EMBED_MODEL` | `text-embedding-3-small` |
|
|
202
|
+
|
|
203
|
+
### 5. Cursor skill
|
|
204
|
+
|
|
205
|
+
Run at **KB project root** (folder with or that will have `graphify-out/`):
|
|
206
|
+
|
|
207
|
+
| Command | Scope |
|
|
208
|
+
|---------|-------|
|
|
209
|
+
| `deeprefine cursor install` | `.cursor/skills/` (this project) |
|
|
210
|
+
| `deeprefine cursor install --user` | `~/.cursor/skills/` (all projects) |
|
|
211
|
+
| `deeprefine install` | alias for `cursor install` |
|
|
212
|
+
| `deeprefine cursor uninstall` | remove skill |
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## Workflow with graphify
|
|
217
|
+
|
|
218
|
+
**One-time**
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
pip install graphifyy deeprefine-cli # deeprefine-cli in atlastune
|
|
222
|
+
|
|
223
|
+
cd /path/to/your-kb-project
|
|
224
|
+
graphify cursor install
|
|
225
|
+
deeprefine cursor install
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
**Each session** (KB project root)
|
|
229
|
+
|
|
230
|
+
| # | Action |
|
|
231
|
+
|:-:|--------|
|
|
232
|
+
| 1 | `graphify .` or `/graphify .` → `graphify-out/graph.json` |
|
|
233
|
+
| 2 | `graphify query "..."` |
|
|
234
|
+
| 3 | `deeprefine history add --query "..."` |
|
|
235
|
+
| 4 | `deeprefine refine` or `/deeprefine` |
|
|
236
|
+
| 5 | *(optional)* `graphify query "..."` to verify |
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
|
|
240
|
+
## Commands
|
|
241
|
+
|
|
242
|
+
All commands below run from **KB project root**.
|
|
243
|
+
|
|
244
|
+
| Command | Description |
|
|
245
|
+
|---------|-------------|
|
|
246
|
+
| `deeprefine history add --query "..."` | Record a query after graph Q&A |
|
|
247
|
+
| `deeprefine history list` | List all history entries |
|
|
248
|
+
| `deeprefine history list --pending` | List unrefined queries only |
|
|
249
|
+
| `deeprefine refine` | Refine all pending queries |
|
|
250
|
+
| `deeprefine refine --query "..."` | Refine one query (also recorded) |
|
|
251
|
+
| `deeprefine refine --rebuild-index` | Rebuild FAISS before refine |
|
|
252
|
+
| `deeprefine index --rebuild` | Rebuild FAISS cache only |
|
|
253
|
+
| `deeprefine cursor install \| uninstall` | Manage Cursor skill |
|
|
254
|
+
|
|
255
|
+
**Artifacts** (`graphify-out/.deeprefine/`)
|
|
256
|
+
|
|
257
|
+
| File | Purpose |
|
|
258
|
+
|------|---------|
|
|
259
|
+
| `history.jsonl` | Query history |
|
|
260
|
+
| `refinement_results_*.jsonl` | Refinement logs |
|
|
261
|
+
| `graph.json.bak` | Backup before refine |
|
|
262
|
+
| `reafiner.pkl` | FAISS index cache |
|
|
263
|
+
|
|
264
|
+
Cursor agent instructions: [SKILL.md](./SKILL.md) → installed as `.cursor/skills/deeprefine/SKILL.md`.
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
## Where to run what
|
|
269
|
+
|
|
270
|
+
| What | Where |
|
|
271
|
+
|------|-------|
|
|
272
|
+
| `pip install deeprefine-cli` | Anywhere (`atlastune` for refine) |
|
|
273
|
+
| `pip install -e .../DeepRefine` | DeepRefine repo |
|
|
274
|
+
| `graphify` / `deeprefine cursor install` | **KB project root** |
|
|
275
|
+
| `deeprefine refine` / `history` | **KB project root** |
|
|
276
|
+
| vLLM serve scripts | **DeepRefine repo** |
|
|
277
|
+
|
|
278
|
+
---
|
|
279
|
+
|
|
280
|
+
## License
|
|
281
|
+
|
|
282
|
+
MIT — see [LICENSE](./LICENSE).
|
|
@@ -22,7 +22,7 @@ conda activate atlastune
|
|
|
22
22
|
cd /path/to/DeepRefine && pip install -e .
|
|
23
23
|
|
|
24
24
|
# 2) This skill CLI
|
|
25
|
-
pip install -
|
|
25
|
+
pip install deeprefine-cli
|
|
26
26
|
|
|
27
27
|
# 3) Optional if DeepRefine is not ../DeepRefine
|
|
28
28
|
export DEEPREFINE_REPO=/path/to/DeepRefine
|
|
@@ -32,7 +32,9 @@ cd /path/to/your-kb-project
|
|
|
32
32
|
deeprefine cursor install
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
Inference defaults to your current API model setup (`OPENAI_API_KEY` or `DEEPREFINE_API_KEY`).
|
|
36
|
+
|
|
37
|
+
Optional: local vLLM from DeepRefine (embedding `8128`, refine model `8134`; see `scripts/vllm_serve/`).
|
|
36
38
|
|
|
37
39
|
## `/deeprefine`
|
|
38
40
|
|