glam/schemas/20251121/linkml/modules/classes/Token.yaml
kempersc 4319f38c05 Add archived slots for audience size, audience type, and capacity metrics
- Created new YAML files for audience size and audience type slots, defining their properties and annotations.
- Added archived capacity slots including cubic meters, linear meters, item count, and descriptions, with appropriate URIs and ranges.
- Introduced a template specificity slot for context-aware RAG filtering.
- Consolidated capacity-related slots into a unified structure, including has_or_had_capacity, capacity_type, and capacity_value, with detailed descriptions and examples.
2026-01-17 18:53:23 +01:00

144 lines
4.6 KiB
YAML

# Token - Token/unit count class
# Updated: 2026-01-17 per Rule 53/56 migration for cached_token
#
# Uses has_or_had_type with TokenType range instead of simple attribute.
id: https://nde.nl/ontology/hc/class/Token
name: token_class
title: Token Class
version: 1.1.0
prefixes:
linkml: https://w3id.org/linkml/
hc: https://nde.nl/ontology/hc/
schema: http://schema.org/
imports:
- linkml:types
- ../slots/has_or_had_identifier
- ../slots/has_or_had_label
- ../slots/has_or_had_description
- ../slots/has_or_had_type
- ../slots/has_or_had_quantity
- ./TokenType
- ./Quantity
default_prefix: hc
classes:
Token:
class_uri: schema:QuantitativeValue
description: |
Token count representation for LLM API usage tracking.
**Key Fields**:
| Field | Description | Example |
|-------|-------------|---------|
| has_or_had_type | Type of token | CachedTokenType |
| has_or_had_quantity | Count value | 50 (cached tokens) |
**Schema.org Alignment**:
Maps to `schema:QuantitativeValue` for numeric values with context.
**Use Cases**:
1. **Cached tokens**: Prompt tokens served from cache (reduced cost)
2. **Reasoning tokens**: Chain-of-thought tokens (GLM 4.7, o1)
3. **Input/Output tokens**: Standard prompt/completion counts
**Migration History**:
- v1.0.0: Simple class with token_type attribute
- v1.1.0: Updated to use has_or_had_type → TokenType per Rule 53/56
**Example (Cached Tokens)**:
```yaml
Token:
has_or_had_type:
has_or_had_identifier: hc:TokenType/CACHED
has_or_had_label: Cached Token
has_or_had_quantity:
quantity_value: 50
has_or_had_description: Tokens from provider cache
```
exact_mappings:
- schema:QuantitativeValue
slots:
- has_or_had_identifier
- has_or_had_label
- has_or_had_description
- has_or_had_type
- has_or_had_quantity
slot_usage:
has_or_had_identifier:
range: uriorcurie
required: false
examples:
- value: https://nde.nl/ontology/hc/token/llm-response-001-cached
description: Token count instance identifier
has_or_had_type:
range: TokenType
required: false
inlined: true
description: |
The type of token (INPUT, OUTPUT, CACHED, REASONING, TOTAL).
References TokenType taxonomy.
examples:
- value:
has_or_had_identifier: hc:TokenType/CACHED
has_or_had_label: Cached Token
description: Cached token type
- value:
has_or_had_identifier: hc:TokenType/REASONING
has_or_had_label: Reasoning Token
description: Reasoning/thinking token type
has_or_had_quantity:
range: Quantity
required: false
inlined: true
description: |
The numeric token count with optional metadata.
For simple use cases, prefer quantity_value directly.
examples:
- value:
quantity_value: 50
has_or_had_description: Tokens served from cache
description: Cached token count
has_or_had_label:
range: string
required: false
examples:
- value: Cached tokens for context window
has_or_had_description:
range: string
required: false
examples:
- value: 50 prompt tokens served from provider KV cache
comments:
- Token models LLM token counts with type and quantity
- Updated per Rule 53/56 to use has_or_had_type → TokenType
- Replaces simple token_type string attribute
see_also:
- https://platform.openai.com/docs/api-reference/chat/object#usage
- https://docs.z.ai/guides/capabilities/thinking-mode
examples:
- value:
has_or_had_identifier: https://nde.nl/ontology/hc/token/example-cached-001
has_or_had_type:
has_or_had_identifier: hc:TokenType/CACHED
has_or_had_label: Cached Token
has_or_had_quantity:
quantity_value: 50
has_or_had_description: Prompt tokens from cache
has_or_had_description: 50 cached tokens reducing API cost
description: Cached token count with full metadata
- value:
has_or_had_type:
has_or_had_identifier: hc:TokenType/REASONING
has_or_had_label: Reasoning Token
has_or_had_quantity:
quantity_value: 1250
description: Reasoning tokens from GLM 4.7 thinking mode