Skip to main content

kgeval

PyPI Python CI License

kgeval is an evaluation framework for knowledge graphs.

It scores a graph on 29 metrics, covering duplicate entities, conformance to a graph schema, agreement with a ground truth, and whether each fact is supported by the text it was extracted from, and reports every defect with the nodes and relationships involved. Comparing the reports of two versions of a graph shows which metrics improved or regressed.

Features

  • Score a graph on 29 built-in metrics
  • Trace every finding to the nodes and relationships involved
  • Run reference-free and reference-based evaluation
  • Compare evaluation runs over time

Requirements

  • Python 3.11+
  • Neo4j 5.10+ or Aura

Installation

pip install kgeval

Usage

kgeval runs from the command line or from Python. Both read the graph from Neo4j through a read-only session, evaluate it in memory, and produce a report of scores and findings.

CLI

kgeval run

Python

import kgeval
from neo4j import GraphDatabase

with GraphDatabase.driver("<uri>", auth=("<username>", "<password>")) as driver:
    graph = kgeval.Neo4jSource(driver).load()

report = kgeval.evaluate(graph)
print(report.to_markdown())

Report

The report gives each metric a score, the share of units such as entities or facts that pass, so 100% is perfect. Each finding describes one defect and lists the IDs of the nodes and relationships involved, so you can inspect them in Neo4j:

### entity_uniqueness: 1 of 10 entities with a name failed

- 2 entities share the normalized name 'lee kuan yew': "Lee Kuan Yew" (Person), "lee kuan yew" (Person)
  - nodes: `4:9e643a2e-be5f-4bd0-8757-2f90968f1f8a:4`, `4:9e643a2e-be5f-4bd0-8757-2f90968f1f8a:9`

Metrics

kgeval has 29 metrics in five categories: intrinsic, schema, reference, judged, and retrieval. The metrics that need only the graph run by default, and the others run when you provide their input, such as a schema or ground truth:

Input Evaluates
Graph only Uniqueness, connectivity, naming, provenance, consistency, and coverage
Graph schema Conformance and completeness
Ground truth Graph precision, recall, and F1
Test questions Answerability
Retrievals Retriever precision and recall
LLM judge Accuracy, resolution, disambiguation, and extraction completeness

See the metrics guide for the full list.

Documentation

For the full guide, see the documentation. For a complete walkthrough, see the example notebook.

Metadata

Release files for kgeval 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kgeval 0.1.1
File Size Uploaded Provenance Actions
kgeval-0.1.1.tar.gz 78.7 kB With provenance Details for kgeval-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for kgeval 0.1.1
File Interpreter ABI Platform Actions
kgeval-0.1.1-py3-none-any.whl Python 3 none any Details for kgeval-0.1.1-py3-none-any.whl

Total release size: 186.1 kB

Release files / kgeval-0.1.1.tar.gz

Download URL kgeval-0.1.1.tar.gz
Size 78.7 kB
Tags Source
SHA-256 checksum
How to use checksums
f5d1875c55c682d1d7ef1f2ee392e8d403ac896ebe8449e817addf23a2cedcf6
BLAKE2b-256 checksum
How to use checksums
5543ddfac2f816abbd0573c2e0b85f66bd42998a7890e6c8eb0d56ab28e08f05
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

Release files / kgeval-0.1.1-py3-none-any.whl

Download URL kgeval-0.1.1-py3-none-any.whl
Size 107.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
61699f5d13b456b35e6ccdfc0f2bd500f807a06a82656ae251f1a486930c7896
BLAKE2b-256 checksum
How to use checksums
e9b434f3583b7e48a05707a0cb87cec07ff217c0beaf63663e6c94679a92cca1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

Security for kgeval 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for kgeval-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page