-
Notifications
You must be signed in to change notification settings - Fork 863
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
Amazon.Runtime.Documents.InvalidDocumentTypeConversionException #3694
Comments
Downgraded to v3.7.421.5 and it still persists. |
@phspies Good afternoon. Could you please share self-contained code to reproduce the issue? I notice that you are using |
@phspies Good morning. I tried testing the below code in a Console application and stepped into RetrieveAndGenerateRequestMarshaller while debugging via Visual Studio: using Amazon.BedrockAgentRuntime;
using Amazon.BedrockAgentRuntime.Model;
var client = new AmazonBedrockAgentRuntimeClient();
var retrieveAndGenerateRequest = new RetrieveAndGenerateRequest()
{
Input = new RetrieveAndGenerateInput()
{
Text = "what is the diagrams about"
},
RetrieveAndGenerateConfiguration = new RetrieveAndGenerateConfiguration()
{
Type = RetrieveAndGenerateType.KNOWLEDGE_BASE,
KnowledgeBaseConfiguration = new KnowledgeBaseRetrieveAndGenerateConfiguration()
{
KnowledgeBaseId = "",
ModelArn = "",
RetrievalConfiguration = new KnowledgeBaseRetrievalConfiguration()
{
VectorSearchConfiguration = new KnowledgeBaseVectorSearchConfiguration()
{
Filter = new RetrievalFilter()
{
AndAll = new List<RetrievalFilter>()
{
new RetrievalFilter()
{
Equals = new FilterAttribute()
{
Key = "TeamId",
Value = new Amazon.Runtime.Documents.Document("TestTeamId")
}
},
new RetrievalFilter()
{
Equals = new FilterAttribute()
{
Key = "MeetingId",
Value = new Amazon.Runtime.Documents.Document("TestMeetingId")
}
}
}
}
}
}
}
}
};
var response = await client.RetrieveAndGenerateAsync(retrieveAndGenerateRequest);
Console.Read(); Inspecting the value of request JSON generated here, it had the below contents: {
"input": {
"text": "what is the diagrams about"
},
"retrieveAndGenerateConfiguration": {
"knowledgeBaseConfiguration": {
"knowledgeBaseId": "",
"modelArn": "",
"retrievalConfiguration": {
"vectorSearchConfiguration": {
"filter": {
"andAll": [
{
"equals": {
"key": "TeamId",
"value": "TestTeamId"
}
},
{
"equals": {
"key": "MeetingId",
"value": "TestMeetingId"
}
}
]
}
}
}
},
"type": "KNOWLEDGE_BASE"
}
} Could you please share the self-contained reproducible code as a Lambda project that we could use to troubleshoot the issue? Most likely it is a serializer issue. Thanks, |
Describe the bug
When using the the RetrievalFilter class for a Bedrock KnowledgeBase request it seems the key, value requires that you use the Amazon.Runtime.Documents.Document class within the filter structure. When attempting to use this filtering class the KnowledgeBase service seemed to ignore my filters but after further investigation, it seems the document class cannot be serialized. While trying to troubleshoot the problem I got this exception:
Amazon.Runtime.Documents.InvalidDocumentTypeConversionException: Cannot Convert DocumentType to List because it is String
I tried using this Document class multiple ways but it fails all the same:
This also fails
When I serialize the object using Serliog's internal serializer, it works but my filter values are empty:
Regression Issue
Expected Behavior
Document class needs to serializable and should pass the Value defined into the payload.
Current Behavior
Document object is not serializable.
Reproduction Steps
In the details above.
Possible Solution
No response
Additional Information/Context
No response
AWS .NET SDK and/or Package version used
4.0.0-Preview5
Targeted .NET Platform
.Net 8.0
Operating System and version
Lambda
The text was updated successfully, but these errors were encountered: