Skip to content

Bedrock instrumentation strips quotes from JSON strings in ConverseStream tool_use responses (v1.31.0/0.52b0+) #3537

Closed
@sightseeker

Description

@sightseeker

Describe your environment

OS: macOS and Debian 12 (confirmed on both)
Python version: Python 3.13
Package version: opentelemetry-python-contrib v1.31.0/0.52b0 or later

What happened?

When using Amazon Bedrock's ConverseStream API with tool_use functionality, JSON parsing errors occur during response processing. The issue is caused by the _decodetool_use function in bedrock_utils.py incorrectly handling double-quoted strings in chunked responses, removing necessary quotes and breaking JSON structure.

Steps to Reproduce

import json

import boto3
from opentelemetry.instrumentation.botocore import BotocoreInstrumentor

# Initialize instrumentation
BotocoreInstrumentor().instrument()

# Use Bedrock ConverseStream API with tool_use
client = boto3.client("bedrock-runtime", region_name="us-east-1")

response = client.converse_stream(
    modelId="anthropic.claude-3-sonnet-20240229-v1:0",  # or any model supporting tools
    messages=[
        {
            "role": "user",
            "content": [
                {
                    "text": "Use the get_cities_list tool to provide exactly 10 popular tourist cities in Japan. Call the tool with a cities array containing: Tokyo, Osaka, Kyoto, Hiroshima, Nara, Yokohama, Sapporo, Fukuoka, Sendai, and Nagoya."
                }
            ],
        }
    ],
    toolConfig={
        "tools": [
            {
                "toolSpec": {
                    "name": "get_cities_list",
                    "description": "Get a list of cities",
                    "inputSchema": {"json": {"type": "object", "properties": {"cities": {"type": "array", "items": {"type": "string"}}}}},
                }
            }
        ]
    },
)


res = ""

# Process the streaming response - error occurs here
for chunk in response["stream"]:
    if "contentBlockDelta" in chunk:
        delta = chunk["contentBlockDelta"]["delta"]
        if "toolUse" in delta:
            res += delta["toolUse"].get("input")

# Parse the output and print it
print(json.loads(res))

Expected Result

The ConverseStream API with tool_use should work seamlessly with OpenTelemetry instrumentation. Chunked responses should be properly processed without JSON parsing errors, maintaining the integrity of JSON strings across chunk boundaries.

For example, when a complete response is {"cities":["Tokyo","Osaka","Kyoto","Hiroshima","Nara","Yokohama","Sapporo","Fukuoka","Sendai","Nagoya"]} and it's split across chunks, the final assembled JSON should remain valid regardless of how the chunks are divided.

Actual Result

JSON parsing error occurs when chunked responses contain complete quoted strings.

Specific problem:

  • Expected complete JSON: {"cities":["Tokyo","Osaka","Kyoto","Hiroshima","Nara","Yokohama","Sapporo","Fukuoka","Sendai","Nagoya"]}
  • When delta chunks contain complete quoted strings like: "Tokyo", "Osaka", "Kyoto", etc.
  • The _decodetool_use function strips the quotes: Tokyo, Osaka, Kyoto, etc.
  • Final assembled JSON becomes: {"cities":[Tokyo,Osaka,Kyoto,"Hiroshima",Nara,"Yokohama",Sapporo,"Fukuoka",Sendai,"Nagoya"]} ← Invalid JSON
  • Result: JSON parsing fails due to multiple unquoted string values in the array

Root cause location: instrumentation/opentelemetry-instrumentation-botocore/src/opentelemetry/instrumentation/botocore/extensions/bedrock_utils.py

The issue occurs inconsistently depending on chunk boundaries:

  • Works: Chunks like {"cities":["Tok, yo","Osa, ka","Kyoto"]} (quotes not stripped due to incomplete strings)
  • Fails: Chunks like "Tokyo", "Osaka", "Kyoto" (complete quoted strings get quotes stripped)

Additional context

  • This is a regression introduced in v1.31.0/0.52b0
  • The same code works correctly with versions prior to v1.31.0/0.52b0
  • Confirmed on multiple platforms: macOS and Debian 12
  • The issue only affects ConverseStream API with tool_use functionality
  • Regular Bedrock API calls (non-streaming) are not affected
  • The problem impacts applications that rely on tool calling with streaming responses

The bug appears to be in the string parsing logic of the _decodetool_use function, which doesn't properly handle the case where a complete quoted string appears as a single chunk in the streaming response.

Would you like to implement a fix?

None

Activity

xrmx

xrmx commented on May 23, 2025

@xrmx
Contributor

Thanks for providing a reproducer

xrmx

xrmx commented on May 23, 2025

@xrmx
Contributor

@sightseeker I'm not able to reproduce this and it prints {'cities': ['Tokyo', 'Osaka', 'Kyoto', 'Hiroshima', 'Nara', 'Yokohama', 'Sapporo', 'Fukuoka', 'Sendai', 'Nagoya']}

Do you have a stacktrace? Also we don't have _decodetool_use function here.

sightseeker

sightseeker commented on May 23, 2025

@sightseeker
Author

@xrmx I don’t have my PC with me right now, so I’ll send the stack trace later.

Since it depends on the stream response chunks, the issue only occurs once every 10 to 20 times.

sightseeker

sightseeker commented on May 24, 2025

@sightseeker
Author

@xrmx

# The following lines will demonstrate the bug:
# 1. First line shows the corrupted JSON string (with missing quotes)
# 2. Second line will fail with JSONDecodeError due to invalid JSON syntax
print(f"Final output:  {res}")
print(f"Parsed output: {json.loads(res)}")

Note about the reproduction code: The final two print statements are designed to demonstrate the bug clearly:

  1. print(f"Final output: {res}") - This will show the corrupted JSON string where quotes have been incorrectly stripped by the _decodetool_use function. You'll see something like {"cities":[Tokyo,Osaka,Kyoto,...]} instead of the expected {"cities":["Tokyo","Osaka","Kyoto",...]}

  2. print(f"Parsed output: {json.loads(res)}") - This line will fail with a JSONDecodeError because the assembled string is no longer valid JSON due to the missing quotes around string values.

