semantic-conventions/model/gen-ai/registry.yaml

335 lines
15 KiB
YAML

groups:
- id: registry.gen_ai
type: attribute_group
display_name: GenAI Attributes
brief: >
This document defines the attributes used to describe telemetry in the context of Generative Artificial Intelligence (GenAI) Models requests and responses.
attributes:
- id: gen_ai.provider.name
stability: development
type:
members:
- id: openai
stability: development
value: "openai"
brief: '[OpenAI](https://openai.com/)'
- id: gcp.gen_ai
stability: development
value: "gcp.gen_ai"
brief: "Any Google generative AI endpoint"
note: >
May be used when specific backend is unknown.
- id: gcp.vertex_ai
stability: development
value: "gcp.vertex_ai"
brief: "[Vertex AI](https://cloud.google.com/vertex-ai)"
note: >
Used when accessing the 'aiplatform.googleapis.com' endpoint.
- id: gcp.gemini
stability: development
value: "gcp.gemini"
brief: '[Gemini](https://cloud.google.com/products/gemini)'
note: >
Used when accessing the 'generativelanguage.googleapis.com' endpoint.
Also known as the AI Studio API.
- id: anthropic
stability: development
value: "anthropic"
brief: '[Anthropic](https://www.anthropic.com/)'
- id: cohere
stability: development
value: "cohere"
brief: '[Cohere](https://cohere.com/)'
- id: azure.ai.inference
stability: development
value: "azure.ai.inference"
brief: 'Azure AI Inference'
- id: azure.ai.openai
stability: development
value: "azure.ai.openai"
brief: '[Azure OpenAI](https://azure.microsoft.com/products/ai-services/openai-service/)'
- id: ibm.watsonx.ai
stability: development
value: "ibm.watsonx.ai"
brief: '[IBM Watsonx AI](https://www.ibm.com/products/watsonx-ai)'
- id: aws.bedrock
stability: development
value: "aws.bedrock"
brief: '[AWS Bedrock](https://aws.amazon.com/bedrock)'
- id: perplexity
stability: development
value: "perplexity"
brief: '[Perplexity](https://www.perplexity.ai/)'
- id: x_ai
stability: development
value: "x_ai"
brief: '[xAI](https://x.ai/)'
- id: deepseek
stability: development
value: "deepseek"
brief: '[DeepSeek](https://www.deepseek.com/)'
- id: groq
stability: development
value: "groq"
brief: '[Groq](https://groq.com/)'
- id: mistral_ai
stability: development
value: "mistral_ai"
brief: '[Mistral AI](https://mistral.ai/)'
brief: The Generative AI provider as identified by the client
or server instrumentation.
note: |
The attribute SHOULD be set based on the instrumentation's best
knowledge and may differ from the actual model provider.
Multiple providers, including Azure OpenAI, Gemini, and AI hosting platforms
are accessible using the OpenAI REST API and corresponding client libraries,
but may proxy or host models from different providers.
The `gen_ai.request.model`, `gen_ai.response.model`, and `server.address`
attributes may help identify the actual system in use.
The `gen_ai.provider.name` attribute acts as a discriminator that
identifies the GenAI telemetry format flavor specific to that provider
within GenAI semantic conventions.
It SHOULD be set consistently with provider-specific attributes and signals.
For example, GenAI spans, metrics, and events related to AWS Bedrock
should have the `gen_ai.provider.name` set to `aws.bedrock` and include
applicable `aws.bedrock.*` attributes and are not expected to include
`openai.*` attributes.
- id: gen_ai.request.model
stability: development
type: string
brief: The name of the GenAI model a request is being made to.
examples: 'gpt-4'
- id: gen_ai.request.max_tokens
stability: development
type: int
brief: The maximum number of tokens the model generates for a request.
examples: [100]
- id: gen_ai.request.choice.count
stability: development
type: int
brief: The target number of candidate completions to return.
examples: [3]
- id: gen_ai.request.temperature
stability: development
type: double
brief: The temperature setting for the GenAI request.
examples: [0.0]
- id: gen_ai.request.top_p
stability: development
type: double
brief: The top_p sampling setting for the GenAI request.
examples: [1.0]
- id: gen_ai.request.top_k
stability: development
type: double
brief: The top_k sampling setting for the GenAI request.
examples: [1.0]
- id: gen_ai.request.stop_sequences
stability: development
type: string[]
brief: List of sequences that the model will use to stop generating further tokens.
examples:
- [forest, lived]
- id: gen_ai.request.frequency_penalty
stability: development
type: double
brief: The frequency penalty setting for the GenAI request.
examples: [0.1]
- id: gen_ai.request.presence_penalty
stability: development
type: double
brief: The presence penalty setting for the GenAI request.
examples: [0.1]
- id: gen_ai.request.encoding_formats
stability: development
type: string[]
brief: The encoding formats requested in an embeddings operation, if specified.
examples:
- ['base64']
- ['float', 'binary']
note: >
In some GenAI systems the encoding formats are called embedding types.
Also, some GenAI systems only accept a single format per request.
- id: gen_ai.request.seed
stability: development
type: int
brief: Requests with same seed value more likely to return same result.
examples: [100]
- id: gen_ai.response.id
stability: development
type: string
brief: The unique identifier for the completion.
examples: ['chatcmpl-123']
- id: gen_ai.response.model
stability: development
type: string
brief: The name of the model that generated the response.
examples: ['gpt-4-0613']
- id: gen_ai.response.finish_reasons
stability: development
type: string[]
brief: Array of reasons the model stopped generating tokens, corresponding to each generation received.
examples:
- [stop]
- [stop, length]
- id: gen_ai.usage.input_tokens
stability: development
type: int
brief: The number of tokens used in the GenAI input (prompt).
examples: [100]
- id: gen_ai.usage.output_tokens
stability: development
type: int
brief: The number of tokens used in the GenAI response (completion).
examples: [180]
- id: gen_ai.token.type
stability: development
type:
members:
- id: input
stability: development
value: "input"
brief: 'Input tokens (prompt, input, etc.)'
- id: completion
stability: development
value: "output"
deprecated: "Replaced by `output`."
brief: 'Output tokens (completion, response, etc.)'
- id: output
stability: development
value: "output"
brief: 'Output tokens (completion, response, etc.)'
brief: The type of token being counted.
examples: ['input', 'output']
- id: gen_ai.conversation.id
stability: development
type: string
brief: The unique identifier for a conversation (session, thread), used to store and correlate messages within this conversation.
examples: ["conv_5j66UpCpwteGg4YSxUnt7lPY"]
- id: gen_ai.agent.id
stability: development
type: string
brief: The unique identifier of the GenAI agent.
examples: ['asst_5j66UpCpwteGg4YSxUnt7lPY']
- id: gen_ai.agent.name
stability: development
type: string
brief: Human-readable name of the GenAI agent provided by the application.
examples: ["Math Tutor", "Fiction Writer"]
- id: gen_ai.agent.description
stability: development
type: string
brief: Free-form description of the GenAI agent provided by the application.
examples: ["Helps with math problems", "Generates fiction stories"]
- id: gen_ai.tool.name
stability: development
type: string
brief: Name of the tool utilized by the agent.
examples: ["Flights"]
- id: gen_ai.tool.call.id
stability: development
type: string
brief: The tool call identifier.
examples: ['call_mszuSIzqtI65i1wAUOE8w5H4']
- id: gen_ai.tool.description
stability: development
type: string
brief: The tool description.
examples: ["Multiply two numbers"]
- id: gen_ai.tool.type
stability: development
type: string
brief: Type of the tool utilized by the agent
note: >
Extension: A tool executed on the agent-side to directly call external APIs, bridging the gap between the agent and real-world systems.
Agent-side operations involve actions that are performed by the agent on the server or within the agent's controlled environment.
Function: A tool executed on the client-side, where the agent generates parameters for a predefined function, and the client executes the logic.
Client-side operations are actions taken on the user's end or within the client application.
Datastore: A tool used by the agent to access and query structured or unstructured external data for retrieval-augmented tasks or knowledge updates.
examples: ['function', 'extension', 'datastore']
- id: gen_ai.data_source.id
stability: development
type: string
brief: The data source identifier.
note: >
Data sources are used by AI agents and RAG applications to store grounding data.
A data source may be an external database, object store, document collection, website, or any other storage system used by the GenAI agent or application.
The `gen_ai.data_source.id` SHOULD match the identifier used by the GenAI system rather than a name specific to the external storage, such as a database or
object store. Semantic conventions referencing `gen_ai.data_source.id` MAY also leverage additional attributes, such as `db.*`, to further identify and describe the data source.
examples: ['H7STPQYOND']
- id: gen_ai.operation.name
stability: development
type:
members:
- id: chat
value: "chat"
brief: 'Chat completion operation such as [OpenAI Chat API](https://platform.openai.com/docs/api-reference/chat)'
stability: development
- id: generate_content
value: "generate_content"
brief: 'Multimodal content generation operation such as [Gemini Generate Content](https://ai.google.dev/api/generate-content)'
stability: development
- id: text_completion
value: "text_completion"
brief: 'Text completions operation such as [OpenAI Completions API (Legacy)](https://platform.openai.com/docs/api-reference/completions)'
stability: development
- id: embeddings
value: "embeddings"
brief: 'Embeddings operation such as [OpenAI Create embeddings API](https://platform.openai.com/docs/api-reference/embeddings/create)'
stability: development
- id: create_agent
value: "create_agent"
brief: 'Create GenAI agent'
stability: development
- id: invoke_agent
value: "invoke_agent"
brief: 'Invoke GenAI agent'
stability: development
- id: execute_tool
value: "execute_tool"
brief: 'Execute a tool'
stability: development
brief: The name of the operation being performed.
note: >
If one of the predefined values applies, but specific system uses a different name it's RECOMMENDED to document it in the semantic
conventions for specific GenAI system and use system-specific name in the instrumentation.
If a different name is not documented, instrumentation libraries SHOULD use applicable predefined value.
- id: gen_ai.output.type
stability: development
type:
members:
- id: text
value: "text"
brief: 'Plain text'
stability: development
- id: json
value: "json"
brief: 'JSON object with known or unknown schema'
stability: development
- id: image
value: "image"
brief: 'Image'
stability: development
- id: speech
value: "speech"
brief: 'Speech'
stability: development
# we might need to record requested and actual output types on the same span/event
# at some point. In this case, we might need to add a new attribute.
# we may also need to record an array of types if multiple are requested/returned.
brief: Represents the content type requested by the client.
note: >
This attribute SHOULD be used when the client requests output of a
specific type. The model may return zero or more outputs of this type.
This attribute specifies the output modality and not the actual output format.
For example, if an image is requested, the actual output could be a
URL pointing to an image file.
Additional output format details may be recorded in the future in the
`gen_ai.output.{type}.*` attributes.