Skip to content

Commit d5be4a4

Browse files
thpiercebisgaard-itis
authored andcommitted
Only decode JSON input buffer in Anthropic Claude streaming (open-telemetry#3875)
* Only decode JSON input buffer in Anthropic Claude streaming _decode_tool_use was only used when _tool_json_input_buf was found, but we were decoding the entire _content_block after adding _tool_json_input_buf to it. The _content_block overall which could contain non-JSON elements (e.g. {}), causing failures. To fix this, we have removed _decode_tool_use helper function and inlined JSON decoding logic directly into content_block_stop handler in _process_anthropic_claude_chunk, where we only use it to decode _tool_json_input_buf before appending to _content_block. * Update test_botocore_bedrock.py Fix lint: `opentelemetry-instrumentation-botocore/tests/test_botocore_bedrock.py:2990:4: C0415: Import outside toplevel (opentelemetry.instrumentation.botocore.extensions.bedrock_utils.InvokeModelWithResponseStreamWrapper) (import-outside-toplevel)` * Update test_botocore_bedrock.py Remove extra line * fix lint issue
1 parent 07f833f commit d5be4a4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4040
- `opentelemetry-exporter-richconsole`: Prevent deadlock when parent span is not part of the batch
4141
([#3900](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3900))
4242

43+
### Fixed
44+
45+
- `opentelemetry-instrumentation-botocore`: Handle dict input in _decode_tool_use for Bedrock streaming
46+
([#3875](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3875))
47+
4348
## Version 1.38.0/0.59b0 (2025-10-16)
4449

4550
### Fixed

0 commit comments

Comments
 (0)