-
Notifications
You must be signed in to change notification settings - Fork 873
Description
Describe the bug
We've just hit a NullReferenceException in our code because the nullability annotations on Amazon.BedrockAgentRuntime.Model.RetrieveAndGenerateResponse indicate that GuardrailAction is not nullable; yet it returns null in certain cases.
This seems to happen when we add manual filters for the kb that don't match anything. If there is no guardrail action and a query submits successfully GuardrailAction isn't null, and the Value is "NONE"
Regression Issue
- Select this option if this issue appears to be a regression.
Expected Behavior
response.GuardrailAction should never be null (as per nullability annotations).
GuardrailAction.Value should be "NONE" to be consistent with what happens when a successful query is sent.
Current Behavior
RetrieveAndGenerateResponse.GuardrailAction is null
Reproduction Steps
- Submit a RetrieveAndGenerateRequest with filters that match no objects in the kb
- Observe that
response.GuardrailActionisnull
Possible Solution
Ideally, ensure that GuardrailAction != null && GuardrailAction.Value == "NONE" in this case.
A worse solution would just be to use the nullability annotations
Additional Information/Context
No response
AWS .NET SDK and/or Package version used
AWSSDK.BedrockAgentRuntime v4.0.4.3
Targeted .NET Platform
dotnet 8
Operating System and version
Windows 11, Arch Linux, Ubuntu
