Skip to content

Coerce top_k request attribute to integer across Bedrock, Portkey, and Smolagents - #707

Merged
lmolkova merged 4 commits into
open-telemetry:mainfrom
lmolkova:coerce-top-k-int
Sep 13, 2026
Merged

lmolkova merged 4 commits into
open-telemetry:mainfrom
lmolkova:coerce-top-k-int

Conversation

@lmolkova

@lmolkova lmolkova commented Sep 13, 2026 •

Copy link
Copy Markdown
Member

Coerces top_k request parameter to int instead of float in Bedrock, Portkey, and Smolagents instrumentations, and updates Smolagents test expectations.

Aligns with gen_ai.request.top_k, which specifies top_k as integer type.

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.

🟡 Changes recommended

The shared field remains typed as float, while Bedrock and Portkey lack type-sensitive regression coverage.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Aligns gen_ai.request.top_k telemetry with the semantic convention’s integer type.

Changes:

  • Uses integer coercion in Bedrock, Portkey, and Smolagents.
  • Updates Smolagents type assertions.
  • Adds changelog fragments.
File summaries
File Description
...smolagents/tests/test_models.py Expects integer top_k.
...smolagents/patch.py Uses integer coercion.
...smolagents/.changelog/707.fixed Documents the fix.
...portkey/utils.py Converts top_k to integer.
...portkey/.changelog/707.fixed Documents the fix.
...bedrock/extractors.py Uses safe integer conversion.
...bedrock/.changelog/707.fixed Documents the fix.
Review details
  • Files reviewed: 7/7 changed files
  • Comments generated: 3
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@lmolkova
lmolkova marked this pull request as ready for review September 13, 2026 21:55
@lmolkova
lmolkova requested a review from a team as a code owner September 13, 2026 21:55

@eternalcuriouslearner eternalcuriouslearner 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.

LGTM!!

@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Sep 13, 2026 •

Copy link
Copy Markdown

Pull request dashboard status

Merged · refreshed 2026-09-17 06:33 UTC

Status above doesn't look right?
  • Anything look wrong? Report it with what you expected; it helps us improve the dashboard.

@lmolkova
lmolkova added this pull request to the merge queue Sep 13, 2026
Merged via the queue into open-telemetry:main with commit afbc541 Sep 13, 2026
75 checks passed
@lmolkova
lmolkova deleted the coerce-top-k-int branch September 13, 2026 23:59
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.

3 participants