# arbazkhan-cs/genai architecture

> Architecture diagram of the GitHub repository arbazkhan-cs/genai, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/arbazkhan-cs/genai
- Repository: https://github.com/arbazkhan-cs/genai

## Overview

This repository is a collection of hands-on LangChain tutorials, not one integrated application. Its clearest end-to-end product example is the Streamlit web Q&A app: a user submits a URL and question, the app loads page text, passes it with the question through a prompt and chat model, then displays the parsed answer. Other tutorials cover model providers, prompt and chain composition, retrieval, embeddings, and structured output as separate examples. The graph preserves those documented branches; most tutorial files are standalone, so no shared pipeline is implied.

Main entry points: [`RAG/DocumentLoader/6_app.py`](https://github.com/arbazkhan-cs/genai/blob/main/RAG/DocumentLoader/6_app.py) (Web Q&A App), [`EmbeddingModels`](https://github.com/arbazkhan-cs/genai/tree/main/EmbeddingModels) (Embedding Models), [`RAG/Retrievers/3_mmr_retriever.py`](https://github.com/arbazkhan-cs/genai/blob/main/RAG/Retrievers/3_mmr_retriever.py) (MMR Retrieval), [`RAG/Retrievers/4_multi_query_retriever.py`](https://github.com/arbazkhan-cs/genai/blob/main/RAG/Retrievers/4_multi_query_retriever.py) (Multi-Query Retrieval)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web_qa["Web Q&amp;A"]
  node_web_app["Web Q&amp;A App<br/>[6_app.py]"]
  node_page_loader["Web Page Loader<br/>[6_app.py]"]
  node_web_prompt["Answer Prompt<br/>[6_app.py]"]
end

subgraph group_composition["Prompt Composition"]
  node_sequential_chain["Sequential Chain"]
  node_parallel_chain["Parallel Chain"]
  node_conditional_chain["Conditional Chain"]
  node_runnables["Runnable Patterns"]
  node_prompt_templates["Prompt Templates"]
end

subgraph group_rag["Retrieval Tutorials"]
  node_embedding_models["Embedding Models"]
  node_document_loaders["Document Loaders"]
  node_text_splitters["Text Splitters"]
  node_vector_retrieval["Vector Retrieval"]
  node_mmr_retrieval["MMR Retrieval<br/>[3_mmr_retriever.py]"]
  node_multi_query["Multi-Query Retrieval"]
  node_compression["Contextual Compression"]
end

subgraph group_models["Model Providers"]
  node_groq_chat["Groq Chat Model<br/>[6_app.py]"]
  node_chat_models["Chat Model Examples"]
end

subgraph group_outputs["Output Formats"]
  node_string_parser["String Parser<br/>[6_app.py]"]
  node_output_parsers["Output Parser Examples"]
  node_structured_output["Structured Output"]
end

node_user(("Questioner"))

node_user -->|"submits URL and question"| node_web_app
node_web_app -->|"loads page text"| node_page_loader
node_web_app -->|"creates prompt"| node_web_prompt
node_web_app -->|"invokes model"| node_groq_chat
node_web_app -->|"parses answer"| node_string_parser
node_web_app -->|"composes processing chain"| node_runnables
node_mmr_retrieval -->|"embeds documents"| node_embedding_models
node_mmr_retrieval -->|"builds vector store"| node_vector_retrieval
node_multi_query -->|"embeds documents"| node_embedding_models
node_multi_query -->|"uses query model"| node_groq_chat
node_compression -->|"embeds documents"| node_embedding_models
node_compression -->|"uses compressor model"| node_groq_chat

click node_web_app "https://github.com/arbazkhan-cs/genai/blob/main/RAG/DocumentLoader/6_app.py"
click node_page_loader "https://github.com/arbazkhan-cs/genai/blob/main/RAG/DocumentLoader/6_app.py"
click node_web_prompt "https://github.com/arbazkhan-cs/genai/blob/main/RAG/DocumentLoader/6_app.py"
click node_groq_chat "https://github.com/arbazkhan-cs/genai/blob/main/RAG/DocumentLoader/6_app.py"
click node_string_parser "https://github.com/arbazkhan-cs/genai/blob/main/RAG/DocumentLoader/6_app.py"
click node_sequential_chain "https://github.com/arbazkhan-cs/genai/blob/main/Chains/1_sequential_chain.py"
click node_parallel_chain "https://github.com/arbazkhan-cs/genai/blob/main/Chains/2_parallel_chain.py"
click node_conditional_chain "https://github.com/arbazkhan-cs/genai/blob/main/Chains/3_conditional_chain.py"
click node_runnables "https://github.com/arbazkhan-cs/genai/tree/main/Runnables"
click node_prompt_templates "https://github.com/arbazkhan-cs/genai/tree/main/Prompts"
click node_chat_models "https://github.com/arbazkhan-cs/genai/tree/main/ChatModels"
click node_embedding_models "https://github.com/arbazkhan-cs/genai/tree/main/EmbeddingModels"
click node_document_loaders "https://github.com/arbazkhan-cs/genai/tree/main/RAG/DocumentLoader"
click node_text_splitters "https://github.com/arbazkhan-cs/genai/tree/main/RAG/TextSplitter"
click node_vector_retrieval "https://github.com/arbazkhan-cs/genai/blob/main/RAG/Retrievers/2_vector_store_retriever.py"
click node_mmr_retrieval "https://github.com/arbazkhan-cs/genai/blob/main/RAG/Retrievers/3_mmr_retriever.py"
click node_multi_query "https://github.com/arbazkhan-cs/genai/blob/main/RAG/Retrievers/4_multi_query_retriever.py"
click node_compression "https://github.com/arbazkhan-cs/genai/blob/main/RAG/Retrievers/5_contextual_compression_retriever.py"
click node_output_parsers "https://github.com/arbazkhan-cs/genai/tree/main/OutputParsers"
click node_structured_output "https://github.com/arbazkhan-cs/genai/tree/main/StructuredOutput"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_web_app,node_page_loader,node_web_prompt toneBlue
class node_sequential_chain,node_parallel_chain,node_conditional_chain,node_runnables,node_prompt_templates toneAmber
class node_embedding_models,node_document_loaders,node_text_splitters,node_vector_retrieval,node_mmr_retrieval,node_multi_query,node_compression toneMint
class node_groq_chat,node_chat_models toneRose
class node_string_parser,node_output_parsers,node_structured_output,node_user toneIndigo
```

## Components

### Web Q&A

- [Web Q&A App](https://github.com/arbazkhan-cs/genai/blob/main/RAG/DocumentLoader/6_app.py): `RAG/DocumentLoader/6_app.py`
- [Web Page Loader](https://github.com/arbazkhan-cs/genai/blob/main/RAG/DocumentLoader/6_app.py): `RAG/DocumentLoader/6_app.py`
- [Answer Prompt](https://github.com/arbazkhan-cs/genai/blob/main/RAG/DocumentLoader/6_app.py): `RAG/DocumentLoader/6_app.py`

### Prompt Composition

- [Sequential Chain](https://github.com/arbazkhan-cs/genai/blob/main/Chains/1_sequential_chain.py): `Chains/1_sequential_chain.py`
- [Parallel Chain](https://github.com/arbazkhan-cs/genai/blob/main/Chains/2_parallel_chain.py): `Chains/2_parallel_chain.py`
- [Conditional Chain](https://github.com/arbazkhan-cs/genai/blob/main/Chains/3_conditional_chain.py): `Chains/3_conditional_chain.py`
- [Runnable Patterns](https://github.com/arbazkhan-cs/genai/tree/main/Runnables): `Runnables`
- [Prompt Templates](https://github.com/arbazkhan-cs/genai/tree/main/Prompts): `Prompts`

### Retrieval Tutorials

- [Embedding Models](https://github.com/arbazkhan-cs/genai/tree/main/EmbeddingModels): `EmbeddingModels`
- [Document Loaders](https://github.com/arbazkhan-cs/genai/tree/main/RAG/DocumentLoader): `RAG/DocumentLoader`
- [Text Splitters](https://github.com/arbazkhan-cs/genai/tree/main/RAG/TextSplitter): `RAG/TextSplitter`
- [Vector Retrieval](https://github.com/arbazkhan-cs/genai/blob/main/RAG/Retrievers/2_vector_store_retriever.py): `RAG/Retrievers/2_vector_store_retriever.py`
- [MMR Retrieval](https://github.com/arbazkhan-cs/genai/blob/main/RAG/Retrievers/3_mmr_retriever.py): `RAG/Retrievers/3_mmr_retriever.py`
- [Multi-Query Retrieval](https://github.com/arbazkhan-cs/genai/blob/main/RAG/Retrievers/4_multi_query_retriever.py): `RAG/Retrievers/4_multi_query_retriever.py`
- [Contextual Compression](https://github.com/arbazkhan-cs/genai/blob/main/RAG/Retrievers/5_contextual_compression_retriever.py): `RAG/Retrievers/5_contextual_compression_retriever.py`

### Model Providers

- [Groq Chat Model](https://github.com/arbazkhan-cs/genai/blob/main/RAG/DocumentLoader/6_app.py): `RAG/DocumentLoader/6_app.py`
- [Chat Model Examples](https://github.com/arbazkhan-cs/genai/tree/main/ChatModels): `ChatModels`

### Output Formats

- [String Parser](https://github.com/arbazkhan-cs/genai/blob/main/RAG/DocumentLoader/6_app.py): `RAG/DocumentLoader/6_app.py`
- [Output Parser Examples](https://github.com/arbazkhan-cs/genai/tree/main/OutputParsers): `OutputParsers`
- [Structured Output](https://github.com/arbazkhan-cs/genai/tree/main/StructuredOutput): `StructuredOutput`

### Other components

- **Questioner**

## Connections

- Questioner → Web Q&A App: submits URL and question (evidence: `RAG/DocumentLoader/6_app.py`)
- Web Q&A App → Web Page Loader: loads page text (evidence: `RAG/DocumentLoader/6_app.py`)
- Web Q&A App → Answer Prompt: creates prompt (evidence: `RAG/DocumentLoader/6_app.py`)
- Web Q&A App → Groq Chat Model: invokes model (evidence: `RAG/DocumentLoader/6_app.py`)
- Web Q&A App → String Parser: parses answer (evidence: `RAG/DocumentLoader/6_app.py`)
- Web Q&A App → Runnable Patterns: composes processing chain (evidence: `RAG/DocumentLoader/6_app.py`)
- MMR Retrieval → Embedding Models: embeds documents (evidence: `RAG/Retrievers/3_mmr_retriever.py`)
- MMR Retrieval → Vector Retrieval: builds vector store (evidence: `RAG/Retrievers/3_mmr_retriever.py`)
- Multi-Query Retrieval → Embedding Models: embeds documents (evidence: `RAG/Retrievers/4_multi_query_retriever.py`)
- Multi-Query Retrieval → Groq Chat Model: uses query model (evidence: `RAG/Retrievers/4_multi_query_retriever.py`)
- Contextual Compression → Embedding Models: embeds documents (evidence: `RAG/Retrievers/5_contextual_compression_retriever.py`)
- Contextual Compression → Groq Chat Model: uses compressor model (evidence: `RAG/Retrievers/5_contextual_compression_retriever.py`)
