feat: implement automated knowledge graph extraction pipeline and visualization component

This commit is contained in:
RaymondVerhoef
2026-05-20 08:55:27 +02:00
parent 08aaed591f
commit d5655d2232
3 changed files with 35 additions and 7 deletions

View File

@@ -27,7 +27,11 @@ export async function upsertTopic(topic) {
await pb.collection('topics').getOne(topic.id);
return await pb.collection('topics').update(topic.id, topic);
} catch {
return await pb.collection('topics').create({ id: topic.id, ...topic });
return await pb.collection('topics').create({
id: topic.id,
learning_relevance: 'standard',
...topic
});
}
}

View File

@@ -6,6 +6,12 @@ You receive a source text. Your task is to extract core concepts, roles, and pro
Facts should be integrated into the descriptions of the other labels and NOT be extracted as unique topics.
CRITICAL: To ensure the response fits within limits, extract a maximum of 15 key topics and their most important relations. Keep descriptions very concise.
You MUST assign a learning_relevance to each topic:
- "core": Fundamental company knowledge.
- "standard": Normal learning topics.
- "peripheral": Good to know, but low priority.
- "exclude": Pure operational reference material (e.g., printer guides, wifi passwords) that should NEVER be tested.
ALWAYS return a valid JSON object in the following format:
{
"topics": [
@@ -13,7 +19,8 @@ ALWAYS return a valid JSON object in the following format:
"id": "unique-slug",
"label": "Topic title",
"type": "concept | role | process",
"description": "A concise, clear explanation of max 3 sentences."
"description": "A concise, clear explanation of max 3 sentences.",
"learning_relevance": "core | standard | peripheral | exclude"
}
],
"relations": [
@@ -35,10 +42,16 @@ You must explicitly identify and create relations between Roles, Processes, and
Every Process must have a Role attached (who does it).
Every Concept must have a relation to a Process or Role.
You MUST assign a learning_relevance to each topic:
- "core": Fundamental company knowledge.
- "standard": Normal learning topics.
- "peripheral": Good to know, but low priority.
- "exclude": Pure operational reference material (e.g., printer guides, wifi passwords) that should NEVER be tested.
Return a JSON object:
{
"topics": [
{ "id": "...", "label": "...", "type": "role | process | concept", "description": "...", "metadata": { "source": "github_handbook" } }
{ "id": "...", "label": "...", "type": "role | process | concept", "description": "...", "learning_relevance": "standard", "metadata": { "source": "github_handbook" } }
],
"relations": [
{ "source": "role-id", "target": "process-id", "type": "executes | related_to | depends_on | part_of", "description": "Brief metadata about this specific relation" }