Skip to content

fix(llmobs): fix parsing errors for bedrock converse stream #13238

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

lievan
Copy link
Contributor

@lievan lievan commented Apr 21, 2025

Fixing a noop test discovered a couple bugs for parsing out the response from converse stream

  1. We were adding a [{"role": "assistant"}] message that didn't contain any content blocks to be parsed out - the fix is to only try to extract a message if it contains associated content block indices
  2. toolName -> name

Checklist

  • PR author has checked that all the criteria below are met
  • The PR description includes an overview of the change
  • The PR description articulates the motivation for the change
  • The change includes tests OR the PR description describes a testing strategy
  • The PR description notes risks associated with the change, if any
  • Newly-added code is easy to change
  • The change follows the library release note guidelines
  • The change includes or references documentation updates if necessary
  • Backport labels are set (if applicable)

Reviewer Checklist

  • Reviewer has checked that all the criteria below are met
  • Title is accurate
  • All changes are related to the pull request's stated goal
  • Avoids breaking API changes
  • Testing strategy adequately addresses listed risks
  • Newly-added code is easy to change
  • Release note makes sense to a user of the library
  • If necessary, author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment
  • Backport labels are set in a manner that is consistent with the release branch maintenance policy

Copy link
Contributor

github-actions bot commented Apr 21, 2025

CODEOWNERS have been resolved as:

releasenotes/notes/converse-parsing-cd9ebb9506f8bbe1.yaml               @DataDog/apm-python
ddtrace/llmobs/_integrations/bedrock.py                                 @DataDog/ml-observability
ddtrace/llmobs/_integrations/utils.py                                   @DataDog/ml-observability
tests/contrib/botocore/test_bedrock_llmobs.py                           @DataDog/ml-observability

Copy link
Contributor

github-actions bot commented Apr 21, 2025

Bootstrap import analysis

Comparison of import times between this PR and base.

Summary

The average import time from this PR is: 249 ± 8 ms.

The average import time from base is: 257 ± 7 ms.

The import time difference between this PR and base is: -7.8 ± 0.3 ms.

Import time breakdown

The following import paths have shrunk:

ddtrace.auto 2.276 ms (0.91%)
ddtrace.bootstrap.sitecustomize 1.568 ms (0.63%)
ddtrace.bootstrap.preload 1.568 ms (0.63%)
ddtrace.internal.products 1.568 ms (0.63%)
ddtrace.internal.remoteconfig.client 0.755 ms (0.30%)
ddtrace 0.709 ms (0.28%)

@pr-commenter
Copy link

pr-commenter bot commented Apr 21, 2025

Benchmarks

Benchmark execution time: 2025-04-23 14:06:33

Comparing candidate commit d87e981 in PR branch evan.li/fix-parsing-stream with baseline commit 6d33c22 in branch main.

Found 0 performance improvements and 2 performance regressions! Performance is the same for 495 metrics, 3 unstable metrics.

scenario:iast_aspects-ospathsplitext_aspect

  • 🟥 execution_time [+566.866ns; +706.060ns] or [+12.475%; +15.538%]

scenario:telemetryaddmetric-1-distribution-metric-1-times

  • 🟥 execution_time [+327.156ns; +372.427ns] or [+11.203%; +12.753%]

@lievan lievan marked this pull request as ready for review April 22, 2025 11:46
@lievan lievan requested review from a team as code owners April 22, 2025 11:46
@lievan lievan requested review from gnufede and ZStriker19 April 22, 2025 11:46
@lievan lievan enabled auto-merge (squash) April 23, 2025 07:29
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.

2 participants