vector-graph-rag 0.1.5__tar.gz → 0.2.0__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.
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/PKG-INFO +13 -7
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/README.md +12 -6
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/docs/faq.md +5 -7
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/docs/getting-started.md +9 -7
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/docs/how-it-works.md +1 -1
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/docs/index.md +1 -1
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/docs/python-api.md +35 -22
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/docs/rest-api.md +3 -3
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/pyproject.toml +1 -1
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/src/vector_graph_rag/__init__.py +1 -1
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/src/vector_graph_rag/rag.py +153 -49
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/src/vector_graph_rag/storage/milvus.py +42 -6
- vector_graph_rag-0.2.0/tests/test_rag_incremental.py +440 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/uv.lock +1 -1
- vector_graph_rag-0.1.5/tests/test_rag_incremental.py +0 -279
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/.dockerignore +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/.env.example +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/.github/workflows/docs.yml +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/.github/workflows/release.yml +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/.gitignore +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/AGENTS.md +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/CLAUDE.md +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/Dockerfile +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/LICENSE +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/api/__init__.py +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/api/main.py +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/api/schemas.py +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/docs/assets/logo.png +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/docs/assets/logo.svg +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/docs/design-philosophy.md +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/docs/evaluation.md +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/docs/frontend.md +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/docs/stylesheets/custom.css +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/docs/use-cases.md +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/evaluation/README.md +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/evaluation/data/2wikimultihopqa.json +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/evaluation/data/2wikimultihopqa_corpus.json +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/evaluation/data/hotpotqa.json +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/evaluation/data/hotpotqa_corpus.json +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/evaluation/data/musique.json +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/evaluation/data/musique_corpus.json +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/evaluation/data/ner_cache/2wikimultihopqa_queries.named_entity_output.tsv +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/evaluation/data/ner_cache/hotpotqa_queries.named_entity_output.tsv +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/evaluation/data/ner_cache/hotpotqa_train_queries.named_entity_output.tsv +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/evaluation/data/ner_cache/musique_queries.named_entity_output.tsv +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/evaluation/data/ner_cache/sample_queries.named_entity_output.tsv +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/evaluation/data/openie_2wikimultihopqa_results_ner_gpt-3.5-turbo-1106_6119.json +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/evaluation/data/openie_hotpotqa_results_ner_gpt-3.5-turbo-1106_9221.json +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/evaluation/data/openie_musique_results_ner_gpt-3.5-turbo-1106_11656.json +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/evaluation/data/openie_test_sample_results_ner_gpt-3.5-turbo-1106_20.json +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/evaluation/data/test_sample.json +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/evaluation/data/test_sample_corpus.json +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/evaluation/evaluate.py +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/frontend/.gitignore +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/frontend/README.md +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/frontend/eslint.config.js +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/frontend/index.html +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/frontend/package-lock.json +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/frontend/package.json +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/frontend/public/vite.svg +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/frontend/src/App.css +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/frontend/src/App.tsx +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/frontend/src/api/client.ts +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/frontend/src/api/queries.ts +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/frontend/src/assets/react.svg +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/frontend/src/components/graph/EntityNode.tsx +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/frontend/src/components/graph/GraphCanvas.tsx +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/frontend/src/components/graph/GraphLegend.tsx +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/frontend/src/components/graph/RelationEdge.tsx +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/frontend/src/components/graph/index.ts +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/frontend/src/components/import/CreateGraphDialog.tsx +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/frontend/src/components/import/FileUploader.tsx +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/frontend/src/components/import/GraphSelector.tsx +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/frontend/src/components/import/GraphStatsPreview.tsx +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/frontend/src/components/import/ImportDialog.tsx +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/frontend/src/components/import/ImportProgress.tsx +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/frontend/src/components/import/ImportSettings.tsx +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/frontend/src/components/import/UrlInput.tsx +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/frontend/src/components/panels/AnswerPanel.tsx +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/frontend/src/components/panels/NodeDetailPanel.tsx +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/frontend/src/components/panels/index.ts +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/frontend/src/components/search/SearchInput.tsx +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/frontend/src/components/search/index.ts +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/frontend/src/components/settings/SettingsDialog.tsx +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/frontend/src/components/timeline/ProcessTimeline.tsx +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/frontend/src/components/timeline/index.ts +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/frontend/src/components/ui/Header.tsx +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/frontend/src/components/ui/button.tsx +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/frontend/src/components/ui/dialog.tsx +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/frontend/src/components/ui/input.tsx +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/frontend/src/components/ui/label.tsx +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/frontend/src/components/ui/progress.tsx +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/frontend/src/components/ui/switch.tsx +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/frontend/src/components/ui/tabs.tsx +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/frontend/src/hooks/use-toast.ts +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/frontend/src/index.css +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/frontend/src/main.tsx +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/frontend/src/stores/datasetStore.ts +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/frontend/src/stores/graphStore.ts +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/frontend/src/stores/searchStore.ts +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/frontend/src/types/api.ts +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/frontend/src/utils/cn.ts +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/frontend/src/utils/graphLayout.ts +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/frontend/tsconfig.app.json +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/frontend/tsconfig.json +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/frontend/tsconfig.node.json +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/frontend/vite.config.ts +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/mkdocs.yml +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/src/vector_graph_rag/api/__init__.py +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/src/vector_graph_rag/api/app.py +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/src/vector_graph_rag/config.py +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/src/vector_graph_rag/graph/__init__.py +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/src/vector_graph_rag/graph/builder.py +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/src/vector_graph_rag/graph/graph.py +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/src/vector_graph_rag/graph/knowledge_graph.py +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/src/vector_graph_rag/graph/retriever.py +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/src/vector_graph_rag/llm/__init__.py +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/src/vector_graph_rag/llm/cache.py +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/src/vector_graph_rag/llm/extractor.py +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/src/vector_graph_rag/llm/reranker.py +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/src/vector_graph_rag/loaders/__init__.py +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/src/vector_graph_rag/loaders/chunker.py +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/src/vector_graph_rag/loaders/converter.py +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/src/vector_graph_rag/loaders/url_fetcher.py +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/src/vector_graph_rag/models.py +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/src/vector_graph_rag/storage/__init__.py +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/src/vector_graph_rag/storage/embedding_providers/__init__.py +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/src/vector_graph_rag/storage/embedding_providers/google.py +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/src/vector_graph_rag/storage/embedding_providers/huggingface.py +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/src/vector_graph_rag/storage/embedding_providers/jina.py +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/src/vector_graph_rag/storage/embedding_providers/local.py +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/src/vector_graph_rag/storage/embedding_providers/mistral.py +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/src/vector_graph_rag/storage/embedding_providers/ollama.py +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/src/vector_graph_rag/storage/embedding_providers/onnx.py +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/src/vector_graph_rag/storage/embedding_providers/openai.py +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/src/vector_graph_rag/storage/embedding_providers/utils.py +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/src/vector_graph_rag/storage/embedding_providers/voyage.py +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/src/vector_graph_rag/storage/embeddings.py +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/tests/__init__.py +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/tests/conftest.py +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/tests/test_api.py +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/tests/test_embedding_providers.py +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/tests/test_graph.py +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/tests/test_milvus_store.py +0 -0
- {vector_graph_rag-0.1.5 → vector_graph_rag-0.2.0}/tests/test_rag_metadata_filter.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: vector-graph-rag
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: A Graph RAG implementation using pure vector search with Milvus
|
|
5
5
|
Project-URL: Homepage, https://github.com/zilliztech/vector-graph-rag
|
|
6
6
|
Project-URL: Documentation, https://zilliztech.github.io/vector-graph-rag/
|
|
@@ -195,18 +195,20 @@ rag.rebuild_documents_with_triplets([
|
|
|
195
195
|
<details>
|
|
196
196
|
<summary>🔄 <b>Incremental document updates</b> — click to expand</summary>
|
|
197
197
|
|
|
198
|
-
Use `
|
|
199
|
-
|
|
198
|
+
Use `upsert_documents_by_source()` when a source file, message, or page is
|
|
199
|
+
created or modified. In Vector Graph RAG, a `Document` is a passage/chunk; the
|
|
200
|
+
source object is identified by `metadata["source"]` or the explicit `source`
|
|
201
|
+
argument. The method replaces only that source's chunks and graph references.
|
|
200
202
|
|
|
201
203
|
```python
|
|
202
204
|
from langchain_core.documents import Document
|
|
203
205
|
|
|
204
|
-
rag.
|
|
205
|
-
document_id="sharepoint:file-123",
|
|
206
|
+
rag.upsert_documents_by_source(
|
|
206
207
|
documents=[
|
|
207
208
|
Document(
|
|
208
209
|
page_content="Einstein developed relativity at Princeton.",
|
|
209
210
|
metadata={
|
|
211
|
+
"source": "sharepoint:file-123",
|
|
210
212
|
"triplets": [
|
|
211
213
|
["Einstein", "developed", "relativity"],
|
|
212
214
|
["Einstein", "worked at", "Princeton"],
|
|
@@ -214,13 +216,17 @@ rag.upsert_documents(
|
|
|
214
216
|
},
|
|
215
217
|
),
|
|
216
218
|
],
|
|
217
|
-
metadata={"source": "sharepoint"},
|
|
218
219
|
extract_triplets=False,
|
|
219
220
|
)
|
|
220
221
|
|
|
221
|
-
rag.
|
|
222
|
+
rag.delete_documents_by_source("sharepoint:file-123")
|
|
222
223
|
```
|
|
223
224
|
|
|
225
|
+
> **Migration note:** v0.1.5 exposed `upsert_documents(document_id=...)` and
|
|
226
|
+
> `delete_documents(document_id)`. These names were removed in v0.2.0 because
|
|
227
|
+
> `Document` means passage/chunk in this project. Use the `*_by_source()` APIs
|
|
228
|
+
> shown above.
|
|
229
|
+
|
|
224
230
|
The legacy `add_*` ingestion helpers rebuild the full knowledge base and are planned
|
|
225
231
|
for removal in v1.0.0. For explicit full refreshes, use `rebuild_texts()`,
|
|
226
232
|
`rebuild_documents()`, or `rebuild_documents_with_triplets()`.
|
|
@@ -105,18 +105,20 @@ rag.rebuild_documents_with_triplets([
|
|
|
105
105
|
<details>
|
|
106
106
|
<summary>🔄 <b>Incremental document updates</b> — click to expand</summary>
|
|
107
107
|
|
|
108
|
-
Use `
|
|
109
|
-
|
|
108
|
+
Use `upsert_documents_by_source()` when a source file, message, or page is
|
|
109
|
+
created or modified. In Vector Graph RAG, a `Document` is a passage/chunk; the
|
|
110
|
+
source object is identified by `metadata["source"]` or the explicit `source`
|
|
111
|
+
argument. The method replaces only that source's chunks and graph references.
|
|
110
112
|
|
|
111
113
|
```python
|
|
112
114
|
from langchain_core.documents import Document
|
|
113
115
|
|
|
114
|
-
rag.
|
|
115
|
-
document_id="sharepoint:file-123",
|
|
116
|
+
rag.upsert_documents_by_source(
|
|
116
117
|
documents=[
|
|
117
118
|
Document(
|
|
118
119
|
page_content="Einstein developed relativity at Princeton.",
|
|
119
120
|
metadata={
|
|
121
|
+
"source": "sharepoint:file-123",
|
|
120
122
|
"triplets": [
|
|
121
123
|
["Einstein", "developed", "relativity"],
|
|
122
124
|
["Einstein", "worked at", "Princeton"],
|
|
@@ -124,13 +126,17 @@ rag.upsert_documents(
|
|
|
124
126
|
},
|
|
125
127
|
),
|
|
126
128
|
],
|
|
127
|
-
metadata={"source": "sharepoint"},
|
|
128
129
|
extract_triplets=False,
|
|
129
130
|
)
|
|
130
131
|
|
|
131
|
-
rag.
|
|
132
|
+
rag.delete_documents_by_source("sharepoint:file-123")
|
|
132
133
|
```
|
|
133
134
|
|
|
135
|
+
> **Migration note:** v0.1.5 exposed `upsert_documents(document_id=...)` and
|
|
136
|
+
> `delete_documents(document_id)`. These names were removed in v0.2.0 because
|
|
137
|
+
> `Document` means passage/chunk in this project. Use the `*_by_source()` APIs
|
|
138
|
+
> shown above.
|
|
139
|
+
|
|
134
140
|
The legacy `add_*` ingestion helpers rebuild the full knowledge base and are planned
|
|
135
141
|
for removal in v1.0.0. For explicit full refreshes, use `rebuild_texts()`,
|
|
136
142
|
`rebuild_documents()`, or `rebuild_documents_with_triplets()`.
|
|
@@ -43,27 +43,25 @@ Frequently asked questions about Vector Graph RAG — covering when to use it, c
|
|
|
43
43
|
For very large corpora, consider using a remote Milvus instance rather than Milvus Lite for better performance and scalability.
|
|
44
44
|
|
|
45
45
|
??? note "How do I update or delete one source document?"
|
|
46
|
-
Use `
|
|
46
|
+
Use `upsert_documents_by_source()` for source create/update and `delete_documents_by_source()` for delete. A source can be a file, web page, message, or another business-level object. Its parsed chunks are passed as LangChain `Document` objects, and each chunk should carry the same stable `metadata["source"]` value.
|
|
47
47
|
|
|
48
48
|
```python
|
|
49
49
|
from langchain_core.documents import Document
|
|
50
50
|
|
|
51
|
-
rag.
|
|
52
|
-
document_id="file-123",
|
|
51
|
+
rag.upsert_documents_by_source(
|
|
53
52
|
documents=[
|
|
54
53
|
Document(
|
|
55
54
|
page_content="Updated document chunk text.",
|
|
56
|
-
metadata={"page": 1},
|
|
55
|
+
metadata={"source": "file-123", "page": 1},
|
|
57
56
|
)
|
|
58
57
|
],
|
|
59
|
-
metadata={"source": "sharepoint"},
|
|
60
58
|
extract_triplets=True,
|
|
61
59
|
)
|
|
62
60
|
|
|
63
|
-
rag.
|
|
61
|
+
rag.delete_documents_by_source("file-123")
|
|
64
62
|
```
|
|
65
63
|
|
|
66
|
-
Incremental updates replace only the chunks and graph references for that
|
|
64
|
+
Incremental updates replace only the chunks and graph references for that source value. They are not transactionally atomic, so avoid interrupting or concurrently mutating the same collection prefix during an update.
|
|
67
65
|
|
|
68
66
|
??? note "Can I use local/open-source LLMs?"
|
|
69
67
|
Yes. Vector Graph RAG uses the OpenAI-compatible API format, so any LLM that exposes an OpenAI-compatible endpoint will work. This includes local models served via [Ollama](https://ollama.com/), [vLLM](https://github.com/vllm-project/vllm), [LM Studio](https://lmstudio.ai/), or any other OpenAI-compatible server. You can configure the base URL and model name when initializing the RAG instance. Keep in mind that triplet extraction and reranking quality depend heavily on the LLM's capability — weaker models may produce incomplete or inaccurate triplets, which directly affects retrieval quality. For best results, use a model with strong instruction-following and reasoning abilities.
|
|
@@ -134,7 +134,7 @@ finance_rag = VectorGraphRAG(milvus_uri="./data.db", collection_prefix="finance"
|
|
|
134
134
|
## Adding Documents
|
|
135
135
|
|
|
136
136
|
!!! warning "Full rebuild vs incremental updates"
|
|
137
|
-
`add_texts()`, `add_documents()`, and `add_documents_with_triplets()` rebuild the full knowledge base for the current collection prefix. These legacy convenience APIs are planned for removal in v1.0.0. Use `rebuild_texts()`, `rebuild_documents()`, or `rebuild_documents_with_triplets()` for full refreshes. For source
|
|
137
|
+
`add_texts()`, `add_documents()`, and `add_documents_with_triplets()` rebuild the full knowledge base for the current collection prefix. These legacy convenience APIs are planned for removal in v1.0.0. Use `rebuild_texts()`, `rebuild_documents()`, or `rebuild_documents_with_triplets()` for full refreshes. For source create/update/delete flows, use `upsert_documents_by_source()` and `delete_documents_by_source()`.
|
|
138
138
|
|
|
139
139
|
### From Text Strings
|
|
140
140
|
|
|
@@ -184,17 +184,17 @@ rag.rebuild_documents(result.documents, extract_triplets=True)
|
|
|
184
184
|
|
|
185
185
|
### Incremental Updates
|
|
186
186
|
|
|
187
|
-
Use `
|
|
187
|
+
Use `upsert_documents_by_source()` when a source file, page, or message is created or modified. In Vector Graph RAG, a `Document` is a passage/chunk, and `metadata["source"]` identifies the source object whose chunks should be replaced.
|
|
188
188
|
|
|
189
189
|
```python
|
|
190
190
|
from langchain_core.documents import Document
|
|
191
191
|
|
|
192
|
-
rag.
|
|
193
|
-
document_id="sharepoint:file-123",
|
|
192
|
+
rag.upsert_documents_by_source(
|
|
194
193
|
documents=[
|
|
195
194
|
Document(
|
|
196
195
|
page_content="Einstein developed relativity at Princeton.",
|
|
197
196
|
metadata={
|
|
197
|
+
"source": "sharepoint:file-123",
|
|
198
198
|
"triplets": [
|
|
199
199
|
["Einstein", "developed", "relativity"],
|
|
200
200
|
["Einstein", "worked at", "Princeton"],
|
|
@@ -202,15 +202,17 @@ rag.upsert_documents(
|
|
|
202
202
|
},
|
|
203
203
|
)
|
|
204
204
|
],
|
|
205
|
-
metadata={"source": "sharepoint"},
|
|
206
205
|
extract_triplets=False,
|
|
207
206
|
)
|
|
208
207
|
|
|
209
|
-
rag.
|
|
208
|
+
rag.delete_documents_by_source("sharepoint:file-123")
|
|
210
209
|
```
|
|
211
210
|
|
|
211
|
+
!!! warning "v0.2.0 migration"
|
|
212
|
+
`upsert_documents(document_id=...)` and `delete_documents(document_id)` were removed because `Document` means passage/chunk in this project. Use `upsert_documents_by_source()` and `delete_documents_by_source()` with a stable `metadata["source"]` value instead.
|
|
213
|
+
|
|
212
214
|
!!! note "Consistency model"
|
|
213
|
-
Incremental updates perform a
|
|
215
|
+
Incremental updates perform a source-level cascade across passages, entities, and relations. They are not transactionally atomic, so avoid interrupting or concurrently mutating the same collection prefix during an update.
|
|
214
216
|
|
|
215
217
|
## Querying
|
|
216
218
|
|
|
@@ -223,4 +223,4 @@ flowchart TD
|
|
|
223
223
|
Triplet extraction and reranking quality depends heavily on the underlying LLM's capability. Weaker models may produce incomplete or inaccurate triplets, which directly affects retrieval quality.
|
|
224
224
|
|
|
225
225
|
!!! warning "Graph Consistency"
|
|
226
|
-
The knowledge graph topology is maintained as a logical layer on top of Milvus via cross-referenced ID fields. Since Milvus does not support transactions, multi-step mutations (e.g.,
|
|
226
|
+
The knowledge graph topology is maintained as a logical layer on top of Milvus via cross-referenced ID fields. Since Milvus does not support transactions, multi-step mutations (e.g., source-level cascade updates) are not atomic and may leave inconsistent state if interrupted. Use `rebuild_documents()` for initial bulk indexing or full refreshes, and use `upsert_documents_by_source()` / `delete_documents_by_source()` for source updates when the write operation is expected to run to completion.
|
|
@@ -114,7 +114,7 @@ print(result.answer)
|
|
|
114
114
|
```
|
|
115
115
|
|
|
116
116
|
!!! note "Ingestion semantics"
|
|
117
|
-
The legacy `add_*` ingestion helpers rebuild the full knowledge base and are planned for removal in v1.0.0. Use `rebuild_texts()`, `rebuild_documents()`, or `rebuild_documents_with_triplets()` for full refreshes, and use `
|
|
117
|
+
The legacy `add_*` ingestion helpers rebuild the full knowledge base and are planned for removal in v1.0.0. Use `rebuild_texts()`, `rebuild_documents()`, or `rebuild_documents_with_triplets()` for full refreshes, and use `upsert_documents_by_source()` / `delete_documents_by_source()` when a source file, page, or message changes later.
|
|
118
118
|
|
|
119
119
|
!!! tip "Getting Started"
|
|
120
120
|
See the [Getting Started](getting-started.md) guide for installation and configuration options.
|
|
@@ -177,7 +177,7 @@ Legacy compatibility wrapper for rebuilding the graph from plain text strings.
|
|
|
177
177
|
|
|
178
178
|
!!! warning "Full rebuild"
|
|
179
179
|
This method delegates to `rebuild_texts()` and rebuilds the full knowledge base.
|
|
180
|
-
This legacy convenience API is planned for removal in v1.0.0. Use [`rebuild_texts`](#rebuild_texts) for full refreshes, or [`
|
|
180
|
+
This legacy convenience API is planned for removal in v1.0.0. Use [`rebuild_texts`](#rebuild_texts) for full refreshes, or [`upsert_documents_by_source`](#upsert_documents_by_source) for source-level incremental updates.
|
|
181
181
|
|
|
182
182
|
```python
|
|
183
183
|
def add_texts(
|
|
@@ -251,7 +251,7 @@ result = rag.rebuild_texts([
|
|
|
251
251
|
Legacy compatibility wrapper for rebuilding the graph from [LangChain `Document`](https://python.langchain.com/docs/modules/data_connection/document_loaders/) objects.
|
|
252
252
|
|
|
253
253
|
!!! warning "Full rebuild"
|
|
254
|
-
`add_documents()` keeps its original behavior for backward compatibility: it drops and recreates the Milvus collections for this graph before indexing the provided documents. This legacy API is planned for removal in v1.0.0. Use [`rebuild_documents`](#rebuild_documents) when you want this behavior explicitly, or [`
|
|
254
|
+
`add_documents()` keeps its original behavior for backward compatibility: it drops and recreates the Milvus collections for this graph before indexing the provided documents. This legacy API is planned for removal in v1.0.0. Use [`rebuild_documents`](#rebuild_documents) when you want this behavior explicitly, or [`upsert_documents_by_source`](#upsert_documents_by_source) for source-level incremental create/update.
|
|
255
255
|
|
|
256
256
|
```python
|
|
257
257
|
def add_documents(
|
|
@@ -311,7 +311,7 @@ Use this for initial bulk indexing, benchmark rebuilds, or when you intentionall
|
|
|
311
311
|
Legacy compatibility wrapper for rebuilding the graph from documents where triplets have already been extracted externally.
|
|
312
312
|
|
|
313
313
|
!!! warning "Full rebuild"
|
|
314
|
-
This method delegates to `rebuild_documents_with_triplets()` and rebuilds the full knowledge base. This legacy convenience API is planned for removal in v1.0.0. For pre-extracted triplets in an incremental update, put the triplets in each chunk's `metadata["triplets"]` and call [`
|
|
314
|
+
This method delegates to `rebuild_documents_with_triplets()` and rebuilds the full knowledge base. This legacy convenience API is planned for removal in v1.0.0. For pre-extracted triplets in an incremental update, put the triplets in each chunk's `metadata["triplets"]` and call [`upsert_documents_by_source`](#upsert_documents_by_source) with `extract_triplets=False`.
|
|
315
315
|
|
|
316
316
|
```python
|
|
317
317
|
def add_documents_with_triplets(
|
|
@@ -375,14 +375,15 @@ Optional `metadata` is stored on the passage and can be used by query filters.
|
|
|
375
375
|
|
|
376
376
|
---
|
|
377
377
|
|
|
378
|
-
#### `
|
|
378
|
+
#### `upsert_documents_by_source`
|
|
379
379
|
|
|
380
|
-
Incrementally create or replace one source
|
|
380
|
+
Incrementally create or replace all chunks that belong to one source. A source can be a file, page, message, SharePoint item, business record, or any other stable external object. In Vector Graph RAG, a LangChain `Document` is a passage/chunk; source ownership is represented by `metadata["source"]` by default.
|
|
381
381
|
|
|
382
382
|
```python
|
|
383
|
-
def
|
|
384
|
-
document_id: str,
|
|
383
|
+
def upsert_documents_by_source(
|
|
385
384
|
documents: List[Document],
|
|
385
|
+
source: Optional[str] = None,
|
|
386
|
+
source_field: str = "source",
|
|
386
387
|
metadata: Optional[Dict[str, Any]] = None,
|
|
387
388
|
extract_triplets: bool = True,
|
|
388
389
|
show_progress: bool = True,
|
|
@@ -391,15 +392,18 @@ def upsert_documents(
|
|
|
391
392
|
|
|
392
393
|
| Parameter | Description |
|
|
393
394
|
|---|---|
|
|
394
|
-
| `
|
|
395
|
-
| `
|
|
396
|
-
| `
|
|
395
|
+
| `documents` | Parsed chunks/passages for one source. If a chunk has `Document.id`, it is used as the passage ID; otherwise a deterministic passage ID is generated from `source` and chunk index. |
|
|
396
|
+
| `source` | Optional stable source value. If omitted, all documents must include the same `Document.metadata[source_field]` value. |
|
|
397
|
+
| `source_field` | Metadata field used to group chunks by source. Defaults to `"source"`. |
|
|
398
|
+
| `metadata` | Source-level metadata merged into every chunk. It must not conflict with `source` or the chunks' `source_field` values. |
|
|
397
399
|
| `extract_triplets` | If `True`, extract triplets from each chunk. If triplets are already in `metadata["triplets"]`, set this to `False`. |
|
|
398
400
|
| `show_progress` | Show a progress bar. |
|
|
399
401
|
|
|
400
402
|
**Returns:** [`ExtractionResult`](#extractionresult)
|
|
401
403
|
|
|
402
|
-
If
|
|
404
|
+
If the source does not exist, the method inserts a new source. If it already exists, the method deletes the previous chunks for that source, updates graph references, and inserts the new chunks without rebuilding unrelated sources.
|
|
405
|
+
|
|
406
|
+
The method accepts exactly one source per call. If `source` is not provided and the documents contain multiple `metadata[source_field]` values, it raises `ValueError`.
|
|
403
407
|
|
|
404
408
|
```python
|
|
405
409
|
from langchain_core.documents import Document
|
|
@@ -407,40 +411,49 @@ from langchain_core.documents import Document
|
|
|
407
411
|
chunks = [
|
|
408
412
|
Document(
|
|
409
413
|
page_content="Alpha owns the blue database.",
|
|
410
|
-
metadata={
|
|
414
|
+
metadata={
|
|
415
|
+
"source": "sharepoint:file-123",
|
|
416
|
+
"triplets": [["Alpha", "owns", "blue database"]],
|
|
417
|
+
},
|
|
411
418
|
)
|
|
412
419
|
]
|
|
413
420
|
|
|
414
|
-
rag.
|
|
415
|
-
document_id="sharepoint:file-123",
|
|
421
|
+
rag.upsert_documents_by_source(
|
|
416
422
|
documents=chunks,
|
|
417
|
-
metadata={"tenant_id": "team_a"
|
|
423
|
+
metadata={"tenant_id": "team_a"},
|
|
418
424
|
extract_triplets=False,
|
|
419
425
|
)
|
|
420
426
|
```
|
|
421
427
|
|
|
422
428
|
---
|
|
423
429
|
|
|
424
|
-
#### `
|
|
430
|
+
#### `delete_documents_by_source`
|
|
425
431
|
|
|
426
|
-
Incrementally delete one source
|
|
432
|
+
Incrementally delete all chunks that belong to one source and remove graph references that only belonged to that source.
|
|
427
433
|
|
|
428
434
|
```python
|
|
429
|
-
def
|
|
435
|
+
def delete_documents_by_source(
|
|
436
|
+
source: str,
|
|
437
|
+
source_field: str = "source",
|
|
438
|
+
) -> bool
|
|
430
439
|
```
|
|
431
440
|
|
|
432
441
|
| Parameter | Description |
|
|
433
442
|
|---|---|
|
|
434
|
-
| `
|
|
443
|
+
| `source` | Stable source value previously used with `upsert_documents_by_source()`. |
|
|
444
|
+
| `source_field` | Metadata field used to group chunks by source. Defaults to `"source"`. |
|
|
435
445
|
|
|
436
446
|
**Returns:** `True` if at least one passage was deleted; otherwise `False`.
|
|
437
447
|
|
|
438
|
-
Shared entities and relations are preserved when other
|
|
448
|
+
Shared entities and relations are preserved when other sources still reference them. Orphaned relations and entities are removed.
|
|
439
449
|
|
|
440
450
|
```python
|
|
441
|
-
deleted = rag.
|
|
451
|
+
deleted = rag.delete_documents_by_source("sharepoint:file-123")
|
|
442
452
|
```
|
|
443
453
|
|
|
454
|
+
!!! warning "v0.2.0 migration"
|
|
455
|
+
`upsert_documents(document_id=...)` and `delete_documents(document_id)` were removed because `Document` means passage/chunk in this project. These methods now raise `RuntimeError` with migration guidance. Use `upsert_documents_by_source()` and `delete_documents_by_source()` with a stable `metadata["source"]` value.
|
|
456
|
+
|
|
444
457
|
---
|
|
445
458
|
|
|
446
459
|
#### `query`
|
|
@@ -654,7 +667,7 @@ print(f"Final passages: {len(result.passages)}")
|
|
|
654
667
|
|
|
655
668
|
## ExtractionResult
|
|
656
669
|
|
|
657
|
-
A data class returned by document ingestion methods, including legacy `add_*`, `rebuild_*`, and `
|
|
670
|
+
A data class returned by document ingestion methods, including legacy `add_*`, `rebuild_*`, and `upsert_documents_by_source()`. It summarises what was ingested and extracted.
|
|
658
671
|
|
|
659
672
|
```python
|
|
660
673
|
from vector_graph_rag import ExtractionResult
|
|
@@ -161,7 +161,7 @@ curl -X DELETE http://localhost:8000/graph/my_graph
|
|
|
161
161
|
Indexes documents by rebuilding the selected graph. Optionally extracts knowledge graph triplets from the text using the configured LLM.
|
|
162
162
|
|
|
163
163
|
!!! warning "Full rebuild"
|
|
164
|
-
This endpoint uses the Python full-rebuild ingestion path. Calling it replaces the current graph contents for the selected `graph_name`.
|
|
164
|
+
This endpoint uses the Python full-rebuild ingestion path. Calling it replaces the current graph contents for the selected `graph_name`. Source-level incremental upsert/delete is currently available through the Python API via `upsert_documents_by_source()` and `delete_documents_by_source()`.
|
|
165
165
|
|
|
166
166
|
**Query Parameters**
|
|
167
167
|
|
|
@@ -230,7 +230,7 @@ curl -X POST "http://localhost:8000/add_documents?graph_name=my_graph" \
|
|
|
230
230
|
Imports documents from URLs or local file paths. Supports chunking for large documents.
|
|
231
231
|
|
|
232
232
|
!!! warning "Full rebuild"
|
|
233
|
-
Imported documents are indexed through the full-rebuild ingestion path for the target graph. Use the Python API for
|
|
233
|
+
Imported documents are indexed through the full-rebuild ingestion path for the target graph. Use the Python API for source-level incremental updates after parsing files externally.
|
|
234
234
|
|
|
235
235
|
**Request Body**
|
|
236
236
|
|
|
@@ -402,7 +402,7 @@ Retrieves a single document by its ID.
|
|
|
402
402
|
|
|
403
403
|
| Parameter | Type | Description |
|
|
404
404
|
|---|---|---|
|
|
405
|
-
| `document_id` | `string` | The document ID. |
|
|
405
|
+
| `document_id` | `string` | The passage/document ID used by the REST document CRUD endpoints. This is not the source key used by `upsert_documents_by_source()`. |
|
|
406
406
|
|
|
407
407
|
**Query Parameters**
|
|
408
408
|
|
|
@@ -18,7 +18,7 @@ from vector_graph_rag.rag import VectorGraphRAG, create_rag
|
|
|
18
18
|
from vector_graph_rag.storage.embeddings import EmbeddingModel
|
|
19
19
|
from vector_graph_rag.storage.milvus import MilvusStore
|
|
20
20
|
|
|
21
|
-
__version__ = "0.
|
|
21
|
+
__version__ = "0.2.0"
|
|
22
22
|
|
|
23
23
|
__all__ = [
|
|
24
24
|
"Settings",
|