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

88 lines
3.8 KiB
YAML

groups:
- id: trace.gen_ai.client
type: span
brief: >
Describes GenAI operation span.
attributes:
- ref: gen_ai.system
requirement_level: required
- ref: gen_ai.request.model
requirement_level: required
note: >
The name of the GenAI model a request is being made to. If the model is supplied by a vendor,
then the value must be the exact name of the model requested. If the model is a fine-tuned
custom model, the value should have a more specific name than the base model that's been fine-tuned.
- ref: gen_ai.operation.name
requirement_level: required
- ref: gen_ai.request.max_tokens
requirement_level: recommended
- ref: gen_ai.request.temperature
requirement_level: recommended
- ref: gen_ai.request.top_p
requirement_level: recommended
- ref: gen_ai.request.top_k
requirement_level: recommended
- ref: gen_ai.request.stop_sequences
requirement_level: recommended
- ref: gen_ai.request.frequency_penalty
requirement_level: recommended
- ref: gen_ai.request.presence_penalty
requirement_level: recommended
- ref: gen_ai.response.id
requirement_level: recommended
- ref: gen_ai.response.model
requirement_level: recommended
note: >
If available. The name of the GenAI model that provided the response. If the model is supplied by a vendor,
then the value must be the exact name of the model actually used. If the model is a
fine-tuned custom model, the value should have a more specific name than the base model that's been fine-tuned.
- ref: gen_ai.response.finish_reasons
requirement_level: recommended
- ref: gen_ai.usage.input_tokens
requirement_level: recommended
- ref: gen_ai.usage.output_tokens
requirement_level: recommended
- ref: server.address
brief: GenAI server address.
requirement_level: recommended
- ref: server.port
brief: GenAI server port.
requirement_level:
conditionally_required: If `server.address` is set.
- ref: error.type
requirement_level:
conditionally_required: "if the operation ended in an error"
note: |
The `error.type` SHOULD match the error code returned by the Generative AI provider or the client library,
the canonical name of exception that occurred, or another low-cardinality error identifier.
Instrumentations SHOULD document the list of errors they report.
events:
- gen_ai.content.prompt
- gen_ai.content.completion
- id: gen_ai.content.prompt
name: gen_ai.content.prompt
type: event
brief: >
In the lifetime of an GenAI span, events for prompts sent and completions received
may be created, depending on the configuration of the instrumentation.
attributes:
- ref: gen_ai.prompt
requirement_level:
conditionally_required: if and only if corresponding event is enabled
note: >
It's RECOMMENDED to format prompts as JSON string matching [OpenAI messages format](https://platform.openai.com/docs/guides/text-generation)
- id: gen_ai.content.completion
name: gen_ai.content.completion
type: event
brief: >
In the lifetime of an GenAI span, events for prompts sent and completions received
may be created, depending on the configuration of the instrumentation.
attributes:
- ref: gen_ai.completion
requirement_level:
conditionally_required: if and only if corresponding event is enabled
note: >
It's RECOMMENDED to format completions as JSON string matching [OpenAI messages format](https://platform.openai.com/docs/guides/text-generation)