Metadata-Version: 2.4
Name: kgeval
Version: 0.1.0
Summary: An evaluation framework for knowledge graphs.
License-Expression: Apache-2.0
License-File: LICENSE
Keywords: knowledge-graph,neo4j,evaluation,graphrag,rag,retrieval,data-quality,llm-as-a-judge
Author: iamzices
Author-email: hello@zices.com
Requires-Python: >=3.11
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Database
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Quality Assurance
Classifier: Typing :: Typed
Requires-Dist: neo4j (>=5.0)
Requires-Dist: openai (>=1.92)
Requires-Dist: pydantic (>=2.10)
Requires-Dist: pyyaml (>=6.0)
Requires-Dist: rich (>=13)
Requires-Dist: typer (>=0.15.4)
Project-URL: Documentation, https://kgeval.github.io/kgeval/
Project-URL: Issues, https://github.com/kgeval/kgeval/issues
Project-URL: Repository, https://github.com/kgeval/kgeval
Description-Content-Type: text/markdown

# kgeval

[![PyPI](https://img.shields.io/pypi/v/kgeval)](https://pypi.org/project/kgeval/)
[![Python](https://img.shields.io/pypi/pyversions/kgeval)](https://pypi.org/project/kgeval/)
[![CI](https://github.com/kgeval/kgeval/actions/workflows/ci.yml/badge.svg)](https://github.com/kgeval/kgeval/actions/workflows/ci.yml)
[![License](https://img.shields.io/github/license/kgeval/kgeval)](https://github.com/kgeval/kgeval/blob/main/LICENSE)

kgeval is an evaluation framework for knowledge graphs.

## 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

```console
pip install kgeval
```

## Usage

### CLI

```console
kgeval run
```

### Python

```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())
```

## Metrics

| 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](https://kgeval.github.io/kgeval/guide/metrics/) for the full list.

## Documentation

For the full guide, see the [documentation](https://kgeval.github.io/kgeval/). For a
complete walkthrough, see the [example notebook](https://github.com/kgeval/kgeval/blob/main/examples/singapore/evaluate.ipynb).