To reproduce the issue: Replace the last two lines with the code above and run it. Important: Since this issue depends on how the streaming response is chunked, it may only occur intermittently - approximately once every 10 to 20 attempts. You may need to run the code multiple times to observe the bug. When the issue occurs with the affected versions (v1.31.0/0.52b0+), you should see the malformed JSON output first, followed by a JSON parsing exception. This clearly demonstrates how the instrumentation is breaking the streaming response processing.

When working correctly (quotes preserved):

Final output:  {"cities": ["Tokyo", "Osaka, Kyoto", "Hiroshima", "Nara", "Yokohama", "Sapporo", "Fukuoka", "Sendai", "Nagoya"]}
Parsed output: {'cities': ['Tokyo', 'Osaka, Kyoto', 'Hiroshima', 'Nara', 'Yokohama', 'Sapporo', 'Fukuoka', 'Sendai', 'Nagoya']}

When the bug occurs (quotes stripped by _decode_tool_use):

Final output:  {"cities": ["Tokyo", "Osaka", "Kyoto", "Hiroshima", Nara, "Yokohama", "Sapporo", "Fukuoka", "Sendai", "Nagoya"]}
Traceback (most recent call last):
File "/path/to/your/script.py", line 50, in <module>
print(f"Parsed output: {json.loads(res)}")
~~~~~~~~~~^^^^^
File "/usr/lib/python3.13/json/init.py", line 346, in loads
return _default_decoder.decode(s)
~~~~~~~~~~~~~~~~~~~~~~~^^^
File "/usr/lib/python3.13/json/decoder.py", line 345, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.13/json/decoder.py", line 363, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 53 (char 52)

Notice in the failure case how Nara appears without quotes, making the JSON invalid and causing the parsing error.

xrmx

xrmx commented on May 26, 2025

@xrmx
Contributor

Tested ~30 times still no joy in reproducing.

I've pushed a branch here https://github.com/xrmx/opentelemetry-python-contrib/tree/fix-converse-stream-tool-3537 with a test you can run on your machine and record the aws response so I can reproduce it too.

Per instrumentation/opentelemetry-instrumentation-botocore/tests/README.md you need to let tox access AWS env vars for recording calls:

export TOX_OVERRIDE=testenv.pass_env=AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY,AWS_SESSION_TOKEN,AWS_DEFAULT_REGION

You can run the test from the root of the -contrib repo with:

tox -e py313-test-instrumentation-botocore-1 -- -k test_converse_stream_tool_call_parsing_errors

Until the recording is not the one we expect you need to remove it before running tox again:

rm instrumentation/opentelemetry-instrumentation-botocore/tests/cassettes/test_converse_stream_tool_call_parsing_errors.yaml

When you have a recording reproducing the issue please attach it to this issue so I can reproduce it too.

sightseeker

sightseeker commented on May 26, 2025

@sightseeker
Author

@xrmx Thank you for creating the test! I found the issue with reproduction - the test code wasn't enabling instrumentation, which is required to trigger the bug.

I've created a commit that enables instrumentation in the test: sightseeker@7b0afd9

To reproduce the issue with instrumentation enabled:

  1. Apply the changes from my commit above (or add BotocoreInstrumentor().instrument() before the API call in the test)
  2. Run the test with instrumentation active:
export TOX_OVERRIDE=testenv.pass_env=AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY,AWS_SESSION_TOKEN,AWS_DEFAULT_REGION
rm instrumentation/opentelemetry-instrumentation-botocore/tests/cassettes/test_converse_stream_tool_call_parsing_errors.yaml
tox -e py313-test-instrumentation-botocore-1 -- -k test_converse_stream_tool_call_parsing_errors
  1. Repeat until you capture a failing case (may take 10-20 attempts due to the chunking dependency)
    Once I successfully reproduce the issue with instrumentation enabled, I'll attach the recorded test_converse_stream_tool_call_parsing_errors.yaml file that demonstrates the bug. The key difference is that without instrumentation, the _decodetool_use function in bedrock_utils.py is never called, so the quote-stripping bug doesn't occur.
