@anvia/neo4j 1.0.3 → 1.0.4
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 +18 -29
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -16,9 +16,8 @@ pnpm add @anvia/graph @anvia/neo4j @anvia/core
|
|
|
16
16
|
|
|
17
17
|
```ts
|
|
18
18
|
import { Agent } from "@anvia/core/agent";
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import { Neo4jClient, defineNeo4jGraphSchema, extractGraphFacts } from "@anvia/neo4j";
|
|
19
|
+
import { createGraphSearchTool, ingestGraphText } from "@anvia/graph";
|
|
20
|
+
import { Neo4jClient, defineNeo4jGraphSchema } from "@anvia/neo4j";
|
|
22
21
|
import { z } from "zod";
|
|
23
22
|
|
|
24
23
|
const schema = defineNeo4jGraphSchema({
|
|
@@ -71,32 +70,21 @@ const graph = client.managedKnowledgeGraph({
|
|
|
71
70
|
|
|
72
71
|
await graph.ensure({ indexTimeoutMs: 60_000 });
|
|
73
72
|
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
id: (entity) => entity.key,
|
|
86
|
-
content: (entity) => formatEntity(entity),
|
|
87
|
-
}),
|
|
88
|
-
]);
|
|
89
|
-
|
|
90
|
-
const write = await graph.replaceDocuments({
|
|
91
|
-
documents,
|
|
92
|
-
chunks: embeddedChunks.documents,
|
|
93
|
-
entities: embeddedEntities.documents,
|
|
94
|
-
relationships: facts.output.relationships,
|
|
95
|
-
mentions: facts.output.mentions,
|
|
73
|
+
const ingestion = await ingestGraphText({
|
|
74
|
+
graph,
|
|
75
|
+
document: { id: "incident-42", text },
|
|
76
|
+
extractionModel,
|
|
77
|
+
embeddingModel,
|
|
78
|
+
chunking: {
|
|
79
|
+
strategy: "recursive",
|
|
80
|
+
maxSize: 1_000,
|
|
81
|
+
overlap: 100,
|
|
82
|
+
separators: ["\n\n", "\n", " "],
|
|
83
|
+
},
|
|
96
84
|
conflict: "error",
|
|
97
85
|
orphanEntities: "delete",
|
|
98
86
|
});
|
|
99
|
-
console.log(write);
|
|
87
|
+
console.log(ingestion.write);
|
|
100
88
|
|
|
101
89
|
const searchGraph = createGraphSearchTool({
|
|
102
90
|
name: "search_support_graph",
|
|
@@ -123,9 +111,10 @@ const searchGraph = createGraphSearchTool({
|
|
|
123
111
|
const agent = new Agent({ id: "support", model: chatModel, tools: [searchGraph] });
|
|
124
112
|
```
|
|
125
113
|
|
|
126
|
-
The application owns file discovery, reading,
|
|
127
|
-
|
|
128
|
-
`
|
|
114
|
+
The application owns file discovery, reading, model loading, retry policy, and Agent lifecycle.
|
|
115
|
+
`ingestGraphText()` and `ingestGraphDocuments()` provide the convenient end-to-end path. Advanced
|
|
116
|
+
callers can compose `prepareGraphDocuments()`, `extractGraphFacts()`, `embedDocuments()`, and
|
|
117
|
+
`replaceDocuments()` directly when they need custom orchestration.
|
|
129
118
|
|
|
130
119
|
Graph property schemas must use `z.strictObject()` and must not coerce, default, transform,
|
|
131
120
|
preprocess, catch, trim, or otherwise overwrite values. This keeps extraction, comparison, and
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anvia/neo4j",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "Schema-first Neo4j GraphRAG integration for Anvia.",
|
|
5
5
|
"author": "anvia",
|
|
6
6
|
"maintainer": "Indra Zulfi",
|
|
@@ -28,17 +28,17 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"neo4j-driver": "^6.2.0",
|
|
30
30
|
"zod": "^4.4.3",
|
|
31
|
-
"@anvia/graph": "1.0.
|
|
31
|
+
"@anvia/graph": "1.0.4"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@types/node": "^24.9.1",
|
|
35
35
|
"tsup": "^8.5.0",
|
|
36
36
|
"typescript": "^5.9.3",
|
|
37
37
|
"vitest": "^4.0.8",
|
|
38
|
-
"@anvia/core": "1.0.
|
|
38
|
+
"@anvia/core": "1.0.3"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"@anvia/core": "1.0.
|
|
41
|
+
"@anvia/core": "1.0.3"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"build": "tsup src/index.ts --format esm --dts --sourcemap --clean",
|