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

# Set up Auto-Explain in Java

> How to add the Auto-Explain Spring Boot starter to an Atoti Java project, verify it in the Atoti UI, and configure it in `application.yaml`.

> [!NOTE]
>
> ### Atoti Intelligence Essentials
>
> This is part of the Atoti Intelligence Essentials offer.

This guide explains how to add Auto-Explain to an Atoti Java project.

> [!NOTE]
>
> Auto-Explain does not require an LLM to function. The root-cause analysis, contribution percentages, and contribution tables are produced by a deterministic algorithm and are always available without any AI provider configured.
>
> An LLM is only required if the optional AI summary is needed. To enable AI summaries, configure an LLM provider after completing this setup. See [Set up an LLM](https://docs.activeviam.com/atoti-intelligence/6.2/developer-guide/enable-ai-tools/configure-and-start/set-up-an-llm.md) for instructions.

## Prerequisites

Before setting up Auto-Explain, ensure the following requirements are met:

* A Java project
* A license with the AI flag enabled
* Maven or Gradle build system

## Add the dependency

Add the Auto-Explain Spring Boot starter to the project.

Add the following to `pom.xml`:

```xml theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
<dependency>
  <groupId>com.activeviam.springboot</groupId>
  <artifactId>starter-ai-autoexplain</artifactId>
  <version>${atoti-server.version}</version>
</dependency>
```

## Verify the setup

After adding the dependency, verify that Auto-Explain is available:

1. Build the project.
2. Start the Atoti application.
3. Open the Atoti UI.
4. Right-click two cells in a pivot table.
5. Check that the Auto-Explain option appears in the context menu.

## Configure Auto-Explain

Add Auto-Explain configuration to the application configuration file. The configuration block is
per-cube and can be repeated to configure multiple cubes.

The following example shows all available configuration options in `application.yaml`:

```yaml theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
atoti:
  ai:
    autoexplain:
      cube-configs:
        - cube-name: Cube
          auto-explain-configuration:
            excluded-hierarchies:
              - dimension-name: Time
                hierarchy-name: TimeBucket
        - cube-name: cube-name
          auto-explain-configuration:
            measure-naming-config:
              parent: "Cube__PARENT"
              sibling: "Cube__SIBLING"
              marginal: "Cube__MARGINAL"
              absolute-contribution: "Cube__ABSOLUTE_CONTRIBUTION"
              relative-contribution: "Cube__RELATIVE_CONTRIBUTION"
            excluded-hierarchies:
              - hierarchy-name: hierarchyName1
                dimension-name: dimensionName1
              - hierarchy-name: hierarchyName2
                dimension-name: dimensionName2
            excluded-measure-hierarchies:
              "[measureName1]":
                - hierarchy-name: hierarchyName3
                  dimension-name: dimensionName3
            included-hierarchies:
              - hierarchy-name: hierarchyName4
                dimension-name: dimensionName4
            included-measure-hierarchies:
              "[measureName1]":
                - hierarchy-name: hierarchyName5
                  dimension-name: dimensionName5
            constants-config:
              max-depth: 15
              max-distinct-hierarchies: 10
              max-entropy: 0.4
              min-percentage-absolute-contribution: 1
              min-percentage-relative-contribution: 10
              min-variation-threshold: 0.000001
              include-opposite-contributors: false
              max-members-per-level: -1
```

The following table describes the top-level `application.yaml` keys:

| Parameter name | Description |
| - | - |
| `cube-name` | Name of the cube to configure Auto-Explain for. |
| `auto-explain-configuration` | Configuration of the parameters of Auto-Explain. |
| `auto-explain-configuration.measure-naming-config` | Lists the measures computed by Auto-Explain and their default names. Default names are shown in the configuration example above. Specify only the measures whose names need to change. |

The `excluded-hierarchies`, `included-hierarchies`, and their per-measure variants control which
hierarchies Auto-Explain analyzes; these apply to both SDKs and are documented in
[Hierarchy inclusion and exclusion](https://docs.activeviam.com/atoti-intelligence/6.2/developer-guide/enable-ai-tools/auto-explain/configuration.md#hierarchy-inclusion-and-exclusion). In the
per-measure variants, write each measure name in quoted brackets, as in the example, so that a
name such as `pnl.SUM` is read as a single key. The
`constants-config` block controls how the algorithm explores the cube; see
[Configure Auto-Explain](https://docs.activeviam.com/atoti-intelligence/6.2/developer-guide/enable-ai-tools/auto-explain/configuration.md#how-to-tune-the-constants) for the constants and tuning guidance.

## Related reading

After setting up Auto-Explain, proceed to:

* [How Auto-Explain works](https://docs.activeviam.com/atoti-intelligence/6.2/developer-guide/enable-ai-tools/auto-explain/how-it-works.md)
* [Configure Auto-Explain](https://docs.activeviam.com/atoti-intelligence/6.2/developer-guide/enable-ai-tools/auto-explain/configuration.md) to tune the analysis
* [Learn how to use Auto-Explain](https://docs.activeviam.com/atoti-intelligence/6.2/user-guide/auto-explain.md) in the Atoti UI
