chunk.Metric

A named metric value associated with a retrieved chunk.

Usage

Source

chunk.Metric(
    name,
    value,
)

Metrics are used to store retrieval scores and other measurements that describe how well a chunk matches a query.

Parameters

name: str

The name of the metric (e.g., “similarity”, “bm25_score”).

value: float
The numeric value of the metric.

Examples

from raghilda.chunk import Metric

similarity = Metric(name="similarity", value=0.95)
print(f"{similarity.name}: {similarity.value}")
2026-09-02 15:09:36.807941197 [W:onnxruntime:Default, device_discovery.cc:146 GetPciBusId] Skipping pci_bus_id for PCI path at "/sys/devices/LNXSYSTM:00/LNXSYBUS:00/ACPI0004:00/MSFT1000:00/5620e0c7-8062-4dce-aeb7-520c7ef76171" because filename "5620e0c7-8062-4dce-aeb7-520c7ef76171" did not match expected pattern of [0-9a-f]+:[0-9a-f]+:[0-9a-f]+[.][0-9a-f]+
similarity: 0.95