---
title: Agent metadata in metric views
description: Learn how to use semantic metadata in metric views to enhance data visualization and improve LLM accuracy.
canonical_url: https://docs.databricks.com/aws/en/uc-semantics/agent-metadata
---

# Agent metadata in metric views

Agent metadata (also known as semantic metadata) enhances data visualization and improves large language model (LLM) accuracy by providing display names, format specifications, and synonyms that give business context to your metrics. This metadata helps visualization tools and natural language tools like [Genie Agents](https://docs.databricks.com/aws/en/genie-agents/index.md) interpret and work with your data more effectively.

> [!NOTE]
>
> Requires Databricks Runtime 17.3 and YAML version 1.1. See [version requirements](https://docs.databricks.com/aws/en/uc-semantics/metric-views/feature-availability.md#versions).

## <a id="what-is-semantic-metadata" />What is agent metadata?

Agent metadata includes display names, format specifications, and synonyms that provide additional context. This metadata helps visualization tools, such as AI/BI dashboards, and natural language tools, such as [Genie Agents](https://docs.databricks.com/aws/en/genie-agents/index.md), interpret and work with your data more effectively. Agent metadata is defined in the metric view YAML definition.

> [!NOTE]
>
> When you create or alter metric views with specification version 1.1, any single-line comments (denoted with `#`) in the YAML definition are removed when the definition is saved. See [Upgrade to YAML 1.1](https://docs.databricks.com/aws/en/uc-semantics/metric-views/yaml-reference.md#upgrade-yaml) for options and recommendations when upgrading existing YAML definitions.

The examples on this page use the TPC-H sample dataset (`samples.tpch.orders`), which is available by default in [Unity Catalog datasets](https://docs.databricks.com/aws/en/discover/databricks-datasets.md#uc-datasets). The TPC-H dataset models a wholesale supply chain with tables for orders, customers, suppliers, and parts. Column names in the `orders` table use the `o_` prefix (for example, `o_orderdate` for order date, `o_totalprice` for total price). For details about the TPC-H schema and data model, see [Tutorial: build a metric view with joins and data modeling](https://docs.databricks.com/aws/en/uc-semantics/metric-views/tpch-example.md).

## <a id="display-names" />Display names

Display names provide human-readable labels that appear in visualization tools instead of technical column names. Display names are limited to 255 characters.

The following example shows display names defined on the `order_date` field (tracking when orders were placed) and `total_revenue` measure (calculating the sum of all order prices).

```yaml
version: 1.1
source: samples.tpch.orders

fields:
  - name: order_date
    expr: o_orderdate
    display_name: 'Order Date'

measures:
  - name: total_revenue
    expr: SUM(o_totalprice)
    display_name: 'Total Revenue'
```

## <a id="synonyms" />Synonyms

Synonyms help LLM tools, such as [Genie](https://docs.databricks.com/aws/en/genie-agents/index.md), discover fields (also called dimensions) and measures through user input by providing alternative names. You can define synonyms using either block style or flow style YAML. Each field or measure can have up to 10 synonyms. Each synonym is limited to 255 characters.

The following example shows synonyms defined on the `order_date` field (when orders were placed) and `total_revenue` measure (sum of all order prices). The synonyms allow users to ask questions using natural language such as "show me revenue by order time" or "what are total sales by date of order":

```yaml
version: 1.1
source: samples.tpch.orders

fields:
  - name: order_date
    expr: o_orderdate
    # block style
    synonyms:
      - 'order time'
      - 'date of order'

measures:
  - name: total_revenue
    expr: SUM(o_totalprice)
    # flow style
    synonyms: ['revenue', 'total sales']
```

## <a id="format-specifications" />Format specifications

Format specifications define how values should be displayed in visualization tools. The following tables include supported format types and examples.

### <a id="numeric-formats" />Numeric formats

| Format Type                                                                                                                  | Required Options   | Optional Options                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| ---------------------------------------------------------------------------------------------------------------------------- | ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Number**: Use plain number format for general numeric values with optional decimal place control and abbreviation options. | `type: number`     | <ul><li>`decimal_places`: Controls the number of places shown after the decimal.<br /><ul><li>`type`: (Required if `decimal_places` is specified)<br /><ul><li>`max`</li><li>`exact`</li><li>`all`</li></ul></li><li>`places`: Integer value from 0-10 (required if type is `max` or `exact`)</li></ul></li><li>`hide_group_separator`: When set to true, removes any applicable number grouping separator, such as a `,`.<br /><ul><li>`true`</li><li>`false`</li></ul></li><li>`abbreviation`:<br /><ul><li>`none`</li><li>`compact`</li><li>`scientific`</li></ul></li></ul>                                                                                                              |
| **Currency**: Use currency format for monetary values with ISO-4217 currency codes.                                          | `type: currency`   | <ul><li>`currency_code`: ISO-4217 code (required). For example, the following codes insert the symbol for US dollars, Euros, and Yen, respectively.<br /><ul><li>`USD`</li><li>`EUR`</li><li>`JPY`</li></ul></li><li>`decimal_places`: Controls the number of places shown after the decimal.<br /><ul><li>`type`: (Required if `decimal_places` is specified)<br /><ul><li>`max`</li><li>`exact`</li><li>`all`</li></ul></li></ul></li><li>`hide_group_separator`: When set to true, removes any applicable number grouping separator.<br /><ul><li>`true`</li><li>`false`</li></ul></li><li>`abbreviation`:<br /><ul><li>`none`</li><li>`compact`</li><li>`scientific`</li></ul></li></ul> |
| **Percentage**: Use percentage format for ratio values expressed as percentages.                                             | `type: percentage` | <ul><li>`decimal_places`: Controls the number of places shown after the decimal.<br /><ul><li>`type`: (Required if `decimal_places` is specified)<br /><ul><li>`max`</li><li>`exact`</li><li>`all`</li></ul></li></ul></li><li>`hide_group_separator`: When set to true, removes any applicable number grouping separator.<br /><ul><li>`true`</li><li>`false`</li></ul></li></ul>                                                                                                                                                                                                                                                                                                           |
| **Byte**: Use byte format for data size values displayed with appropriate byte units (KB, MB, GB, etc.).                     | `type: byte`       | <ul><li>`decimal_places`: Controls the number of places shown after the decimal.<br /><ul><li>`type`: (Required if `decimal_places` is specified)<br /><ul><li>`max`</li><li>`exact`</li><li>`all`</li></ul></li><li>`places`: Integer value from 0-10 (required if type is `max` or `exact`)</li></ul></li><li>`hide_group_separator`: When set to true, removes any applicable number grouping separator.<br /><ul><li>`true`</li><li>`false`</li></ul></li></ul>                                                                                                                                                                                                                          |

### <a id="numeric-formatting-examples" />Numeric formatting examples

#### Number

```yaml
format:
  type: number
  decimal_places:
    type: max
    places: 2
  hide_group_separator: false
  abbreviation: compact
```

#### Currency

```yaml
format:
  type: currency
  currency_code: USD
  decimal_places:
    type: exact
    places: 2
  hide_group_separator: false
  abbreviation: compact
```

#### Percentage

```yaml
format:
  type: percentage
  decimal_places:
    type: all
  hide_group_separator: true
```

#### Byte

```yaml
format:
  type: byte
  decimal_places:
    type: max
    places: 2
  hide_group_separator: false
```

### <a id="date-time-formats" />Date and time formats

The following table explains how to work with date and time formats.

| Format Type                                                                     | Required Options                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | Optional Options                                                                                                                              |
| ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------- |
| **Date**: Use date format for date values with various display options.         | <ul><li>`type: date`</li><li>`date_format`: Controls the way the date is displayed<br /><ul><li>`locale_short_month`: Displays the date with an abbreviated month</li><li>`locale_long_month`: Displays the date with the full name of the month</li><li>`year_month_day`: Formats the date as YYYY-MM-DD</li><li>`locale_number_month`: Displays the date with a month as a number</li><li>`year_week`: Formats the date as a year and a week number. For example, `2025-W1`</li></ul></li></ul>                                                                                                                                                                                                                                                      | <ul><li>`leading_zeros`: Controls whether single digit numbers are preceded by a zero</li><li>`true`</li><li>`false`</li></ul>                |
| **DateTime**: Use datetime format for timestamp values combining date and time. | <ul><li>`type: date_time`</li><li>`date_format`: Controls the way the date is displayed<br /><ul><li>`no_date`: Date is hidden</li><li>`locale_short_month`: Displays the date with an abbreviated month</li><li>`locale_long_month`: Displays the date with the full name of the month</li><li>`year_month_day`: Formats the date as YYYY-MM-DD</li><li>`locale_number_month`: Displays the date with a month as a number</li><li>`year_week`: Formats the date as a year and a week number. For example, `2025-W1`</li></ul></li><li>`time_format`:<br /><ul><li>`no_time`: Time is hidden</li><li>`locale_hour_minute`: Displays the hour and minute</li><li>`locale_hour_minute_second`: Displays the hour, minute, and second</li></ul></li></ul> | <ul><li>`leading_zeros`: Controls whether single digit numbers are preceded by a zero<br /><ul><li>`true`</li><li>`false`</li></ul></li></ul> |

> [!NOTE]
>
> When working with a `date_time` type, at least one of `date_format` or `time_format` must specify a value other than `no_date` or `no_time`.

### <a id="datetime-formatting-examples" />Datetime formatting examples

#### Date

```yaml
format:
  type: date
  date_format: year_month_day
  leading_zeros: true
```

#### DateTime

```yaml
format:
  type: date_time
  date_format: year_month_day
  time_format: locale_hour_minute_second
  leading_zeros: false
```

## Downstream tools integration

Semantic metadata automatically populates downstream tools that consume the metric view:

* **AI/BI dashboards**: Display names and format specifications are automatically populated in dashboard datasets and visualizations to improve dashboard readability.
* **Genie Agents**: Synonyms are automatically imported to help Genie better discover and understand available fields and measures from the metric view.

## <a id="complete-example" />Complete example

The following example shows a metric view definition that tracks sales performance and includes all agent metadata types. The metric view analyzes order data to calculate revenue metrics, segment customers by order value, and track order volumes.

Customer segments are defined as follows:

* Enterprise: Orders over $100,000
* Mid-market: Orders between $10,000 and $100,000
* Small and medium-sized businesses: Orders under $10,000

The metadata supports natural language queries such as "show me total sales by customer segment" or "what's the average revenue per order."

```yaml
version: 1.1
source: samples.tpch.orders
comment: Comprehensive sales metrics with enhanced semantic metadata
fields:
  - name: order_date
    expr: o_orderdate
    comment: Date when the order was placed
    display_name: Order Date
    format:
      type: date
      date_format: year_month_day
      leading_zeros: true
    synonyms:
      - order time
      - date of order
  - name: customer_segment
    expr: |
      CASE
        WHEN o_totalprice > 100000 THEN 'Enterprise'
        WHEN o_totalprice > 10000 THEN 'Mid-market'
        ELSE 'SMB'
      END
    comment: Customer classification based on order value
    display_name: Customer Segment
    synonyms:
      - segment
      - customer tier
measures:
  - name: total_revenue
    expr: SUM(o_totalprice)
    comment: Total revenue from all orders
    display_name: Total Revenue
    format:
      type: currency
      currency_code: USD
      decimal_places:
        type: exact
        places: 2
      hide_group_separator: false
      abbreviation: compact
    synonyms:
      - revenue
      - total sales
      - sales amount
  - name: order_count
    expr: COUNT(1)
    comment: Total number of orders
    display_name: Order Count
    format:
      type: number
      decimal_places:
        type: all
      hide_group_separator: true
    synonyms:
      - count
      - number of orders
  - name: avg_order_value
    expr: SUM(o_totalprice) / COUNT(1)
    comment: Average revenue per order
    display_name: Average Order Value
    format:
      type: currency
      currency_code: USD
      decimal_places:
        type: exact
        places: 2
    synonyms:
      - aov
      - average revenue
```
