Skip to content

[BUG] Custom edges not getting picked up #903

Description

@GioPetro

Bug Description

Graphiti_core v20.4
Passing custom entities works
Passing custom relationships (edges) does not work!

EDGE_TYPE_MAP = {
    # Primary prediction relationships (CORE BUSINESS LOGIC)
    ("DetectedItemEntity", "CanonicalItemEntity"): ["ItemMatchesCanonical"],
    ("DetectedInvoiceEntity", "CanonicalItemEntity"): ["InvoiceContextInformsCanonical"],
    ("SupplierEntity", "CanonicalItemEntity"): ["SupplierInfluencesCanonical", "SupplierSellsItem"],

    # Invoice-level context relationships
    ("InvoiceEntity", "SupplierEntity"): ["InvoiceIssuedBySupplier"],
    ("InvoiceEntity", "DetectedInvoiceEntity"): ["InvoiceMatchesDetected"],
    ("InvoiceEntity", "CanonicalItemEntity"): ["InvoiceContainsCanonicalItem"],
    ("InvoiceEntity", "DetectedItemEntity"): ["InvoiceContainsDetectedItem"],
    
    # Cross-source context relationships
    ("SupplierEntity", "DetectedInvoiceEntity"): ["SupplierMatchesDetected"],
}

<more code>

await graphiti.add_episode(
        name=episode_name,
        episode_body=episode_body,
        source=EpisodeType.json,
        source_description=f"Single entity ingestion for invoice {doc_code}",
        reference_time=datetime.now(timezone.utc),
        edge_type_map=EDGE_TYPE_MAP,
        entity_types=ENTITY_TYPES,
        edge_types=EDGE_TYPES,

    )

<more code>

await graphiti.add_triplet(
        EntityNode(uuid=invoice_entity["id"], name="InvoiceEntity", group_id=doc_code),
        edge,
        EntityNode(uuid=supplier_entity["id"], name="SupplierEntity", group_id=doc_code)
    )

I'm trying to pass these, using Gemini models, I'm even trying gemini-2.5-pro with no difference in picking it up.
I am concluding there is somethig wrong within the graphiti_core library.
The default edges, "Mentions" and "Relates_To" do have some of the attributes I mention in adding triplet facts too, like
name ="HAS_CATEGORY"
but I am not sure this is supposed to be working.

I am in desperate mode to make this work as intended. I have been trying for a good solid 3 months.
Need assistance, am I missing something??? Doubt, must be a bug

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions