Skip to content

Change gen_ai.request.top_k type to int and split out gen_ai.retrieval.top_k - #217

Merged
trask merged 5 commits into
open-telemetry:mainfrom
trask:clarify-top-k
Jun 4, 2026
Merged

trask merged 5 commits into
open-telemetry:mainfrom
trask:clarify-top-k

Conversation

@trask

@trask trask commented May 29, 2026 •

Copy link
Copy Markdown
Member

Changes gen_ai.request.top_k type from double to int since K is always a positive integer.

Splits retrieval out of gen_ai.request.top_k by introducing a new gen_ai.retrieval.top_k attribute for the maximum number of documents a retriever is asked to return. The gen_ai.retrieval.client span now references gen_ai.retrieval.top_k instead of overloading gen_ai.request.top_k.

Also clarifies that gen_ai.request.top_k is the top-K decoding parameter (e.g., Anthropic top_k, Cohere k, Google topK) and not OpenAI's top_logprobs output-shaping parameter.

Fixes #10.
Related to #18.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR clarifies the meaning of gen_ai.request.top_k as a top-K sampling/decoding parameter and distinguishes it from OpenAI’s top_logprobs response-shaping option.

Changes:

  • Updates the source GenAI registry entry for gen_ai.request.top_k with clearer wording, a note, and a more realistic example.
  • Regenerates affected GenAI documentation and schema snapshot references.
  • Adds a changelog clarification entry.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
model/gen-ai/registry.yaml Updates the source attribute definition for gen_ai.request.top_k.
schema-snapshot/registry.yaml Refreshes generated schema snapshot entries for the updated attribute.
docs/registry/attributes/gen-ai.md Regenerates the GenAI attribute registry documentation.
docs/gen-ai/gen-ai-spans.md Regenerates span documentation that references top_k.
docs/gen-ai/gen-ai-events.md Regenerates event documentation that references top_k.
docs/gen-ai/openai.md Regenerates OpenAI-specific documentation references.
docs/gen-ai/azure-ai-inference.md Regenerates Azure AI Inference documentation references.
docs/gen-ai/aws-bedrock.md Regenerates AWS Bedrock documentation references.
docs/gen-ai/anthropic.md Regenerates Anthropic documentation references.
CHANGELOG.md Adds an Unreleased clarification entry.

Comment thread model/gen-ai/registry.yaml

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Comment thread model/gen-ai/registry.yaml
@trask trask changed the title Clarify gen_ai.request.top_k vs OpenAI top_logprobs Clarify and split gen_ai.request.top_k vs retrieval top_k May 29, 2026
@trask trask changed the title Clarify and split gen_ai.request.top_k vs retrieval top_k Change gen_ai.request.top_k type to int and split out retrieval top_k May 29, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 19 out of 19 changed files in this pull request and generated no new comments.

@trask trask changed the title Change gen_ai.request.top_k type to int and split out retrieval top_k Change gen_ai.request.top_k type to int and split out gen_ai.retrieval.top_k May 29, 2026
@trask
trask marked this pull request as ready for review May 29, 2026 17:26
@trask
trask requested a review from a team as a code owner May 29, 2026 17:26
@trask
trask added this pull request to the merge queue Jun 4, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Jun 4, 2026
@trask
trask enabled auto-merge June 4, 2026 14:40
@trask
trask added this pull request to the merge queue Jun 4, 2026
Merged via the queue into open-telemetry:main with commit c8e9288 Jun 4, 2026
39 checks passed
@trask
trask deleted the clarify-top-k branch June 4, 2026 14:42
@trask trask mentioned this pull request Jul 31, 2026
3 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GenAI: Clarify what gen_ai.request.top_k means

4 participants