@anvia/neo4j 1.0.8 → 1.0.10
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 +46 -0
- package/dist/{chunk-QNHOT7P2.js → chunk-EUZ5C6OC.js} +211 -88
- package/dist/chunk-EUZ5C6OC.js.map +1 -0
- package/dist/{chunk-PWE3ETSF.js → chunk-QY7IO247.js} +59 -21
- package/dist/chunk-QY7IO247.js.map +1 -0
- package/dist/{chunk-YLW4LCKJ.js → chunk-YCJZAWLH.js} +66 -12
- package/dist/chunk-YCJZAWLH.js.map +1 -0
- package/dist/explore-HRISJG7V.js +8 -0
- package/dist/index.d.ts +19 -4
- package/dist/index.js +31 -4
- package/dist/index.js.map +1 -1
- package/dist/retrieve-IJVPFOPP.js +8 -0
- package/package.json +4 -4
- package/dist/chunk-PWE3ETSF.js.map +0 -1
- package/dist/chunk-QNHOT7P2.js.map +0 -1
- package/dist/chunk-YLW4LCKJ.js.map +0 -1
- package/dist/explore-RA53GFX2.js +0 -8
- package/dist/retrieve-QRQHIVRO.js +0 -8
- /package/dist/{explore-RA53GFX2.js.map → explore-HRISJG7V.js.map} +0 -0
- /package/dist/{retrieve-QRQHIVRO.js.map → retrieve-IJVPFOPP.js.map} +0 -0
package/README.md
CHANGED
|
@@ -111,6 +111,37 @@ const searchGraph = createGraphSearchTool({
|
|
|
111
111
|
const agent = new Agent({ id: "support", model: chatModel, tools: [searchGraph] });
|
|
112
112
|
```
|
|
113
113
|
|
|
114
|
+
Call `ensure()` once during application startup or deployment initialization, then reuse the graph
|
|
115
|
+
handle in jobs. It is idempotent, but calling it for every ingestion job adds version, schema, and
|
|
116
|
+
index checks to the hot path. Call `validate()` for readiness checks that must never provision.
|
|
117
|
+
|
|
118
|
+
## Tenant namespaces
|
|
119
|
+
|
|
120
|
+
Reuse the same labels, indexes, and Qdrant collection across tenants without constructing resource
|
|
121
|
+
names from user input:
|
|
122
|
+
|
|
123
|
+
```ts
|
|
124
|
+
const tenant = client.tenant(userId);
|
|
125
|
+
const graph = tenant.managedKnowledgeGraph({ name: "support", schema, resources });
|
|
126
|
+
|
|
127
|
+
const qdrantTenant = qdrant.tenant(userId);
|
|
128
|
+
const vectors = qdrantTenant.vectorStore({
|
|
129
|
+
collectionName: "support_documents",
|
|
130
|
+
dimensions: 1536,
|
|
131
|
+
});
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Both adapters hash the tenant ID using the same deterministic namespace. Neo4j includes that
|
|
135
|
+
namespace in managed uniqueness constraints, indexed vector filtering, writes, retrieval,
|
|
136
|
+
traversal, evidence, deletion, and exploration. Do not mix namespaced and non-namespaced handles
|
|
137
|
+
with the same Neo4j resource definitions; `validate()` reports the incompatible constraint or
|
|
138
|
+
index so it can be migrated explicitly.
|
|
139
|
+
|
|
140
|
+
Tenant handles scope Anvia's managed lifecycle, retrieval, and exploration APIs; they are not a
|
|
141
|
+
database authorization boundary. `graph.query()` and `client.nativeDriver()` intentionally expose
|
|
142
|
+
raw Cypher access. Use separate Neo4j credentials or databases when untrusted callers require a
|
|
143
|
+
hard security boundary.
|
|
144
|
+
|
|
114
145
|
The application owns file discovery, reading, model loading, retry policy, and Agent lifecycle.
|
|
115
146
|
`ingestGraphText()` and `ingestGraphDocuments()` provide the convenient end-to-end path. Advanced
|
|
116
147
|
callers can compose `prepareGraphDocuments()`, `extractGraphFacts()`, `embedDocuments()`, and
|
|
@@ -183,6 +214,21 @@ const neighborhood = await graph.explore({
|
|
|
183
214
|
});
|
|
184
215
|
```
|
|
185
216
|
|
|
217
|
+
Pass `includeProvenance: true` to expose supported source document and chunk IDs on explorer nodes
|
|
218
|
+
and relationships. This can drive article-to-entity UI links without a separate identity mapping
|
|
219
|
+
table; Neo4j element IDs remain opaque expansion cursors.
|
|
220
|
+
|
|
221
|
+
## Production ingestion workflow
|
|
222
|
+
|
|
223
|
+
For a queue worker (including BullMQ), use stable document IDs, attach a monotonic revision, and
|
|
224
|
+
call `ingestGraphTextToStores({ graph, vectorStore, ... })`. Persist its receipt as the job result.
|
|
225
|
+
Retry extraction/provider failures as a whole. If `GraphIngestionStageError.stage === "vector"`,
|
|
226
|
+
the graph transaction already committed; re-run the idempotent job with `conflict: "overwrite"`.
|
|
227
|
+
Refresh by replacing the same document ID;
|
|
228
|
+
delete from both stores and record each completed stage. Pass the queue cancellation signal through
|
|
229
|
+
`abortSignal`, create tenant-scoped handles before processing user-owned jobs, and request explorer
|
|
230
|
+
provenance for source attribution.
|
|
231
|
+
|
|
186
232
|
The explorer returns Neo4j element IDs as opaque strings, limits every query, and omits embeddings
|
|
187
233
|
and other `__anvia_*` properties. Use stable graph identity properties for application logic; use the
|
|
188
234
|
opaque IDs only to expand the current view.
|