??100 Days of Generative AI - Building Your First RAG Application using AWS Bedrock Knowledge Bases - Day 9 ??

??100 Days of Generative AI - Building Your First RAG Application using AWS Bedrock Knowledge Bases - Day 9 ??

Yesterday, we explored how to create an Retrieval Augmented Generation(RAG) application using open-source tools like Hugging Face, GPT-2, and VectorDB. However, as you might have noticed, this approach requires some coding skills and familiarity with various tools. But what if you could have your RAG application up and running with just a few clicks?

https://www.dhirubhai.net/pulse/100-days-generative-ai-building-your-first-rag-using-lakhera-rw3mc/

First, let's start with AWS Bedrock, a managed service provided by AWS for working with large language models (LLMs). The Knowledge Base is a feature within the Bedrock service that simplifies the creation and management of knowledge bases to enhance the capabilities of foundational models for various tasks, such as RAG.

Here is the step by step process

  1. Login to AWS Bedrock Console https://aws.amazon.com/bedrock/
  2. Click on "Knowledge Bases" in the left-hand menu, then select "Create Knowledge Base."


3. Provide a name for your knowledge base and create an IAM role for it.


4. This is where you can select the data source to upload your documents.

NOTE: All data source options except S3 are currently in Preview state.

Keep the settings at their default and click "Next."


5. In the next step, you'll need to specify the S3 bucket where your documents will be uploaded.


Supported Document Formats


Ref:

NOTE: AWS Bedrock currently supports specific document formats, with a maximum file size of 50MB

If you stick with the default configuration, the chunking strategy will split the content into chunks of up to 300 tokens.

If you opt for custom chunking and parsing configurations, you can use a foundation model (currently, the only supported model is Claude). However, note that in advanced parsing, only PDF files are supported.



AWS offers five different chunking strategies, but you'll need to write your own Lambda function to implement them.


6: In this step, you'll select the embedding model. Currently, only the Titan and Cohere models are supported. If you choose the Titan model, you'll also have the option to set the vector dimension.


  • Next, you'll choose the vector database. If you go with the default option, AWS will create an Amazon OpenSearch Serverless vector store for you. However, you also have the option to select from five different vector stores.


Note: This will incur a cost.

7. Review all the settings and click "Create" to finalize your knowledge base.

NOTE: Knowledge base creation is not supported for root users. You must be logged in as a regular user to create a knowledge base.


8. Once your knowledge base is created, you’ll see it listed. Don't forget this crucial step: Go to the data source and sync the data. This ensures that the newly uploaded documents are indexed and made available for retrieval by the foundational models.



NOTE: You need to perform a data synchronization (data sync) every time you upload new documents to the knowledge base in AWS Bedrock. This ensures that all new documents are indexed and accessible.

9. Before using your data, you need to select a model. Currently, only the Anthropic model is supported.


  • Currently only anthropic model is supported

Here you go


Your knowledge base is now ready! One of the features I appreciate most is the "Show source details" option, which provides source information when you click on it.


As you can see, AWS makes it easy to get started with RAG without requiring any coding expertise.

Feedback for AWS:

  1. Expand Data Source Options: It would be beneficial to see more data sources available, and it would be great if the ones currently in preview could be moved to a stable, production-ready state soon.
  2. Increase File Size Limit for Chunking: The current 50MB file size limit for chunking is restrictive. Increasing this limit would greatly enhance the usability of the service for larger files.
  3. Support for More File Types in Advanced Parsing: Currently, only PDFs are supported for advanced parsing. Adding support for more file types would make the service more versatile.
  4. Enhance Embedding Model Options: At present, only Titan and Cohere models are supported for embedding. It would be fantastic if AWS could allow users to bring their own models from Hugging Face for more flexibility.
  5. Support for Additional Vector Databases: Expanding support to include more vector databases, such as ChromaDB, would provide users with greater choice and flexibility.


While the service is still in its early stages, there is great potential for improvement. As a customer-centric company, I’m confident AWS will listen to customer feedback and continue to enhance its offerings.


?? If you’d like to learn more about this topic, please check out my book. Building an LLMOps Pipeline Using Hugging Face

https://pratimuniyal.gumroad.com/l/BuildinganLLMOpsPipelineUsingHuggingFace



Hrijul Dey

Enterprise Local AI developer

1 个月

**Generate Meaningful Responses with RAG** Chunking supports RAG in generating context-aware and relevant outputs. #RAG #chunking #generation #NLP https://www.artificialintelligenceupdate.com/boost-llms-rag-performance-with-chunking/riju/ #learnmore

回复

要查看或添加评论,请登录

社区洞察