Retrieval-augmented generation with open components
RAG with open components: an ingestion lane chunks and embeds documents into Qdrant, and a React, FastAPI and LangChain query lane answers with a local Ollama model or a hosted one, traced in Langfuse.
logossitabler14 nodes2 groups14 edges
rag-open-source.yamlOn GitHub
# yaml-language-server: $schema=../references/diagram.schema.json
title: Retrieval-augmented generation with open components
subtitle: Documents are chunked and embedded into Qdrant; a FastAPI and LangChain backend retrieves context and answers with a local Ollama model or a hosted one
# Top to bottom: the ingestion lane, the embedding model and Qdrant that both lanes share, then the
# query lane and what only queries use. Each lane is one row (`align`), so neither lane's edges cross the other's.
direction: down
# One port per edge, so the upsert and search edges into Qdrant keep their own labels.
layout: { merge: false }
legend:
solid: Data flow
dashed: Alternative model
dotted: Tracing
groups:
# Two lanes so the flows do not interleave. The embedding model and Qdrant serve both lanes, and the
# answer cache, the answer models and tracing serve queries only, so all of them sit outside the lanes.
ingestion: { type: zone, label: Ingestion }
query: { type: zone, label: Query }
nodes:
docs: { icon: generic:files, label: Documents, note: "PDF, HTML, Markdown", in: ingestion }
loaders: { icon: tabler:file-import, label: Loaders, note: Parse and clean, in: ingestion, align: docs }
chunker: { icon: tabler:file-scissors, label: Chunking, note: 512-token chunks, in: ingestion, align: docs }
embedder: { icon: tabler:chart-scatter-3d, label: Embedding, note: Embed and upsert, in: ingestion, align: docs }
# bge-m3 is a BAAI model, so it gets a neutral glyph rather than a Hugging Face mark.
bge: { icon: tabler:brain, label: bge-m3, note: Embeds chunks and queries }
qdrant: { icon: logos:qdrant-icon, label: Qdrant, note: Vector database }
user: { icon: generic:user, label: User, in: query }
react: { icon: logos:react, label: React, note: Chat UI, in: query, align: user }
fastapi: { icon: logos:fastapi-icon, label: FastAPI, note: Chat server, in: query, align: user }
langchain: { icon: logos:langchain-icon, label: LangChain, note: Retrieval chain, in: query, align: user }
redis: { icon: logos:redis, label: Redis, note: Answer cache }
ollama: { icon: si:ollama, label: Ollama, note: Local LLM }
hosted: { icon: generic:cloud, label: Hosted model API, note: OpenAI-compatible }
# No Langfuse mark in the packs: a neutral glyph with the product name.
langfuse: { icon: generic:monitoring, label: Langfuse, note: Traces and evals }
edges:
- docs -> loaders -> chunker -> embedder
- embedder -> bge: embed chunks
- embedder -> qdrant: upsert
- user -> react -[POST /chat]-> fastapi
- fastapi -> langchain
- fastapi -> redis: cache lookup
# Written in layout order with the arrow flipped, so the shared services sit above the query lane.
- { from: bge, to: langchain, arrow: start, label: embed query }
- { from: qdrant, to: langchain, arrow: start, label: search }
- langchain -> ollama: prompt and context
- langchain --> hosted: alternative
- langchain ..> langfuse: tracesStart from this one
Copies the spec to diagram.yaml, then renders every format.
$ orrery init rag-open-source$ orrery render diagram.yaml -f all --theme both