You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the instrumentation of bedrock, the responses are not being handled properly, for example the response from amazon.titan-embed-image-v1 when not returning the 'results' field returns the error sum(int(result.get("tokenCount")) for result in response_body.get("results")), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: 'NoneType' object is not iterable
👟 Reproduction steps
Execute the model invocation: amazon.titan-embed-image-v1
👍 Expected behavior
It should correctly return the information in the trace spans and metrics
👎 Actual Behavior with Screenshots
It currently returns an exception
🤖 Python Version
3.11
📃 Provide any additional context for the Bug.
No response
👀 Have you spent some time to check if this bug has been raised before?
I checked and didn't find similar issue
Are you willing to submit PR?
Yes I am willing to submit a PR!
The text was updated successfully, but these errors were encountered:
Hey there, @naghost-dev! 👋 I'm here to help you with bug fixes, answer your questions, and guide you on becoming a contributor. Let's work together to resolve this issue.
The error you're encountering is due to the response_body.get("results") returning None, which leads to a TypeError when trying to iterate over it. To handle this, you can modify the _set_amazon_span_attributes function to check if response_body.get("results") is None before attempting to iterate over it. Here's a possible solution:
This modification checks if results is None before iterating over it, preventing the TypeError. You can implement this change and test it to ensure it resolves the issue.
Which component is this bug for?
Bedrock Instrumentation
📜 Description
Currently, the instrumentation of bedrock, the responses are not being handled properly, for example the response from amazon.titan-embed-image-v1 when not returning the 'results' field returns the error
sum(int(result.get("tokenCount")) for result in response_body.get("results")), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: 'NoneType' object is not iterable
👟 Reproduction steps
👍 Expected behavior
It should correctly return the information in the trace spans and metrics
👎 Actual Behavior with Screenshots
It currently returns an exception
🤖 Python Version
3.11
📃 Provide any additional context for the Bug.
No response
👀 Have you spent some time to check if this bug has been raised before?
Are you willing to submit PR?
Yes I am willing to submit a PR!
The text was updated successfully, but these errors were encountered: