> ## Documentation Index
> Fetch the complete documentation index at: https://docs.abv.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Scores Data Model

In ABV `Scores` are the data object to store evaluations. They are a flexible object that is used across all [evaluation methods](/developer/evaluations/overview) to assign evaluation scores to different objects across the ABV platform. High level you can think of Scores as the output of an evaluation method.

# Scores

`Scores` serve as objects for storing evaluation metrics in ABV. Here are its core properties:

* Scores reference a `Trace`, `Observation`, `Session`, or `DatasetRun`
* Each Score references **exactly one** of the above objects.
* Scores are either **numeric**, **categorical**, or **boolean**.
* Scores can **optionally be linked to a** `ScoreConfig` to ensure they comply with a specific schema.

```mermaid theme={null}
graph TD
    Score[Score<br/>name, value, comment]
    Trace[Trace]
    Observation[Observation]
    Session[Session]
    DatasetRun[DatasetRun]
    Config[ScoreConfig<br/>Optional]

    Score -->|references ONE of| Trace
    Score -->|references ONE of| Observation
    Score -->|references ONE of| Session
    Score -->|references ONE of| DatasetRun
    Score -.->|validated by| Config

    classDef scoreClass fill:#fff176,stroke:#f57f17,color:#000
    classDef traceClass fill:#4fc3f7,stroke:#0288d1,color:#000
    classDef obsClass fill:#ba68c8,stroke:#8e24aa,color:#000
    classDef sessionClass fill:#81c784,stroke:#388e3c,color:#000
    classDef runClass fill:#ffb74d,stroke:#f57c00,color:#000
    classDef configClass fill:#ff8a65,stroke:#e64a19,color:#000

    class Score scoreClass
    class Trace traceClass
    class Observation obsClass
    class Session sessionClass
    class DatasetRun runClass
    class Config configClass
```

**Key constraint:** Each Score must reference **exactly one** target object (Trace, Observation, Session, or DatasetRun).

## Common Use

| Level       | Description                                                                                              |
| ----------- | -------------------------------------------------------------------------------------------------------- |
| Trace       | Used for evaluation of a single interaction. (most common)                                               |
| Observation | Used for evaluation of a single observation below the trace level.                                       |
| Session     | Used for comprehensive evaluation of outputs across multiple interactions.                               |
| Dataset Run | Used for performance scores of a Dataset Run. [See Dataset Runs for context.](./dataset-runs-data-model) |

## Score object

| Attribute       | Type   | Description                                                                                                                                                                                          |
| --------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `name`          | string | Name of the score, e.g. user\_feedback, hallucination\_eval                                                                                                                                          |
| `value`         | number | Optional: Numeric value of the score. Always defined for numeric and boolean scores. Optional for categorical scores.                                                                                |
| `stringValue`   | string | Optional: String equivalent of the score's numeric value for boolean and categorical data types. Automatically set for categorical scores based on the config if the `configId` is provided.         |
| `traceId`       | string | Optional: Id of the trace the score relates to                                                                                                                                                       |
| `observationId` | string | Optional: Observation (e.g. LLM call) the score relates to                                                                                                                                           |
| `sessionId`     | string | Optional: Id of the session the score relates to                                                                                                                                                     |
| `datasetRunId`  | string | Optional: Id of the dataset run the score relates to                                                                                                                                                 |
| `comment`       | string | Optional: Evaluation comment, commonly used for user feedback, eval output or internal notes                                                                                                         |
| `id`            | string | Unique identifier of the score. Auto-generated by SDKs. Optionally can also be used as an indempotency key to update scores.                                                                         |
| `source`        | string | Automatically set based on the souce of the score. Can be either `API`, `EVAL`, or `ANNOTATION`                                                                                                      |
| `dataType`      | string | Automatically set based on the config data type when the `configId` is provided. Otherwise can be defined manually as `NUMERIC`, `CATEGORICAL` or `BOOLEAN`                                          |
| `configId`      | string | Optional: Score config id to ensure that the score follows a specific schema. Can be defined in the ABV UI or via API. When provided the score's `dataType` is automatically set based on the config |

# Score Config

Score configs are used to ensure that your scores follow a specific schema.
Using score configs allows you to standardize your scoring schema across your team and ensure that scores are consistent and comparable for future analysis.

You can define a `scoreConfig` in the ABV UI or via our API. Configs are immutable but can be archived (and restored anytime).

<img src="https://mintlify.s3.us-west-1.amazonaws.com/abv-2be93c70/images/evaluations-scores-data-model-config.png" alt="Score configuration interface" />

A score config includes:

* **Score name**
* **Data type:** `NUMERIC`, `CATEGORICAL`, `BOOLEAN`
* **Constraints on score value range** (Min/Max for numerical, Custom categories for categorical data types

## Score Config object

| Attribute     | Type    | Description                                                                                     |
| ------------- | ------- | ----------------------------------------------------------------------------------------------- |
| `id`          | string  | Unique identifier of the score config.                                                          |
| `name`        | string  | Name of the score config, e.g. user\_feedback, hallucination\_eval                              |
| `dataType`    | string  | Can be either `NUMERIC`, `CATEGORICAL` or `BOOLEAN`                                             |
| `isArchived`  | boolean | Whether the score config is archived. Defaults to false                                         |
| `minValue`    | number  | Optional: Sets minimum value for numerical scores. If not set, the minimum value defaults to -∞ |
| `maxValue`    | number  | Optional: Sets maximum value for numerical scores. If not set, the maximum value defaults to +∞ |
| `categories`  | list    | Optional: Defines categories for categorical scores. List of objects with label value pairs     |
| `description` | string  | Optional: Provides further description of the score configuration                               |
