hana-kgvector 0.2.8 → 0.2.9
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 +27 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -308,7 +308,7 @@ for (const g of graphs) {
|
|
|
308
308
|
|-----------|------|---------|-------------|
|
|
309
309
|
| `propertyGraphStore` | `PropertyGraphStore` | Required | HANA-backed graph store instance |
|
|
310
310
|
| `embedModel` | `EmbedModel` | - | Embedding model for vector search |
|
|
311
|
-
| `kgExtractors` | `TransformComponent[]` | `[ImplicitPathExtractor]` | Pipeline of entity/relation extractors |
|
|
311
|
+
| `kgExtractors` | `TransformComponent[]` | `[ImplicitPathExtractor]` | Pipeline of entity/relation extractors. Pass `[]` for embed-only mode (vector search without KG extraction). |
|
|
312
312
|
| `embedKgNodes` | `boolean` | `true` | Generate embeddings for extracted entity nodes |
|
|
313
313
|
| `showProgress` | `boolean` | `false` | Log progress during extraction |
|
|
314
314
|
| `maxEmbedTokens` | `number` | `8000` | Max tokens per text sent to the embedding model. Texts exceeding this are truncated using tiktoken (`cl100k_base` encoding). Default includes a safety buffer for 8192-token models like `text-embedding-3-small`. |
|
|
@@ -367,7 +367,7 @@ const results = await index.query("Apple CEO", {
|
|
|
367
367
|
|
|
368
368
|
| Parameter | Type | Default | Description |
|
|
369
369
|
|-----------|------|---------|-------------|
|
|
370
|
-
| `llm` | `LLMClient` | Required | LLM client for entity extraction |
|
|
370
|
+
| `llm` | `LLMClient` | Required | LLM client for entity extraction. Uses the `Parseable<T>` interface (`{ parse(data: unknown): T }`) — compatible with both Zod 3 and Zod 4. |
|
|
371
371
|
| `schema.entityTypes` | `string[]` | Required | Allowed entity types (e.g., `["PERSON", "ORG"]`) |
|
|
372
372
|
| `schema.relationTypes` | `string[]` | Required | Allowed relation types (e.g., `["WORKS_AT"]`) |
|
|
373
373
|
| `schema.validationSchema` | `[string,string,string][]` | - | Valid triplet patterns (e.g., `["PERSON", "WORKS_AT", "ORG"]`) |
|
|
@@ -422,6 +422,31 @@ This enables image/table chunks to be retrieved when nearby text matches a query
|
|
|
422
422
|
- `chunkIndex` — for adjacent-chunk linking
|
|
423
423
|
- `contentType` — (optional) for `crossTypeOnly` mode
|
|
424
424
|
|
|
425
|
+
## Embed-Only Mode (Vector Search without KG Extraction)
|
|
426
|
+
|
|
427
|
+
If you manage entities and relationships externally (e.g., from a programmatic parser), you can use `PropertyGraphIndex` purely for vector search by passing an empty extractors array:
|
|
428
|
+
|
|
429
|
+
```typescript
|
|
430
|
+
const index = new PropertyGraphIndex({
|
|
431
|
+
propertyGraphStore: graphStore,
|
|
432
|
+
embedModel,
|
|
433
|
+
kgExtractors: [], // No LLM-based extraction
|
|
434
|
+
});
|
|
435
|
+
|
|
436
|
+
// Insert documents — only embeddings and document nodes are stored
|
|
437
|
+
await index.insert([
|
|
438
|
+
{ id: "doc_1", text: "Alice works at SAP.", metadata: {} },
|
|
439
|
+
{ id: "doc_2", text: "SAP is headquartered in Walldorf.", metadata: {} },
|
|
440
|
+
]);
|
|
441
|
+
|
|
442
|
+
// Query via vector similarity
|
|
443
|
+
const results = await index.query("Where is SAP located?");
|
|
444
|
+
|
|
445
|
+
// Entities/relations can be inserted separately via the store
|
|
446
|
+
await graphStore.upsertNodes([...]);
|
|
447
|
+
await graphStore.upsertRelations([...]);
|
|
448
|
+
```
|
|
449
|
+
|
|
425
450
|
## Multi-Tenancy
|
|
426
451
|
|
|
427
452
|
Isolate data for different domains using separate graph names:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hana-kgvector",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.9",
|
|
4
4
|
"description": "A TypeScript framework for building hybrid GraphRAG applications using SAP HANA Cloud as the unified backend for knowledge graphs (RDF) and vector embeddings",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|