Skip to content
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

IngestKnowledgeBaseDocumentsRequest Missing ContentType Control #3634

Open
1 task
phspies opened this issue Feb 3, 2025 · 0 comments
Open
1 task

IngestKnowledgeBaseDocumentsRequest Missing ContentType Control #3634

phspies opened this issue Feb 3, 2025 · 0 comments
Labels
bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.

Comments

@phspies
Copy link

phspies commented Feb 3, 2025

Describe the bug

Seems the the ingest API requires the header for this request to be set to the correct type for the import to work. The IngestKnowledgeBaseDocumentsRequest doesn't have any attributes to control the ContentType.

Link to API Documentation: https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent_IngestKnowledgeBaseDocuments.html

The dataSourceType that you specified in CUSTOM doesn't match the type of the data source specified in the request header. Check that both types match and retry your request.

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

IngestKnowledgeBaseDocumentsRequest needs to offer a content type attribute to be used in the API call.

Current Behavior

The dataSourceType that you specified in CUSTOM doesn't match the type of the data source specified in the request header. Check that both types match and retry your request.

Reproduction Steps

IngestKnowledgeBaseDocumentsRequest documentsRequest = new IngestKnowledgeBaseDocumentsRequest()
            {
                DataSourceId = Environment.GetEnvironmentVariable("BEDROCK_KB_DATASOURCE_ID"),
                KnowledgeBaseId = Environment.GetEnvironmentVariable("BEDROCK_KB_ID"),
                Documents = new()
                {
                    new()
                    {
                        Content = new()
                        {
                            DataSourceType = ContentDataSourceType.CUSTOM,
                            Custom = new()
                            {
                                CustomDocumentIdentifier = new()
                                {
                                    Id = dbMeetingRecord.Id.ToString()
                                },
                                InlineContent = new InlineContent()
                                {
                                    ByteContent = new ByteContentDoc()
                                    {
                                        Data = new MemoryStream(Encoding.UTF8.GetBytes(dbMeetingRecord.MeetingNotes)),
                                        MimeType = "text/plain"
                                    },
                                    TextContent = new TextContentDoc()
                                    {
                                        Data = dbMeetingRecord.MeetingNotes
                                    },
                                    Type = InlineContentType.TEXT
                                },
                                SourceType = CustomSourceType.IN_LINE
                            }
                        },
                        Metadata = new()
                        {
                            Type = MetadataSourceType.IN_LINE_ATTRIBUTE,
                            InlineAttributes = new()
                            {
                                new()
                                {
                                    Key = "TeamId", Value = new MetadataAttributeValue()
                                    {
                                        StringValue = dbMeetingRecord.TeamId.ToString(),
                                        Type = MetadataValueType.STRING
                                    }
                                },
                                new()
                                {
                                    Key = "MeetingId", Value = new MetadataAttributeValue()
                                    {
                                        StringValue = dbMeetingRecord.Id.ToString(),
                                        Type = MetadataValueType.STRING
                                    }
                                }
                            }
                        }
                    }
                }
            };
            IngestKnowledgeBaseDocumentsResponse ingestResponse = await _amazonBedrockAgent.IngestKnowledgeBaseDocumentsAsync(documentsRequest);

Possible Solution

No response

Additional Information/Context

No response

AWS .NET SDK and/or Package version used

4.0.0 Preview 5

Targeted .NET Platform

.Net Core 8

Operating System and version

Lambda

@phspies phspies added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

No branches or pull requests

1 participant