Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ node_modules/
.cache
.docusaurus/
tmp/
.DS_Store

# Build
dist/
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ For a roadmap including expected timeline, please refer to [ROADMAP.md](./ROADMA

### Added

- Added `@Consumption.AIHint` annotation for AI consumption hints
- Provides a hint for AI consumers (e.g., LLMs) on how to use or interpret an Entity, Type, or Service — kept separate from human-readable `@EndUserText` descriptions
- For JSON based metadata formats, the corresponding property is `x-sap-ai-hint`
- Added `@PersonalData.relatedDataCategoryID` annotation
- Added `IS_BLOCKED_INDICATOR` as enum value to `@PersonalData.fieldSemantics`
- Added `DATA_CATEGORY_ID` as enum value to `@PersonalData.fieldSemantics`
Expand Down
34 changes: 23 additions & 11 deletions spec-toolkit.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,18 @@
"toc_max_heading_level": "4"
}
},
{
"type": "specExtension",
"id": "ai",
"sourceFilePath": "./spec/v1/annotations/ai.yaml",
"sourceIntroFilePath": "./spec/v1/annotations/ai.md",
"targetDocumentId": "csn-interop-effective",
"mdFrontmatter": {
"title": "@AI",
"sidebar_position": "2",
"description": "@AI annotations for AI consumption hints."
}
},
{
"type": "specExtension",
"id": "aggregation",
Expand All @@ -33,7 +45,7 @@
"targetDocumentId": "csn-interop-effective",
"mdFrontmatter": {
"title": "@Aggregation",
"sidebar_position": "2",
"sidebar_position": "3",
"description": "@Aggregation annotations."
}
},
Expand All @@ -45,7 +57,7 @@
"targetDocumentId": "csn-interop-effective",
"mdFrontmatter": {
"title": "@AnalyticsDetails",
"sidebar_position": "3",
"sidebar_position": "4",
"description": "@AnalyticsDetails for data analytics use cases."
}
},
Expand All @@ -57,7 +69,7 @@
"targetDocumentId": "csn-interop-effective",
"mdFrontmatter": {
"title": "@API",
"sidebar_position": "4",
"sidebar_position": "5",
"description": "@API for release state definition inside APIs."
}
},
Expand All @@ -69,7 +81,7 @@
"targetDocumentId": "csn-interop-effective",
"mdFrontmatter": {
"title": "@Consumption",
"sidebar_position": "5",
"sidebar_position": "6",
"description": "@Consumption annotations."
}
},
Expand All @@ -81,7 +93,7 @@
"targetDocumentId": "csn-interop-effective",
"mdFrontmatter": {
"title": "@DataIntegration",
"sidebar_position": "6",
"sidebar_position": "7",
"description": "@DataIntegration annotations for data integration scenarios."
}
},
Expand All @@ -93,7 +105,7 @@
"targetDocumentId": "csn-interop-effective",
"mdFrontmatter": {
"title": "@EndUserText",
"sidebar_position": "7",
"sidebar_position": "8",
"description": "@EndUserText annotations for end user UIs."
}
},
Expand All @@ -106,7 +118,7 @@
"targetDocumentId": "csn-interop-effective",
"mdFrontmatter": {
"title": "@EntityRelationship",
"sidebar_position": "8",
"sidebar_position": "9",
"description": "@EntityRelationship annotations for cross boundary Entity-Relationship IDs and associations."
}
},
Expand All @@ -118,7 +130,7 @@
"targetDocumentId": "csn-interop-effective",
"mdFrontmatter": {
"title": "@ObjectModel",
"sidebar_position": "9",
"sidebar_position": "10",
"description": "@ObjectModel annotations."
}
},
Expand All @@ -130,7 +142,7 @@
"targetDocumentId": "csn-interop-effective",
"mdFrontmatter": {
"title": "@ODM",
"sidebar_position": "10",
"sidebar_position": "11",
"description": "@ODM for One Domain Model (ODM) related annotations."
}
},
Expand All @@ -142,7 +154,7 @@
"targetDocumentId": "csn-interop-effective",
"mdFrontmatter": {
"title": "@PersonalData",
"sidebar_position": "11",
"sidebar_position": "12",
"description": "@PersonalData to annotate DPP relevant information."
}
},
Expand All @@ -154,7 +166,7 @@
"targetDocumentId": "csn-interop-effective",
"mdFrontmatter": {
"title": "@Semantics",
"sidebar_position": "12",
"sidebar_position": "13",
"description": "@Semantics annotations."
}
}
Expand Down
64 changes: 64 additions & 0 deletions spec/v1/annotations/ai.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
## Introduction

The `@Consumption.AIHint` annotation provides AI-specific guidance targeted for AI consumers, such as large language models (LLMs) processing or reasoning over the data model.

This allows model owners to provide AI-specific context separately from human-readable descriptions (e.g., [`@EndUserText`](./end-user-text)), enabling richer and more accurate AI consumption of the data model without polluting end-user-facing labels or documentation.

## Annotations Overview

