Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

🎓 Intelligent L&D App (Bedrock Knowledge Bases)

AWS Bedrock OpenSearch Python

📖 Overview

This application transforms static PDF training documents into an interactive Learning & Development (L&D) Coach. Unlike traditional search, it uses Amazon Bedrock Knowledge Bases (a fully managed RAG service) to retrieve context and generate personalized learning paths.

🚀 Key Features

  • Managed RAG Pipeline: No need to manage LangChain splitters or vector stores manually; Bedrock handles the ingestion.
  • Citation Support: Responses include references to the specific source document (page numbers/sections).
  • Hybrid Search: Uses OpenSearch Serverless for accurate semantic retrieval.

🏗️ Architecture

Architecture

🛠️ Prerequisites

  1. AWS Bedrock Knowledge Base: You must create a Knowledge Base in the AWS Console and sync it with an S3 bucket containing your PDFs.
  2. OpenSearch Serverless: (Automatically created during KB setup).
  3. Model Access: Enable Claude 2.1 or Titan Embeddings.

💻 Installation & Usage

# Clone and Setup
git clone https://github.com/phanikolla/GenAI_Projects.git
cd Knowledgebase_Project
pip install -r requirements.txt

Python Implementation:

import boto3

client = boto3.client('bedrock-agent-runtime')

response = client.retrieve_and_generate(
    input={'text': 'Create a 3-day learning path for Python beginners'},
    retrieveAndGenerateConfiguration={
        'type': 'KNOWLEDGE_BASE',
        'knowledgeBaseConfiguration': {
            'knowledgeBaseId': 'YOUR-KB-ID',
            'modelArn': 'arn:aws:bedrock:us-east-1::foundation-model/anthropic.claude-v2'
        }
    }
)

print(response['output']['text'])

🧠 Key Learnings

  • Managed vs. Manual RAG: In previous projects, I manually chunked text and stored it in FAISS. Using Bedrock Knowledge Bases reduced the code by ~60% and provided built-in auto-syncing with S3.
  • Prompt Engineering: To get a "Learning Path" rather than just a summary, I had to adjust the system prompt to act as an "Educational Coach" rather than a "Librarian."

Maintained by Phani Kolla