CloudSketch AI Logo
FeaturesTemplatesPricingEnterpriseAboutContactLog in
πŸŒ™β˜€οΈ
Log inStart free
Home/Templates/AI & Machine Learning

🧠 AI & Machine Learning · Sequence

RAG Question Answering Sequence

What happens when a user asks the document chatbot a question: permission check, embedding, vector search, prompt building and a cited answer.

More AI & Machine Learning templates

Opening a template is free and never counts toward your daily diagrams. Asking the AI to change it counts as one.

Drawing diagram…

What this diagram shows

  • Only documents the user may read are searched
  • Top passages are re-ranked before they go to the model
  • The answer is streamed back with source links

Prompt used

Sequence for a RAG chatbot: the user sends a question to the chat API. The API gets the user's allowed document groups from the identity service, asks the embedding model for a vector, searches the vector store with a permission filter, re-ranks the top 20 passages to keep the best 5, builds a prompt and calls the LLM, then streams the answer with citations back to the user and logs the exchange.

Mermaid code
sequenceDiagram
  actor U as User
  participant API as Chat API
  participant ID as Identity Service
  participant EMB as Embedding Model
  participant VS as Vector Store
  participant RR as Re-ranker
  participant LLM as Language Model
  participant LOG as Chat Log
  U->>API: Ask question
  API->>ID: Get allowed document groups
  ID-->>API: Groups
  API->>EMB: Embed question
  EMB-->>API: Vector
  API->>VS: Top 20 passages in allowed groups
  VS-->>API: Passages
  API->>RR: Re-rank passages
  RR-->>API: Best 5 passages
  API->>LLM: Prompt with question and passages
  LLM-->>API: Answer tokens
  API-->>U: Streamed answer with sources
  API->>LOG: Save question, answer, sources

Inside this diagram

A sequence diagram with 8 participants and 13 messages, in the order they happen.

People

  • User

Systems

  • Chat API
  • Identity Service
  • Embedding Model
  • Vector Store
  • Re-ranker
  • Language Model
  • Chat Log

Steps in order

  • 1. User β†’ Chat API: Ask question
  • 2. Chat API β†’ Identity Service: Get allowed document groups
  • 3. Identity Service β†’ Chat API: Groups (reply)
  • 4. Chat API β†’ Embedding Model: Embed question
  • 5. Embedding Model β†’ Chat API: Vector (reply)
  • 6. Chat API β†’ Vector Store: Top 20 passages in allowed groups
  • 7. Vector Store β†’ Chat API: Passages (reply)
  • 8. Chat API β†’ Re-ranker: Re-rank passages
  • 9. Re-ranker β†’ Chat API: Best 5 passages (reply)
  • 10. Chat API β†’ Language Model: Prompt with question and passages
  • 11. Language Model β†’ Chat API: Answer tokens (reply)
  • 12. Chat API β†’ User: Streamed answer with sources (reply)
  • 13. Chat API β†’ Chat Log: Save question, answer, sources

Make your own diagram like this

Describe your own system in plain English and the AI sequence diagram generator draws it in seconds, in the same style as this template.

Related templates

C4 ArchitectureProAI & Machine Learning

RAG Chatbot over Company Documents

A chatbot that answers staff questions from company documents: documents are split and indexed in a vector database, and each question pulls the most relevant passages before the language model writes an answer.

Data FlowAI & Machine Learning

Document Ingestion for Vector Search

How documents become searchable passages for an AI assistant: extraction, cleaning, chunking, embedding and indexing, with changed files re-processed automatically.

FlowchartAI & Machine Learning

AI Agent Tool-Use Workflow

How an AI agent completes a task by planning, calling tools, checking results and asking a person to approve risky actions before it finishes.

DeploymentProAI & Machine Learning

MLOps Model Training Pipeline

Where each part of an MLOps setup runs: feature store, training jobs on GPU nodes, experiment tracking, model registry and automated deployment to serving.

State MachineAI & Machine Learning

ML Model Lifecycle

The states a machine learning model moves through, from experiment to production to retirement, including rollback when live performance drops.

C4 ArchitectureProAI & Machine Learning

LLM Gateway with Cost and Safety Controls

One gateway that every app in a company uses to reach language models: it applies budgets, rate limits, content filters and caching, and records usage per team.