Skip to main content
Nowledge MemNowledge Mem

Apply Memory Kg Extraction

POST
/memories/{memory_id}/extract-kg/apply

Apply knowledge graph extraction results to a memory.

This endpoint saves the extracted entities and relationships to the graph database and updates the memory's metadata to track the extraction. Exact mode isolates caller-owned entity identities from automatic alias and punctuation matching. Identity lookup/update is transactional per entity, but the batch is not atomic. On storage failure, success is false and some writes may have persisted; inspect resolved_entities before retrying. Entity replay reuses IDs; relationships retain append semantics. Existing aliases and historical graph contamination are not repaired automatically.

Path Parameters

memory_id*Memory Id

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Request to apply KG extraction results to a memory.

Note: memory_id is provided in the URL path, not in the request body. Exact requests reject invalid batches before writing and reject ambiguous stored identities. Older backends may ignore this field; upgrade the backend before relying on exact resolution.

Response Body

application/json

application/json

curl -X POST "https://example.com/memories/string/extract-kg/apply" \  -H "Content-Type: application/json" \  -d '{    "entities": [      null    ],    "relationships": [      null    ],    "extraction_confidence": 0  }'
{  "success": true,  "memory_id": "string",  "entities_created": 0,  "relationships_created": 0,  "metadata_updated": true,  "error": "string",  "entity_resolution": "exact",  "resolved_entities": [    {      "id": "string",      "name": "string",      "entity_type": "string"    }  ],  "index_repair_needed": true,  "warnings": [    "string"  ]}