interactions:
- request:
    body: |-
      {
        "messages": [
          {
            "role": "user",
            "content": [
              {
                "text": "Use the get_cities_list tool to provide exactly 10 popular tourist cities in Japan. Call the tool with a cities array containing: Tokyo, Osaka, Kyoto, Hiroshima, Nara, Yokohama, Sapporo, Fukuoka, Sendai, and Nagoya"
              }
            ]
          }
        ],
        "toolConfig": {
          "tools": [
            {
              "toolSpec": {
                "name": "get_cities_list",
                "description": "Get a list of cities",
                "inputSchema": {
                  "json": {
                    "type": "object",
                    "properties": {
                      "cities": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              }
            }
          ]
        }
      }
    headers:
      Content-Length:
      - '501'
      Content-Type:
      - application/json
      User-Agent:
      - Boto3/1.35.56 md/Botocore#1.35.56 ua/2.0 os/macos#24.5.0 md/arch#arm64 lang/python#3.13.3
        md/pyimpl#CPython cfg/retry-mode#legacy Botocore/1.35.56
      X-Amz-Date:
      - 20250526T092334Z
      X-Amz-Security-Token:
      - test_aws_security_token
      X-Amzn-Trace-Id:
      - Root=1-1804a8ab-0108d3490381bf0999fc3051;Parent=c001b2d2045a7583;Sampled=1
      amz-sdk-invocation-id:
      - 9c60b065-2121-46dd-8040-4fa9572ec91d
      amz-sdk-request:
      - attempt=1
      authorization:
      - Bearer test_aws_authorization
    method: POST
    uri: https://bedrock-runtime.us-east-1.amazonaws.com/model/anthropic.claude-3-sonnet-20240229-v1%3A0/converse-stream
  response:
    body:
      string: !!binary |
        AAAAswAAAFK3IJ11CzpldmVudC10eXBlBwAMbWVzc2FnZVN0YXJ0DTpjb250ZW50LXR5cGUHABBh
        cHBsaWNhdGlvbi9qc29uDTptZXNzYWdlLXR5cGUHAAVldmVudHsicCI6ImFiY2RlZmdoaWprbG1u
        b3BxcnN0dXZ3eHl6QUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVowMSIsInJvbGUiOiJhc3Npc3Rh
        bnQifRl7p7oAAADCAAAAVwP4oIULOmV2ZW50LXR5cGUHABFjb250ZW50QmxvY2tEZWx0YQ06Y29u
        dGVudC10eXBlBwAQYXBwbGljYXRpb24vanNvbg06bWVzc2FnZS10eXBlBwAFZXZlbnR7ImNvbnRl
        bnRCbG9ja0luZGV4IjowLCJkZWx0YSI6eyJ0ZXh0IjoiSGVyZSJ9LCJwIjoiYWJjZGVmZ2hpamts
        bW5vcHFyc3R1dnd4eXpBQkNERUZHSElKSyJ99DgIBgAAAKUAAABXKOoL2As6ZXZlbnQtdHlwZQcA
        EWNvbnRlbnRCbG9ja0RlbHRhDTpjb250ZW50LXR5cGUHABBhcHBsaWNhdGlvbi9qc29uDTptZXNz
        YWdlLXR5cGUHAAVldmVudHsiY29udGVudEJsb2NrSW5kZXgiOjAsImRlbHRhIjp7InRleHQiOiIg
        aXMifSwicCI6ImFiY2RlZmdoaSJ9gXMnrQAAAKgAAABX0HrPaQs6ZXZlbnQtdHlwZQcAEWNvbnRl
        bnRCbG9ja0RlbHRhDTpjb250ZW50LXR5cGUHABBhcHBsaWNhdGlvbi9qc29uDTptZXNzYWdlLXR5
        cGUHAAVldmVudHsiY29udGVudEJsb2NrSW5kZXgiOjAsImRlbHRhIjp7InRleHQiOiIgaG93In0s
        InAiOiJhYmNkZWZnaGlqayJ96983TAAAALwAAABXRRr+Kws6ZXZlbnQtdHlwZQcAEWNvbnRlbnRC
        bG9ja0RlbHRhDTpjb250ZW50LXR5cGUHABBhcHBsaWNhdGlvbi9qc29uDTptZXNzYWdlLXR5cGUH
        AAVldmVudHsiY29udGVudEJsb2NrSW5kZXgiOjAsImRlbHRhIjp7InRleHQiOiIgdG8ifSwicCI6
        ImFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6QUJDREVGIn0NjTA6AAAA1wAAAFer+Lh3CzpldmVu
        dC10eXBlBwARY29udGVudEJsb2NrRGVsdGENOmNvbnRlbnQtdHlwZQcAEGFwcGxpY2F0aW9uL2pz
        b24NOm1lc3NhZ2UtdHlwZQcABWV2ZW50eyJjb250ZW50QmxvY2tJbmRleCI6MCwiZGVsdGEiOnsi
        dGV4dCI6IiBnZXQifSwicCI6ImFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6QUJDREVGR0hJSktM
        TU5PUFFSU1RVVldYWVowMTIzNDUifaZnJeMAAACjAAAAV6eq/ngLOmV2ZW50LXR5cGUHABFjb250
        ZW50QmxvY2tEZWx0YQ06Y29udGVudC10eXBlBwAQYXBwbGljYXRpb24vanNvbg06bWVzc2FnZS10
        eXBlBwAFZXZlbnR7ImNvbnRlbnRCbG9ja0luZGV4IjowLCJkZWx0YSI6eyJ0ZXh0IjoiIGEifSwi
        cCI6ImFiY2RlZmdoIn2wtAyUAAAA2AAAAFcpqC+mCzpldmVudC10eXBlBwARY29udGVudEJsb2Nr
        RGVsdGENOmNvbnRlbnQtdHlwZQcAEGFwcGxpY2F0aW9uL2pzb24NOm1lc3NhZ2UtdHlwZQcABWV2
        ZW50eyJjb250ZW50QmxvY2tJbmRleCI6MCwiZGVsdGEiOnsidGV4dCI6IiBsaXN0In0sInAiOiJh
        YmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ekFCQ0RFRkdISUpLTE1OT1BRUlNUVVZXWFlaMDEyMzQ1
        In3b/dWgAAAAuwAAAFf3OiI7CzpldmVudC10eXBlBwARY29udGVudEJsb2NrRGVsdGENOmNvbnRl
        bnQtdHlwZQcAEGFwcGxpY2F0aW9uL2pzb24NOm1lc3NhZ2UtdHlwZQcABWV2ZW50eyJjb250ZW50
        QmxvY2tJbmRleCI6MCwiZGVsdGEiOnsidGV4dCI6IiBvZiJ9LCJwIjoiYWJjZGVmZ2hpamtsbW5v
        cHFyc3R1dnd4eXpBQkNERSJ9Uk8pQQAAAJwAAABXhNvRLws6ZXZlbnQtdHlwZQcAEWNvbnRlbnRC
        bG9ja0RlbHRhDTpjb250ZW50LXR5cGUHABBhcHBsaWNhdGlvbi9qc29uDTptZXNzYWdlLXR5cGUH
        AAVldmVudHsiY29udGVudEJsb2NrSW5kZXgiOjAsImRlbHRhIjp7InRleHQiOiIgIn0sInAiOiJh
        YiJ9d89skAAAAKIAAABXmsrXyAs6ZXZlbnQtdHlwZQcAEWNvbnRlbnRCbG9ja0RlbHRhDTpjb250
        ZW50LXR5cGUHABBhcHBsaWNhdGlvbi9qc29uDTptZXNzYWdlLXR5cGUHAAVldmVudHsiY29udGVu
        dEJsb2NrSW5kZXgiOjAsImRlbHRhIjp7InRleHQiOiIxMCJ9LCJwIjoiYWJjZGVmZyJ9FAzlJgAA
        AK8AAABXYloTeQs6ZXZlbnQtdHlwZQcAEWNvbnRlbnRCbG9ja0RlbHRhDTpjb250ZW50LXR5cGUH
        ABBhcHBsaWNhdGlvbi9qc29uDTptZXNzYWdlLXR5cGUHAAVldmVudHsiY29udGVudEJsb2NrSW5k
        ZXgiOjAsImRlbHRhIjp7InRleHQiOiIgIn0sInAiOiJhYmNkZWZnaGlqa2xtbm9wcXJzdHUifZ9I
        EDIAAACpAAAAV+0a5tkLOmV2ZW50LXR5cGUHABFjb250ZW50QmxvY2tEZWx0YQ06Y29udGVudC10
        eXBlBwAQYXBwbGljYXRpb24vanNvbg06bWVzc2FnZS10eXBlBwAFZXZlbnR7ImNvbnRlbnRCbG9j
        a0luZGV4IjowLCJkZWx0YSI6eyJ0ZXh0IjoicG9wdWxhciJ9LCJwIjoiYWJjZGVmZ2hpIn3CSXT5
        AAAAxAAAAFeMuFUlCzpldmVudC10eXBlBwARY29udGVudEJsb2NrRGVsdGENOmNvbnRlbnQtdHlw
        ZQcAEGFwcGxpY2F0aW9uL2pzb24NOm1lc3NhZ2UtdHlwZQcABWV2ZW50eyJjb250ZW50QmxvY2tJ
        bmRleCI6MCwiZGVsdGEiOnsidGV4dCI6IiB0b3VyaXN0In0sInAiOiJhYmNkZWZnaGlqa2xtbm9w
        cXJzdHV2d3h5ekFCQ0RFRkdISSJ9e7oUpwAAALsAAABX9zoiOws6ZXZlbnQtdHlwZQcAEWNvbnRl
        bnRCbG9ja0RlbHRhDTpjb250ZW50LXR5cGUHABBhcHBsaWNhdGlvbi9qc29uDTptZXNzYWdlLXR5
        cGUHAAVldmVudHsiY29udGVudEJsb2NrSW5kZXgiOjAsImRlbHRhIjp7InRleHQiOiIgY2l0aWVz
        In0sInAiOiJhYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ekEifb1HzFAAAADEAAAAV4y4VSULOmV2
        ZW50LXR5cGUHABFjb250ZW50QmxvY2tEZWx0YQ06Y29udGVudC10eXBlBwAQYXBwbGljYXRpb24v
        anNvbg06bWVzc2FnZS10eXBlBwAFZXZlbnR7ImNvbnRlbnRCbG9ja0luZGV4IjowLCJkZWx0YSI6
        eyJ0ZXh0IjoiIGluIn0sInAiOiJhYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ekFCQ0RFRkdISUpL
        TE1OIn0Nb+z9AAAAvAAAAFdFGv4rCzpldmVudC10eXBlBwARY29udGVudEJsb2NrRGVsdGENOmNv
        bnRlbnQtdHlwZQcAEGFwcGxpY2F0aW9uL2pzb24NOm1lc3NhZ2UtdHlwZQcABWV2ZW50eyJjb250
        ZW50QmxvY2tJbmRleCI6MCwiZGVsdGEiOnsidGV4dCI6IiBKYXBhbiJ9LCJwIjoiYWJjZGVmZ2hp
        amtsbW5vcHFyc3R1dnd4eXpBQkMifaF1a+8AAADFAAAAV7HYfJULOmV2ZW50LXR5cGUHABFjb250
        ZW50QmxvY2tEZWx0YQ06Y29udGVudC10eXBlBwAQYXBwbGljYXRpb24vanNvbg06bWVzc2FnZS10
        eXBlBwAFZXZlbnR7ImNvbnRlbnRCbG9ja0luZGV4IjowLCJkZWx0YSI6eyJ0ZXh0IjoiIHVzaW5n
        In0sInAiOiJhYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ekFCQ0RFRkdISUpLTCJ96CiQUAAAANgA
        AABXKagvpgs6ZXZlbnQtdHlwZQcAEWNvbnRlbnRCbG9ja0RlbHRhDTpjb250ZW50LXR5cGUHABBh
        cHBsaWNhdGlvbi9qc29uDTptZXNzYWdlLXR5cGUHAAVldmVudHsiY29udGVudEJsb2NrSW5kZXgi
        OjAsImRlbHRhIjp7InRleHQiOiIgdGhlIn0sInAiOiJhYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5
        ekFCQ0RFRkdISUpLTE1OT1BRUlNUVVZXWFlaMDEyMzQ1NiJ92jM5VwAAAKUAAABXKOoL2As6ZXZl
        bnQtdHlwZQcAEWNvbnRlbnRCbG9ja0RlbHRhDTpjb250ZW50LXR5cGUHABBhcHBsaWNhdGlvbi9q
        c29uDTptZXNzYWdlLXR5cGUHAAVldmVudHsiY29udGVudEJsb2NrSW5kZXgiOjAsImRlbHRhIjp7
        InRleHQiOiIgYCJ9LCJwIjoiYWJjZGVmZ2hpaiJ9JY7TJwAAAMYAAABX9ngGRQs6ZXZlbnQtdHlw
        ZQcAEWNvbnRlbnRCbG9ja0RlbHRhDTpjb250ZW50LXR5cGUHABBhcHBsaWNhdGlvbi9qc29uDTpt
        ZXNzYWdlLXR5cGUHAAVldmVudHsiY29udGVudEJsb2NrSW5kZXgiOjAsImRlbHRhIjp7InRleHQi
        OiJnZXQifSwicCI6ImFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6QUJDREVGR0hJSktMTU5PUCJ9
        c+rl6QAAAMIAAABXA/ighQs6ZXZlbnQtdHlwZQcAEWNvbnRlbnRCbG9ja0RlbHRhDTpjb250ZW50
        LXR5cGUHABBhcHBsaWNhdGlvbi9qc29uDTptZXNzYWdlLXR5cGUHAAVldmVudHsiY29udGVudEJs
        b2NrSW5kZXgiOjAsImRlbHRhIjp7InRleHQiOiJfIn0sInAiOiJhYmNkZWZnaGlqa2xtbm9wcXJz
        dHV2d3h5ekFCQ0RFRkdISUpLTE1OIn3E/8eMAAAAowAAAFenqv54CzpldmVudC10eXBlBwARY29u
        dGVudEJsb2NrRGVsdGENOmNvbnRlbnQtdHlwZQcAEGFwcGxpY2F0aW9uL2pzb24NOm1lc3NhZ2Ut
        dHlwZQcABWV2ZW50eyJjb250ZW50QmxvY2tJbmRleCI6MCwiZGVsdGEiOnsidGV4dCI6ImNpdGll
        cyJ9LCJwIjoiYWJjZCJ9gbd7jgAAAKMAAABXp6r+eAs6ZXZlbnQtdHlwZQcAEWNvbnRlbnRCbG9j
        a0RlbHRhDTpjb250ZW50LXR5cGUHABBhcHBsaWNhdGlvbi9qc29uDTptZXNzYWdlLXR5cGUHAAVl
        dmVudHsiY29udGVudEJsb2NrSW5kZXgiOjAsImRlbHRhIjp7InRleHQiOiJfIn0sInAiOiJhYmNk
        ZWZnaGkifZu+QycAAACvAAAAV2JaE3kLOmV2ZW50LXR5cGUHABFjb250ZW50QmxvY2tEZWx0YQ06
        Y29udGVudC10eXBlBwAQYXBwbGljYXRpb24vanNvbg06bWVzc2FnZS10eXBlBwAFZXZlbnR7ImNv
        bnRlbnRCbG9ja0luZGV4IjowLCJkZWx0YSI6eyJ0ZXh0IjoibGlzdCJ9LCJwIjoiYWJjZGVmZ2hp
        amtsbW5vcHFyIn0+oMYiAAAAzAAAAFe8yB7kCzpldmVudC10eXBlBwARY29udGVudEJsb2NrRGVs
        dGENOmNvbnRlbnQtdHlwZQcAEGFwcGxpY2F0aW9uL2pzb24NOm1lc3NhZ2UtdHlwZQcABWV2ZW50
        eyJjb250ZW50QmxvY2tJbmRleCI6MCwiZGVsdGEiOnsidGV4dCI6ImAifSwicCI6ImFiY2RlZmdo
        aWprbG1ub3BxcnN0dXZ3eHl6QUJDREVGR0hJSktMTU5PUFFSU1RVVldYIn1Y5QnGAAAAqgAAAFeq
        upwJCzpldmVudC10eXBlBwARY29udGVudEJsb2NrRGVsdGENOmNvbnRlbnQtdHlwZQcAEGFwcGxp
        Y2F0aW9uL2pzb24NOm1lc3NhZ2UtdHlwZQcABWV2ZW50eyJjb250ZW50QmxvY2tJbmRleCI6MCwi
        ZGVsdGEiOnsidGV4dCI6IiB0b29sIn0sInAiOiJhYmNkZWZnaGlqa2wifWsMOC0AAAC4AAAAV7Ca
        WOsLOmV2ZW50LXR5cGUHABFjb250ZW50QmxvY2tEZWx0YQ06Y29udGVudC10eXBlBwAQYXBwbGlj
        YXRpb24vanNvbg06bWVzc2FnZS10eXBlBwAFZXZlbnR7ImNvbnRlbnRCbG9ja0luZGV4IjowLCJk
        ZWx0YSI6eyJ0ZXh0IjoiOiJ9LCJwIjoiYWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNEIn2N
        pk/MAAAAlAAAAFbDrKp4CzpldmVudC10eXBlBwAQY29udGVudEJsb2NrU3RvcA06Y29udGVudC10
        eXBlBwAQYXBwbGljYXRpb24vanNvbg06bWVzc2FnZS10eXBlBwAFZXZlbnR7ImNvbnRlbnRCbG9j
        a0luZGV4IjowLCJwIjoiYWJjZGVmZ2hpamtsbW5vcCJ9yrB0SgAAAPAAAABX2BlLYws6ZXZlbnQt
        dHlwZQcAEWNvbnRlbnRCbG9ja1N0YXJ0DTpjb250ZW50LXR5cGUHABBhcHBsaWNhdGlvbi9qc29u
        DTptZXNzYWdlLXR5cGUHAAVldmVudHsiY29udGVudEJsb2NrSW5kZXgiOjEsInAiOiJhYmNkZWZn
        aGlqa2xtbm8iLCJzdGFydCI6eyJ0b29sVXNlIjp7Im5hbWUiOiJnZXRfY2l0aWVzX2xpc3QiLCJ0
        b29sVXNlSWQiOiJ0b29sdXNlXzhJdDF5UWxWVGFtVUNFTVRpYUJITlEifX19oqH05QAAANkAAABX
        FMgGFgs6ZXZlbnQtdHlwZQcAEWNvbnRlbnRCbG9ja0RlbHRhDTpjb250ZW50LXR5cGUHABBhcHBs
        aWNhdGlvbi9qc29uDTptZXNzYWdlLXR5cGUHAAVldmVudHsiY29udGVudEJsb2NrSW5kZXgiOjEs
        ImRlbHRhIjp7InRvb2xVc2UiOnsiaW5wdXQiOiIifX0sInAiOiJhYmNkZWZnaGlqa2xtbm9wcXJz
        dHV2d3h5ekFCQ0RFRkdISUpLTE1OT1BRUlNUVVZXWFkifVoyZ88AAADWAAAAV5aYkccLOmV2ZW50
        LXR5cGUHABFjb250ZW50QmxvY2tEZWx0YQ06Y29udGVudC10eXBlBwAQYXBwbGljYXRpb24vanNv
        bg06bWVzc2FnZS10eXBlBwAFZXZlbnR7ImNvbnRlbnRCbG9ja0luZGV4IjoxLCJkZWx0YSI6eyJ0
        b29sVXNlIjp7ImlucHV0Ijoie1wiY2l0aSJ9fSwicCI6ImFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3
        eHl6QUJDREVGR0hJSktMTU5PIn3kpQSLAAAAxwAAAFfLGC/1CzpldmVudC10eXBlBwARY29udGVu
        dEJsb2NrRGVsdGENOmNvbnRlbnQtdHlwZQcAEGFwcGxpY2F0aW9uL2pzb24NOm1lc3NhZ2UtdHlw
        ZQcABWV2ZW50eyJjb250ZW50QmxvY2tJbmRleCI6MSwiZGVsdGEiOnsidG9vbFVzZSI6eyJpbnB1
        dCI6ImVzXCI6IFtcIlRvIn19LCJwIjoiYWJjZGVmZ2hpamtsbW5vcHFyc3R1diJ9mZk3AwAAAMUA
        AABXsdh8lQs6ZXZlbnQtdHlwZQcAEWNvbnRlbnRCbG9ja0RlbHRhDTpjb250ZW50LXR5cGUHABBh
        cHBsaWNhdGlvbi9qc29uDTptZXNzYWdlLXR5cGUHAAVldmVudHsiY29udGVudEJsb2NrSW5kZXgi
        OjEsImRlbHRhIjp7InRvb2xVc2UiOnsiaW5wdXQiOiJreSJ9fSwicCI6ImFiY2RlZmdoaWprbG1u
        b3BxcnN0dXZ3eHl6QUJDIn1dUZ7HAAAAxwAAAFfLGC/1CzpldmVudC10eXBlBwARY29udGVudEJs
        b2NrRGVsdGENOmNvbnRlbnQtdHlwZQcAEGFwcGxpY2F0aW9uL2pzb24NOm1lc3NhZ2UtdHlwZQcA
        BWV2ZW50eyJjb250ZW50QmxvY2tJbmRleCI6MSwiZGVsdGEiOnsidG9vbFVzZSI6eyJpbnB1dCI6
        Im9cIiwgXCJPcyJ9fSwicCI6ImFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eCJ98DvvZwAAAOAAAABX
        uPnc4Qs6ZXZlbnQtdHlwZQcAEWNvbnRlbnRCbG9ja0RlbHRhDTpjb250ZW50LXR5cGUHABBhcHBs
        aWNhdGlvbi9qc29uDTptZXNzYWdlLXR5cGUHAAVldmVudHsiY29udGVudEJsb2NrSW5kZXgiOjEs
        ImRlbHRhIjp7InRvb2xVc2UiOnsiaW5wdXQiOiJha2FcIiJ9fSwicCI6ImFiY2RlZmdoaWprbG1u
        b3BxcnN0dXZ3eHl6QUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVowIn0FawnjAAAAtAAAAFd1arXq
        CzpldmVudC10eXBlBwARY29udGVudEJsb2NrRGVsdGENOmNvbnRlbnQtdHlwZQcAEGFwcGxpY2F0
        aW9uL2pzb24NOm1lc3NhZ2UtdHlwZQcABWV2ZW50eyJjb250ZW50QmxvY2tJbmRleCI6MSwiZGVs
        dGEiOnsidG9vbFVzZSI6eyJpbnB1dCI6IiwgXCJLeW90b1wiIn19LCJwIjoiYWJjIn0EgbQpAAAA
        3gAAAFem6NoGCzpldmVudC10eXBlBwARY29udGVudEJsb2NrRGVsdGENOmNvbnRlbnQtdHlwZQcA
        EGFwcGxpY2F0aW9uL2pzb24NOm1lc3NhZ2UtdHlwZQcABWV2ZW50eyJjb250ZW50QmxvY2tJbmRl
        eCI6MSwiZGVsdGEiOnsidG9vbFVzZSI6eyJpbnB1dCI6IiwgIn19LCJwIjoiYWJjZGVmZ2hpamts
        bW5vcHFyc3R1dnd4eXpBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWjAxIn2zmOE9AAAA5gAAAFc3
        uSlBCzpldmVudC10eXBlBwARY29udGVudEJsb2NrRGVsdGENOmNvbnRlbnQtdHlwZQcAEGFwcGxp
        Y2F0aW9uL2pzb24NOm1lc3NhZ2UtdHlwZQcABWV2ZW50eyJjb250ZW50QmxvY2tJbmRleCI6MSwi
        ZGVsdGEiOnsidG9vbFVzZSI6eyJpbnB1dCI6IlwiSGlyIn19LCJwIjoiYWJjZGVmZ2hpamtsbW5v
        cHFyc3R1dnd4eXpBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWjAxMjM0NTYifSgIqjsAAACvAAAA
        V2JaE3kLOmV2ZW50LXR5cGUHABFjb250ZW50QmxvY2tEZWx0YQ06Y29udGVudC10eXBlBwAQYXBw
        bGljYXRpb24vanNvbg06bWVzc2FnZS10eXBlBwAFZXZlbnR7ImNvbnRlbnRCbG9ja0luZGV4Ijox
        LCJkZWx0YSI6eyJ0b29sVXNlIjp7ImlucHV0Ijoib3NoIn19LCJwIjoiYWJjZGVmIn2WZZkRAAAA
        1AAAAFfsWMKnCzpldmVudC10eXBlBwARY29udGVudEJsb2NrRGVsdGENOmNvbnRlbnQtdHlwZQcA
        EGFwcGxpY2F0aW9uL2pzb24NOm1lc3NhZ2UtdHlwZQcABWV2ZW50eyJjb250ZW50QmxvY2tJbmRl
        eCI6MSwiZGVsdGEiOnsidG9vbFVzZSI6eyJpbnB1dCI6ImltYVwiLCJ9fSwicCI6ImFiY2RlZmdo
        aWprbG1ub3BxcnN0dXZ3eHl6QUJDREVGR0hJSktMTU4iffR0yjoAAADpAAAAV7XpvpALOmV2ZW50
        LXR5cGUHABFjb250ZW50QmxvY2tEZWx0YQ06Y29udGVudC10eXBlBwAQYXBwbGljYXRpb24vanNv
        bg06bWVzc2FnZS10eXBlBwAFZXZlbnR7ImNvbnRlbnRCbG9ja0luZGV4IjoxLCJkZWx0YSI6eyJ0
        b29sVXNlIjp7ImlucHV0IjoiIFwiTmFyYVwiLCBcIllvIn19LCJwIjoiYWJjZGVmZ2hpamtsbW5v
        cHFyc3R1dnd4eXpBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWiJ9v8egGgAAANgAAABXKagvpgs6
        ZXZlbnQtdHlwZQcAEWNvbnRlbnRCbG9ja0RlbHRhDTpjb250ZW50LXR5cGUHABBhcHBsaWNhdGlv
        bi9qc29uDTptZXNzYWdlLXR5cGUHAAVldmVudHsiY29udGVudEJsb2NrSW5kZXgiOjEsImRlbHRh
        Ijp7InRvb2xVc2UiOnsiaW5wdXQiOiJrb2gifX0sInAiOiJhYmNkZWZnaGlqa2xtbm9wcXJzdHV2
        d3h5ekFCQ0RFRkdISUpLTE1OT1BRUlNUVSJ99vTh/gAAALoAAABXyloLiws6ZXZlbnQtdHlwZQcA
        EWNvbnRlbnRCbG9ja0RlbHRhDTpjb250ZW50LXR5cGUHABBhcHBsaWNhdGlvbi9qc29uDTptZXNz
        YWdlLXR5cGUHAAVldmVudHsiY29udGVudEJsb2NrSW5kZXgiOjEsImRlbHRhIjp7InRvb2xVc2Ui
        OnsiaW5wdXQiOiJhbWFcIiwgXCIifX0sInAiOiJhYmNkZWZnaGlqayJ9avp54QAAANYAAABXlpiR
        xws6ZXZlbnQtdHlwZQcAEWNvbnRlbnRCbG9ja0RlbHRhDTpjb250ZW50LXR5cGUHABBhcHBsaWNh
        dGlvbi9qc29uDTptZXNzYWdlLXR5cGUHAAVldmVudHsiY29udGVudEJsb2NrSW5kZXgiOjEsImRl
        bHRhIjp7InRvb2xVc2UiOnsiaW5wdXQiOiJTYXBwb3JvXCIsICJ9fSwicCI6ImFiY2RlZmdoaWpr
        bG1ub3BxcnN0dXZ3eHl6QUJDREVGR0hJSksifeyP/NMAAADqAAAAV/JJxEALOmV2ZW50LXR5cGUH
        ABFjb250ZW50QmxvY2tEZWx0YQ06Y29udGVudC10eXBlBwAQYXBwbGljYXRpb24vanNvbg06bWVz
        c2FnZS10eXBlBwAFZXZlbnR7ImNvbnRlbnRCbG9ja0luZGV4IjoxLCJkZWx0YSI6eyJ0b29sVXNl
        Ijp7ImlucHV0IjoiXCJGdWt1b2thXCIsIn19LCJwIjoiYWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4
        eXpBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWjAxMjMiffO/UfYAAADaAAAAV1NofMYLOmV2ZW50
        LXR5cGUHABFjb250ZW50QmxvY2tEZWx0YQ06Y29udGVudC10eXBlBwAQYXBwbGljYXRpb24vanNv
        bg06bWVzc2FnZS10eXBlBwAFZXZlbnR7ImNvbnRlbnRCbG9ja0luZGV4IjoxLCJkZWx0YSI6eyJ0
        b29sVXNlIjp7ImlucHV0IjoiIFwiU2VuZGFpXCIifX0sInAiOiJhYmNkZWZnaGlqa2xtbm9wcXJz
        dHV2d3h5ekFCQ0RFRkdISUpLTE1OTyJ93P5FpgAAALgAAABXsJpY6ws6ZXZlbnQtdHlwZQcAEWNv
        bnRlbnRCbG9ja0RlbHRhDTpjb250ZW50LXR5cGUHABBhcHBsaWNhdGlvbi9qc29uDTptZXNzYWdl
        LXR5cGUHAAVldmVudHsiY29udGVudEJsb2NrSW5kZXgiOjEsImRlbHRhIjp7InRvb2xVc2UiOnsi
        aW5wdXQiOiIsIFwiTmFnbyJ9fSwicCI6ImFiY2RlZmdoaWoifQfbEcAAAADSAAAAV2MYNwcLOmV2
        ZW50LXR5cGUHABFjb250ZW50QmxvY2tEZWx0YQ06Y29udGVudC10eXBlBwAQYXBwbGljYXRpb24v
        anNvbg06bWVzc2FnZS10eXBlBwAFZXZlbnR7ImNvbnRlbnRCbG9ja0luZGV4IjoxLCJkZWx0YSI6
        eyJ0b29sVXNlIjp7ImlucHV0IjoieWFcIl19In19LCJwIjoiYWJjZGVmZ2hpamtsbW5vcHFyc3R1
        dnd4eXpBQkNERUZHSElKS0wifbgnxhEAAACgAAAAVpcNtD4LOmV2ZW50LXR5cGUHABBjb250ZW50
        QmxvY2tTdG9wDTpjb250ZW50LXR5cGUHABBhcHBsaWNhdGlvbi9qc29uDTptZXNzYWdlLXR5cGUH
        AAVldmVudHsiY29udGVudEJsb2NrSW5kZXgiOjEsInAiOiJhYmNkZWZnaGlqa2xtbm9wcXJzdHV2
        d3h5ekFCIn1+bPoEAAAApgAAAFGGKdQ9CzpldmVudC10eXBlBwALbWVzc2FnZVN0b3ANOmNvbnRl
        bnQtdHlwZQcAEGFwcGxpY2F0aW9uL2pzb24NOm1lc3NhZ2UtdHlwZQcABWV2ZW50eyJwIjoiYWJj
        ZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNERUZHSElKSyIsInN0b3BSZWFzb24iOiJ0b29sX3Vz
        ZSJ9n3M+RAAAAN0AAABOhSMIFgs6ZXZlbnQtdHlwZQcACG1ldGFkYXRhDTpjb250ZW50LXR5cGUH
        ABBhcHBsaWNhdGlvbi9qc29uDTptZXNzYWdlLXR5cGUHAAVldmVudHsibWV0cmljcyI6eyJsYXRl
        bmN5TXMiOjIyNjB9LCJwIjoiYWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXoiLCJ1c2FnZSI6eyJp
        bnB1dFRva2VucyI6Mjk1LCJvdXRwdXRUb2tlbnMiOjcyLCJ0b3RhbFRva2VucyI6MzY3fX0RljEC
    headers:
      Connection:
      - keep-alive
      Content-Type:
      - application/vnd.amazon.eventstream
      Date:
      - Mon, 26 May 2025 09:23:34 GMT
      Set-Cookie: test_set_cookie
      Transfer-Encoding:
      - chunked
      x-amzn-RequestId:
      - 5a17aca5-e504-4bfa-be2e-3f78a4a9237c
    status:
      code: 200
      message: OK
version: 1
sightseeker

sightseeker commented on May 26, 2025

@sightseeker
Author

stdout

========================================================================================================================== test session starts ==========================================================================================================================
platform darwin -- Python 3.13.3, pytest-7.4.4, pluggy-1.5.0 -- <redacted>/opentelemetry-python-contrib/.tox/py313-test-instrumentation-botocore-1/bin/python3
cachedir: .tox/py313-test-instrumentation-botocore-1/.pytest_cache
rootdir: <redacted>/opentelemetry-python-contrib
configfile: pytest.ini
plugins: vcr-1.0.2
collected 121 items / 120 deselected / 1 selected                                                                                                                                                                                                                       

instrumentation/opentelemetry-instrumentation-botocore/tests/test_botocore_bedrock.py::test_converse_stream_tool_call_parsing_errors FAILED                                                                                                                       [100%]

=============================================================================================================================== FAILURES ================================================================================================================================
_____________________________________________________________________________________________________________ test_converse_stream_tool_call_parsing_errors _____________________________________________________________________________________________________________

span_exporter = <opentelemetry.sdk.trace.export.in_memory_span_exporter.InMemorySpanExporter object at 0x10af46a50>, log_exporter = <opentelemetry.sdk._logs._internal.export.in_memory_log_exporter.InMemoryLogExporter object at 0x10af46ba0>
bedrock_runtime_client = <botocore.client.BedrockRuntime object at 0x10b065e80>, instrument_no_content = <opentelemetry.instrumentation.botocore.BotocoreInstrumentor object at 0x10b614ec0>

    @pytest.mark.skipif(
        BOTO3_VERSION < (1, 35, 56), reason="ConverseStream API not available"
    )
    @pytest.mark.vcr()
    def test_converse_stream_tool_call_parsing_errors(
        span_exporter, log_exporter, bedrock_runtime_client, instrument_no_content
    ):
        # pylint:disable=too-many-locals,too-many-statements
        messages = [
            {
                "role": "user",
                "content": [
                    {
                        "text": "Use the get_cities_list tool to provide exactly 10 popular tourist cities in Japan. Call the tool with a cities array containing: Tokyo, Osaka, Kyoto, Hiroshima, Nara, Yokohama, Sapporo, Fukuoka, Sendai, and Nagoya"
                    }
                ],
            }
        ]
    
        tool_config = {
            "tools": [
                {
                    "toolSpec": {
                        "name": "get_cities_list",
                        "description": "Get a list of cities",
                        "inputSchema": {
                            "json": {
                                "type": "object",
                                "properties": {
                                    "cities": {
                                        "type": "array",
                                        "items": {"type": "string"},
                                    }
                                },
                            }
                        },
                    }
                }
            ]
        }
    
        llm_model_value = "anthropic.claude-3-sonnet-20240229-v1:0"
        response_0 = bedrock_runtime_client.converse_stream(
            messages=messages, modelId=llm_model_value, toolConfig=tool_config
        )
    
        res = ""
        # Process the streaming response - error occurs here
        for chunk in response_0["stream"]:
            if "contentBlockDelta" in chunk:
                delta = chunk["contentBlockDelta"]["delta"]
                if "toolUse" in delta:
                    res += delta["toolUse"].get("input")
    
        # Parse the output and print it
>       print(json.loads(res))

instrumentation/opentelemetry-instrumentation-botocore/tests/test_botocore_bedrock.py:936: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../../.local/share/uv/python/cpython-3.13.3-macos-aarch64-none/lib/python3.13/json/__init__.py:346: in loads
    return _default_decoder.decode(s)
../../../../.local/share/uv/python/cpython-3.13.3-macos-aarch64-none/lib/python3.13/json/decoder.py:345: in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <json.decoder.JSONDecoder object at 0x104a1fb60>, s = '{"cities": ["Tokyo", "Osaka", "Kyoto", "Hiroshima", "Nara", "Yokohama", "Sapporo", "Fukuoka",Sendai, "Nagoya"]}', idx = 0

    def raw_decode(self, s, idx=0):
        """Decode a JSON document from ``s`` (a ``str`` beginning with
        a JSON document) and return a 2-tuple of the Python
        representation and the index in ``s`` where the document ended.
    
        This can be used to decode a JSON document from a string that may
        have extraneous data at the end.
    
        """
        try:
            obj, end = self.scan_once(s, idx)
        except StopIteration as err:
>           raise JSONDecodeError("Expecting value", s, err.value) from None
E           json.decoder.JSONDecodeError: Expecting value: line 1 column 94 (char 93)

../../../../.local/share/uv/python/cpython-3.13.3-macos-aarch64-none/lib/python3.13/json/decoder.py:363: JSONDecodeError
------------------------------------------------------------------------------------------------------------------------- Captured stdout setup -------------------------------------------------------------------------------------------------------------------------
Botocore Instrumentor is enabled with content capture disabled.
=========================================================================================================================== warnings summary ============================================================================================================================
instrumentation/opentelemetry-instrumentation-botocore/tests/test_botocore_bedrock.py::test_converse_stream_tool_call_parsing_errors
  <redacted>/opentelemetry-python-contrib/.tox/py313-test-instrumentation-botocore-1/lib/python3.13/site-packages/botocore/auth.py:424: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
    datetime_now = datetime.datetime.utcnow()

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
============================================================================================================= 1 failed, 120 deselected, 1 warning in 0.84s ==============================================================================================================
py313-test-instrumentation-botocore-1: exit 1 (3.25 seconds) <redacted>/opentelemetry-python-contrib> pytest <redacted>/opentelemetry-python-contrib/instrumentation/opentelemetry-instrumentation-botocore/tests -k test_converse_stream_tool_call_parsing_errors pid=92404
  py313-test-instrumentation-botocore-1: FAIL code 1 (3.30=setup[0.05]+cmd[3.25] seconds)
  evaluation failed :( (3.91 seconds)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @xrmx@sightseeker

      Issue actions

        Bedrock instrumentation strips quotes from JSON strings in ConverseStream tool_use responses (v1.31.0/0.52b0+) · Issue #3537 · open-telemetry/opentelemetry-python-contrib