Showing posts with label AI. Show all posts
Showing posts with label AI. Show all posts

Saturday, March 21, 2026

AI | Application Architecture with Bedrock

Amazon Bedrock architecture consists of a client application that sends prompts through an API layer to the Bedrock service, which processes the request using selected foundation models, optionally enriches it using knowledge bases (RAG), applies guardrails, and returns the generated response back to the user.

Step-by-Step Explanation

1. User / Application Layer

This is where interaction starts:

  • Web app (chatbot UI)
  • Mobile app
  • Backend service

User sends:

  • Prompt (e.g., “Explain AI”)
  • Query (e.g., search in documents)

2. Frontend / API Layer

Handles request input:

  • UI collects input
  • Sends request via API

Common AWS tools used:

  • API Gateway
  • SDK (Python, Java, JS)

3. Application Layer (Backend Logic)

This layer prepares the request before sending to Bedrock:

Tasks:

  • Format prompt
  • Add system instructions
  • Manage session memory
  • Call Bedrock API

Example:

User: "Summarize this document"
Backend adds:
"You are a helpful assistant..."

Amazon Bedrock Core Layer 🧠

This is the main engine.

(A) Model Selection Layer

You choose which model to use:

  • Claude
  • Titan
  • Llama
    etc.

Same API → different models


(B) Prompt Processing

Bedrock processes:

  • Input prompt
  • Context (chat history)
  • Retrieved documents (if RAG)


(C) Foundation Models (FMs)

Actual AI models generate output:

Types:

  • Text models (chat, code)
  • Image models
  • Embedding models

(D) Agents (Optional but powerful)

Agents can:

  • Call APIs
  • Query databases
  • Perform tasks

Example:

User: Book a ticket
Agent → calls booking API → returns result

(E) Guardrails & Security

Controls:

  • Content filtering
  • Data privacy
  • Access control

Ensures:

  • Safe responses
  • No harmful output

5. Knowledge Base (RAG Layer)

If enabled, Bedrock uses:

  • Vector database
  • Embeddings

Flow:

User question → Search documents → Retrieve relevant info → Send to model

Connected data sources:

  • S3 (PDFs, docs)
  • Databases
  • APIs

6. Data Sources Layer

Where actual data is stored:

  • Files (PDF, Word)
  • Company databases
  • External APIs

7. Response Generation

Model generates:

  • Text answer
  • Image
  • Structured output

8. Response Back to User

Final output goes back through:

Bedrock → Backend → Frontend → User

Full Flow 
User Input

Frontend UI

Backend (adds context)

Bedrock API

Model + Knowledge Base

Generated Response

User

Key Components Summary

ComponentPurpose
FrontendUser interaction
BackendPrompt processing
BedrockAI engine
ModelsGenerate output
Knowledge BaseLong-term memory
AgentsAutomation
GuardrailsSafety

AI | Bedrock

Amazon Bedrock is a fully managed AWS service that allows developers to build generative-AI applications using multiple foundation models with built-in memory, model customization, security, and agents through a single API.

Bedrock is an AWS service used to build generative-AI apps (chatbots, assistants, search, RAG, image generation, etc.) without training models or managing GPUs. Below is a clear explanation focusing especially on main features, models, memory (context), and how it works.




1) What Amazon Bedrock is (simple definition)

According to the official AWS docs, Amazon Bedrock is a fully managed service that gives access to multiple foundation models (FMs) through a single API and lets you build AI apps securely on AWS.

That means:

  • You don’t train the model yourself
  • You just choose a model → send a prompt → get a response
  • AWS manages scaling, GPUs, and infrastructure.

2) Main Features of Amazon Bedrock 

(A) Multiple foundation models in one place

Instead of using only one AI model, Bedrock gives you many models from different companies in a single platform.

Examples of supported providers:

  • Amazon (Titan / Nova models)
  • Anthropic (Claude models)
  • Meta (Llama models)
  • AI21 Labs
  • Cohere
  • Stability AI
  • Mistral, DeepSeek, etc.

So if one model is not good for your use case, you can switch without changing your code much.


(B) Single API for all models

You can call different models using the same API.

Example:

  • Today you use Claude
  • Tomorrow you switch to Titan or Llama
    → Your application code stays mostly the same.

(C) Model customization (very important feature)

You can improve a model using your own data:

  1. Fine-tuning
    • Train a copy of the model using your dataset
  2. RAG (Retrieval Augmented Generation)
    • Instead of training, you connect documents (PDFs, websites, database)
  3. Knowledge Bases
    • Bedrock automatically stores documents, creates embeddings, and retrieves them when users ask questions.

This is used for:

  • Chat with company documents
  • AI customer support
  • Enterprise search
  • Internal knowledge bots

(D) Agents (AI that can perform tasks)

Bedrock supports Agents, meaning AI can:

  • Read data
  • Call APIs
  • Perform actions (like booking, searching database, sending emails)

AWS even provides:

  • Memory
  • Tool usage
  • Authentication
  • Monitoring for AI agents.

(E) Built-in security and privacy 

AWS clearly states:

  • Your data is not used to train the original models
  • Data stays inside your AWS account
  • Works with VPC (private network).


3) Models in Amazon Bedrock

Bedrock supports 100+ foundation models in a single catalog.

Main types of models available:

(1) Text / Chat models

Examples:

  • Claude (Anthropic)
  • Amazon Titan Text
  • Llama models
  • AI21 Jamba
  • Cohere Command

Used for:

  • Chatbots
  • Summarization
  • Code generation
  • Content writing

(2) Image generation models

Examples:

  • Titan Image Generator
  • Stability AI models

Used for:

  • AI images
  • Marketing creatives
  • Design automation

(3) Embedding models

These convert text into vectors (numbers).

Used for:

  • Semantic search
  • RAG
  • Recommendation systems

4) Memory in Amazon Bedrock

There are 3 types of memory used in Bedrock:

(A) Context window (model memory)

This is how much text the model can remember in one prompt.

Example:

  • Some Claude models support very long context (like 200k tokens) → useful for large PDFs.

So if you give:

  • Long document
  • Research paper
  • Entire chat history
    → The model can still understand it.

(B) Session memory (conversation memory)

Bedrock supports multi-turn conversations, meaning the model remembers previous messages in the same chat session.

Example:
User: Explain Python
User: Now give example
User: Now optimize the code

The model remembers the previous messages.


(C) Knowledge-base memory (long-term memory)

This is used when you connect:

  • PDFs
  • Documents
  • Database
  • Company knowledge

Bedrock stores the data in a vector database and retrieves it when needed.

This works like:

  • Long-term memory for AI apps

5) Why companies use Amazon Bedrock

Because it provides:

  • No GPU setup
  • Multiple AI models in one place
  • Easy scaling
  • Secure enterprise environment
  • Supports chatbots + RAG + agents + image AI together

Node | process.nextclick

process.nextTick() schedules a callback to run immediately after the current operation , before the event loop continues . It runs: Befor...