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.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.prompt_tokens
        requirement_level: recommended
      - ref: gen_ai.usage.completion_tokens
        requirement_level: recommended
    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)
