From 0edb9583571f770206e0e2065f79b44c6023cbed Mon Sep 17 00:00:00 2001 From: jin <52519003+jin38324@users.noreply.github.com> Date: Wed, 27 Nov 2024 15:20:10 +0800 Subject: [PATCH] Update insert_custom_kg.py --- examples/insert_custom_kg.py | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/examples/insert_custom_kg.py b/examples/insert_custom_kg.py index bbabe6a9..19da0f29 100644 --- a/examples/insert_custom_kg.py +++ b/examples/insert_custom_kg.py @@ -1,5 +1,5 @@ import os -from lightrag import LightRAG, QueryParam +from lightrag import LightRAG from lightrag.llm import gpt_4o_mini_complete ######### # Uncomment the below two lines if running in a jupyter notebook to handle the async nature of rag.insert() @@ -24,50 +24,50 @@ custom_kg = { "entity_name": "CompanyA", "entity_type": "Organization", "description": "A major technology company", - "source_id": "Source1" + "source_id": "Source1", }, { "entity_name": "ProductX", "entity_type": "Product", "description": "A popular product developed by CompanyA", - "source_id": "Source1" + "source_id": "Source1", }, { "entity_name": "PersonA", "entity_type": "Person", "description": "A renowned researcher in AI", - "source_id": "Source2" + "source_id": "Source2", }, { "entity_name": "UniversityB", "entity_type": "Organization", "description": "A leading university specializing in technology and sciences", - "source_id": "Source2" + "source_id": "Source2", }, { "entity_name": "CityC", "entity_type": "Location", "description": "A large metropolitan city known for its culture and economy", - "source_id": "Source3" + "source_id": "Source3", }, { "entity_name": "EventY", "entity_type": "Event", "description": "An annual technology conference held in CityC", - "source_id": "Source3" + "source_id": "Source3", }, { "entity_name": "CompanyD", "entity_type": "Organization", "description": "A financial services company specializing in insurance", - "source_id": "Source4" + "source_id": "Source4", }, { "entity_name": "ServiceZ", "entity_type": "Service", "description": "An insurance product offered by CompanyD", - "source_id": "Source4" - } + "source_id": "Source4", + }, ], "relationships": [ { @@ -76,7 +76,7 @@ custom_kg = { "description": "CompanyA develops ProductX", "keywords": "develop, produce", "weight": 1.0, - "source_id": "Source1" + "source_id": "Source1", }, { "src_id": "PersonA", @@ -84,7 +84,7 @@ custom_kg = { "description": "PersonA works at UniversityB", "keywords": "employment, affiliation", "weight": 0.9, - "source_id": "Source2" + "source_id": "Source2", }, { "src_id": "CityC", @@ -92,7 +92,7 @@ custom_kg = { "description": "EventY is hosted in CityC", "keywords": "host, location", "weight": 0.8, - "source_id": "Source3" + "source_id": "Source3", }, { "src_id": "CompanyD", @@ -100,9 +100,9 @@ custom_kg = { "description": "CompanyD provides ServiceZ", "keywords": "provide, offer", "weight": 1.0, - "source_id": "Source4" - } - ] + "source_id": "Source4", + }, + ], } rag.insert_custom_kg(custom_kg)