- Newest
- Most votes
- Most comments
When you configure a custom transformation Lambda function with Amazon Bedrock Knowledge Bases, the knowledge base uses the processed chunks from your Lambda function's output location in S3, not the pre-processed chunks. The system should be ingesting the modified chunks that your Lambda function writes back to the S3 bucket.
Based on your configuration, you're using hierarchical chunking with a post-chunking transformation Lambda function. The expected flow is: the knowledge base applies hierarchical chunking first, stores those chunks in your intermediate S3 location, invokes your Lambda function to add the "MODIFIED BY CUSTOM TRANSFORMATION" text, and then ingests the modified chunks from the output location into the vector store.
Since your sync history shows success and your S3 output location contains the modified chunks, but your vector store queries are returning the original unmodified chunks, this suggests a potential issue with how the transformation is being applied or referenced. Here are some things to verify:
- Ensure your Lambda function is correctly configured in the CustomTransformationConfiguration with the stepToApply set to "POST_CHUNKING"
- Verify that your Lambda function is returning the chunks in the correct format expected by the knowledge base API contract
- Check that the intermediate storage S3 location specified in your configuration matches where your Lambda function is writing the output
- Confirm your Lambda function has the necessary permissions to read from and write to the S3 bucket
- Review your Lambda function's CloudWatch logs to ensure it's being invoked successfully and completing without errors
The knowledge base should be using your processed chunks, so if unmodified chunks are appearing in the vector store, there may be an issue with the Lambda function execution or configuration that's causing the system to fall back to the pre-processed chunks.
Sources
Use a custom transformation Lambda function to define how your data is ingested - Amazon Bedrock
CustomTransformationConfiguration - Amazon Bedrock
Customize ingestion for a data source - Amazon Bedrock
answered 2 months ago
I don't know how Knowledge base connects with the S3 Vector bucket. But it turns out the modified chunks after my post processing is indeed inserted in the destination vector store. I created a python script to use the s3 vector bucket and index to query the modified chunk and the modified chunk was returned. However if I used boto3 with knowledge base id only it returns the pre processed chunk as result.
In short, I used boto3 with s3vectors bucket name and index to retreived the processed chunks and it works.
answered 2 months ago
Relevant content
asked 2 years ago
asked 2 years ago
