glam/schemas/20251121/linkml/modules/classes/Token.yaml
kempersc ca4a54181e Refactor schema files to improve clarity and maintainability
- Updated WorldCatIdentifier.yaml to remove unnecessary description and ensure consistent formatting.
- Enhanced WorldHeritageSite.yaml by breaking long description into multiple lines for better readability and removed unused attributes.
- Simplified WritingSystem.yaml by removing redundant attributes and ensuring consistent formatting.
- Cleaned up XPathScore.yaml by removing unnecessary attributes and ensuring consistent formatting.
- Improved YoutubeChannel.yaml by breaking long description into multiple lines for better readability.
- Enhanced YoutubeEnrichment.yaml by breaking long description into multiple lines for better readability.
- Updated YoutubeVideo.yaml to break long description into multiple lines and removed legacy field name.
- Refined has_or_had_affiliation.yaml by removing unnecessary comments and ensuring clarity.
- Cleaned up is_or_was_retrieved_at.yaml by removing unnecessary comments and ensuring clarity.
- Added rules for generic slots and avoiding rough edits in schema files to maintain structural integrity.
- Introduced changes_or_changed_through.yaml to define a new slot for linking entities to change events.
2026-01-31 00:46:23 +01:00

97 lines
3.9 KiB
YAML

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/
dcterms: http://purl.org/dc/terms/
prov: http://www.w3.org/ns/prov#
crm: http://www.cidoc-crm.org/cidoc-crm/
skos: http://www.w3.org/2004/02/skos/core#
rdfs: http://www.w3.org/2000/01/rdf-schema#
org: http://www.w3.org/ns/org#
xsd: http://www.w3.org/2001/XMLSchema#
imports:
- linkml:types
- ../slots/has_or_had_description
- ../slots/has_or_had_identifier
- ../slots/has_or_had_label
- ../slots/has_or_had_quantity
- ../slots/has_or_had_type
- ./Quantity
- ./TokenType
default_prefix: hc
classes:
Token:
class_uri: schema:QuantitativeValue
description: "Token count representation for LLM API usage tracking.\n\n**Key Fields**:\n\n| Field | Description | Example |\n|-------|-------------|---------|\n| has_or_had_type | Type of token | CachedToken |\n| has_or_had_quantity | Count value | 50 (cached tokens) |\n\n**Schema.org Alignment**:\n\nMaps to `schema:QuantitativeValue` for numeric values with context.\n\n**Use Cases**:\n\n1. **Cached tokens**: Prompt tokens served from cache (reduced cost)\n2. **Reasoning tokens**: Chain-of-thought tokens (GLM 4.7, o1)\n3. **Input/Output tokens**: Standard prompt/completion counts\n\n**Migration History**:\n\n- v1.0.0: Simple class with token_type attribute\n- v1.1.0: Updated to use has_or_had_type \u2192 TokenType per Rule 53/56\n\n**Example (Cached Tokens)**:\n\n```yaml\nToken:\n has_or_had_type:\n has_or_had_identifier: hc:TokenType/CACHED\n has_or_had_label: Cached Token\n has_or_had_quantity:\n quantity_value: 50\n has_or_had_description: Tokens from provider cache\n\
```\n"
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
has_or_had_type:
range: uriorcurie
required: false
inlined: true
examples:
- value:
has_or_had_identifier: hc:TokenType/CACHED
has_or_had_label: Cached Token
- value:
has_or_had_identifier: hc:TokenType/REASONING
has_or_had_label: Reasoning Token
has_or_had_quantity:
range: integer
required: false
inlined: true
examples:
- value:
has_or_had_description: Tokens served from cache
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 \u2192 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:
has_or_had_description: Prompt tokens from cache
has_or_had_description: 50 cached tokens reducing API cost
- value:
has_or_had_type:
has_or_had_identifier: hc:TokenType/REASONING
has_or_had_label: Reasoning Token
has_or_had_quantity:
annotations:
specificity_score: 0.1
specificity_rationale: Generic utility class/slot created during migration
custodian_types: "['*']"