| Annotation | Targets | Description |
| ----------------------- | --------------------- | -------------------------------------------------------------------------------- |
| `@Consumption.AIHint` | Entity, Type, Service | Free-text hint for AI consumers on how to use or interpret the annotated element |

## `@Consumption.AIHint`

**Targets:** Entity, Type, Service (and their elements/properties, since a Type target implies its elements)

`@Consumption.AIHint` is a string annotation that provides guidance for AI consumers (e.g., LLMs or AI agents) on how to use or interpret the annotated element. It is intentionally kept separate from human-readable descriptions (e.g., `@EndUserText`) so that end-user-facing documentation and AI-targeted guidance can evolve independently.

The annotation value is intended for AI consumption only and MUST NOT be displayed to end users. It MUST be filtered when publishing metadata externally (e.g., to the SAP API Business Hub public catalog).

For JSON-based metadata formats, the corresponding property is [`x-sap-ai-hint`](https://github.tools.sap/CPA/sap-json-schema-specification/blob/main/extension-attributes/x-sap-ai-hint.md).

### Usage

```cds
entity SalesOrder : managed {
@Consumption.AIHint: 'Use this entity to retrieve sales order header data. Filter by CustomerID and CreatedAt for typical lookups. For line items, use the SalesOrderItem entity.'
key ID : UUID;
CustomerID : String(10);
@Consumption.AIHint: 'ISO 4217 three-letter currency code (e.g. USD, EUR). Never a symbol.'
TransactionCurrency : String(5);
@Consumption.AIHint: 'Integer status code: 1=Open, 2=InProcess, 3=Completed, 4=Cancelled. Do not infer status from other fields.'
LifecycleStatus : Integer;
}

service SalesService {
@Consumption.AIHint: 'Exposes sales order read and write operations. Use GET operations for lookups and reporting. Creating or modifying orders requires the SalesOrder.Write scope.'
entity SalesOrders as projection on SalesOrder;
}
```

### Best practices

Unlike human-readable descriptions, `@Consumption.AIHint` can be explicit about data semantics and usage context that would clutter `@EndUserText` annotations. Focus on what an AI agent needs to decide _whether_ and _how_ to use the entity, type, or service.

Some useful things to include, depending on the target:

- **Entity/Type level**
- **Business context** — what business concept or domain object this entity represents
- **When to use vs. similar entities** — if multiple entities cover overlapping domains, state which is authoritative and under what conditions
- **Disambiguation** — when an entity or property name is misleading or overlaps with something similar
- **Format and value constraints** — coding standards (ISO, internal enums, picklists), what values are valid, how to interpret coded fields
- **Navigation and relationships** — how to traverse to related entities for common lookup patterns

- **Service level**
- **Scope and capabilities** — what business activities the service covers and which operations are available
- **Authorization** — required scopes or roles needed to read vs. write
- **When NOT to use** — if another service is preferred for a specific use case, state this explicitly to help agents route correctly

Structure `@Consumption.AIHint` values using **lightweight, semantically structured Markdown**:

- **Use consistent labels** — e.g., **Format:**, **When NOT to use:** — so AI systems can extract meaning beyond visual formatting.
- **Keep content atomic** — one idea per bullet or line; avoid long prose paragraphs.
- **Lightweight Markdown only** — bullets, bold labels, `inline code` for field names and identifiers. Avoid tables and deep nesting.
34 changes: 34 additions & 0 deletions spec/v1/annotations/ai.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
$schema: "http://json-schema.org/draft-07/schema#"
$id: "https://sap.github.io/csn-interop-specification/spec-v1/ai.schema.json#"
title: Consumption.AIHint Document
description: This is the interface description of @Consumption.AIHint.
type: object
definitions:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just dropping a few additional thoughts on AI-related “hints” that could be useful to consider:

  • @AI.intent → short “when to use” (task framing)
  • @AI.recoveryHints → runtime guidance for expected error scenarios (e.g., when → do )
  • @AI.preconditions → required states / data
  • @AI.postconditions → what changes in the system
  • @AI.sideEffects → explicit side effects (external actions, observable state changes beyond outcome..)
  • @AI.idempotency → behavior + retry semantics (safe, conditional, unsafe, etc.)

I prefer starting light, but could help make the overall model a bit more expressive and useful for agents.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good ideas / suggestions! The first two would fit well into the @ai. scope, the other ones feel like they're more general, so I would expect them more like in an @API.* scope?

"@Consumption.AIHint":
type: string
description: |-
Provides a hint for AI consumers (e.g., LLMs) on how to use or interpret the annotation target.

This allows keeping human-readable descriptions (e.g., `@EndUserText`) separate from
descriptions and hints targeted specifically for AI consumers.
examples:
- "Use this entity to look up current inventory levels by product and warehouse."
- "This field contains the ISO 4217 currency code, not a currency symbol."
x-extension-targets:
- Entity
- Type
- Service

examples:
- {
"csnInteropEffective": "1.2",
"$version": "2.0",
"definitions":
{
"SalesOrder":
{
"kind": "entity",
"@Consumption.AIHint": "Use this entity to retrieve sales order header data. Filter by CustomerID and CreatedAt for typical lookups.",
},
},
}
Loading