fix custom kg demo
This commit is contained in:
70
README.md
70
README.md
@@ -505,44 +505,58 @@ rag.query_with_separate_keyword_extraction(
|
|||||||
|
|
||||||
```python
|
```python
|
||||||
custom_kg = {
|
custom_kg = {
|
||||||
|
"chunks": [
|
||||||
|
{
|
||||||
|
"content": "Alice and Bob are collaborating on quantum computing research.",
|
||||||
|
"source_id": "doc-1"
|
||||||
|
}
|
||||||
|
],
|
||||||
"entities": [
|
"entities": [
|
||||||
{
|
{
|
||||||
"entity_name": "CompanyA",
|
"entity_name": "Alice",
|
||||||
"entity_type": "Organization",
|
"entity_type": "person",
|
||||||
"description": "A major technology company",
|
"description": "Alice is a researcher specializing in quantum physics.",
|
||||||
"source_id": "Source1"
|
"source_id": "doc-1"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"entity_name": "ProductX",
|
"entity_name": "Bob",
|
||||||
"entity_type": "Product",
|
"entity_type": "person",
|
||||||
"description": "A popular product developed by CompanyA",
|
"description": "Bob is a mathematician.",
|
||||||
"source_id": "Source1"
|
"source_id": "doc-1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"entity_name": "Quantum Computing",
|
||||||
|
"entity_type": "technology",
|
||||||
|
"description": "Quantum computing utilizes quantum mechanical phenomena for computation.",
|
||||||
|
"source_id": "doc-1"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"relationships": [
|
"relationships": [
|
||||||
{
|
{
|
||||||
"src_id": "CompanyA",
|
"src_id": "Alice",
|
||||||
"tgt_id": "ProductX",
|
"tgt_id": "Bob",
|
||||||
"description": "CompanyA develops ProductX",
|
"description": "Alice and Bob are research partners.",
|
||||||
"keywords": "develop, produce",
|
"keywords": "collaboration research",
|
||||||
"weight": 1.0,
|
"weight": 1.0,
|
||||||
"source_id": "Source1"
|
"source_id": "doc-1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src_id": "Alice",
|
||||||
|
"tgt_id": "Quantum Computing",
|
||||||
|
"description": "Alice conducts research on quantum computing.",
|
||||||
|
"keywords": "research expertise",
|
||||||
|
"weight": 1.0,
|
||||||
|
"source_id": "doc-1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src_id": "Bob",
|
||||||
|
"tgt_id": "Quantum Computing",
|
||||||
|
"description": "Bob researches quantum computing.",
|
||||||
|
"keywords": "research application",
|
||||||
|
"weight": 1.0,
|
||||||
|
"source_id": "doc-1"
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
"chunks": [
|
|
||||||
{
|
|
||||||
"content": "ProductX, developed by CompanyA, has revolutionized the market with its cutting-edge features.",
|
|
||||||
"source_id": "Source1",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"content": "PersonA is a prominent researcher at UniversityB, focusing on artificial intelligence and machine learning.",
|
|
||||||
"source_id": "Source2",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"content": "None",
|
|
||||||
"source_id": "UNKNOWN",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rag.insert_custom_kg(custom_kg)
|
rag.insert_custom_kg(custom_kg)
|
||||||
|
Reference in New Issue
Block a user