# soumadip-dev/genai-playground architecture

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

- Interactive diagram: https://gitdiagram.com/soumadip-dev/genai-playground
- Repository: https://github.com/soumadip-dev/genai-playground

## Overview

GenAI-Playground is an educational collection of independent Python and TypeScript examples, rather than one integrated runtime. Its recurring workflows take user input through prompting, model or agent execution, optional retrieval/tool use, and a generated result; the JavaScript applications add web interfaces and API layers. The graph groups the README’s major capability areas and preserves the Light RAG, web-search, and YouTube RAG flows supported by sampled source. Other branches are documented in the README or represented by their tree paths; their internal wiring is not inferred.

Main entry points: [`python/04_rag`](https://github.com/soumadip-dev/genai-playground/tree/main/python/04_rag) (RAG examples), [`javascript/03_search_tool_langchain/agent/src/search_tool/webPipeline.ts`](https://github.com/soumadip-dev/genai-playground/blob/main/javascript/03_search_tool_langchain/agent/src/search_tool/webPipeline.ts) (Web search pipeline), [`javascript/04_light_rag/agent/src/routes/knowledge-base.routes.ts`](https://github.com/soumadip-dev/genai-playground/blob/main/javascript/04_light_rag/agent/src/routes/knowledge-base.routes.ts) (Knowledge base routes), [`javascript/03_search_tool_langchain/agent/src/search_tool/routeStrategy.ts`](https://github.com/soumadip-dev/genai-playground/blob/main/javascript/03_search_tool_langchain/agent/src/search_tool/routeStrategy.ts) (Search strategy)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_agents["Agents and workflows"]
  node_agent_examples["Agent examples"]
  node_agent_patterns["Agent patterns<br/>[09_react_agent.py]"]
end

subgraph group_prompts["Prompt engineering"]
  node_prompt_examples["Prompt examples"]
  node_prompt_strategies["Prompt strategies"]
end

subgraph group_langchain["LangChain and LCEL"]
  node_langchain_building["LangChain building blocks"]
  node_context_management["Conversation context<br/>[main.py]"]
end

subgraph group_rag["Retrieval augmented generation"]
  node_rag_examples["RAG examples"]
  node_document_loading["Document loading<br/>[main.py]"]
  node_text_splitting["Text splitting"]
  node_vector_stores[("Vector stores<br/>[main.py]")]
  node_retrievers["Advanced retrieval"]
  node_youtube_rag["YouTube RAG<br/>[main.py]"]
  node_youtube_ui["YouTube chat UI<br/>[streamlit_app.py]"]
end

subgraph group_apps["Full-stack applications"]
  node_structured_ui["Structured output UI<br/>[page.tsx]"]
  node_structured_api["Structured output API<br/>[route.ts]"]
  node_structured_core["Structured answer core<br/>[ask-core.ts]"]
  node_search_ui["Search app UI<br/>[page.tsx]"]
  node_search_api["Search app API<br/>[route.ts]"]
  node_search_routes["Search routes<br/>[search_lcel.ts]"]
  node_search_strategy["Search strategy<br/>[routeStrategy.ts]"]
  node_search_direct["Direct answering<br/>[directPipeline.ts]"]
  node_search_web["Web search pipeline<br/>[webPipeline.ts]"]
  node_web_search_service["Web search service"]
  node_page_fetch["Page extraction"]
  node_page_summary["Page summaries<br/>[summarize.utils.ts]"]
  node_light_ui["Light RAG UI<br/>[page.tsx]"]
  node_light_proxy["Light RAG API proxy<br/>[route.ts]"]
  node_light_routes["Knowledge base routes"]
  node_indexer["Text indexer<br/>[indexer.ts]"]
  node_chunker["Text chunker<br/>[chunker.ts]"]
  node_light_vector_store[("In-memory vector store<br/>[vector-store.ts]")]
  node_query_service["Knowledge query service<br/>[query-service.ts]"]
end

node_learner(("Learner"))
node_llm_service{{"LLM provider"}}

node_learner -->|"explores examples"| node_agent_examples
node_learner -->|"tries prompts"| node_prompt_examples
node_learner -->|"explores abstractions"| node_langchain_building
node_learner -->|"explores retrieval"| node_rag_examples
node_agent_examples -->|"calls models"| node_llm_service
node_agent_patterns -->|"calls models"| node_llm_service
node_prompt_examples -->|"demonstrates strategies"| node_prompt_strategies
node_context_management -->|"invokes model"| node_llm_service
node_rag_examples -->|"demonstrates loading"| node_document_loading
node_rag_examples -->|"demonstrates splitting"| node_text_splitting
node_rag_examples -->|"demonstrates storage"| node_vector_stores
node_rag_examples -->|"demonstrates retrieval"| node_retrievers
node_youtube_ui -->|"submits questions"| node_youtube_rag
node_youtube_rag -->|"embeds and generates"| node_llm_service
node_learner -->|"asks question"| node_structured_ui
node_structured_ui -->|"posts request"| node_structured_api
node_structured_api -->|"forwards request"| node_structured_core
node_structured_core -->|"requests answer"| node_llm_service
node_learner -->|"searches"| node_search_ui
node_search_ui -->|"posts query"| node_search_api
node_search_api -->|"forwards query"| node_search_routes
node_search_routes -->|"selects mode"| node_search_strategy
node_search_strategy -->|"dispatches direct"| node_search_direct
node_search_strategy -->|"dispatches web"| node_search_web
node_search_direct -->|"invokes model"| node_llm_service
node_search_web -->|"searches web"| node_web_search_service
node_search_web -->|"opens pages"| node_page_fetch
node_search_web -->|"summarizes content"| node_page_summary
node_search_web -->|"composes answer"| node_llm_service
node_learner -->|"ingests or queries"| node_light_ui
node_light_ui -->|"calls API"| node_light_proxy
node_light_proxy -->|"forwards request"| node_light_routes
node_light_routes -->|"dispatches ingestion"| node_indexer
node_indexer -->|"splits text"| node_chunker
node_indexer -->|"stores vectors"| node_light_vector_store
node_light_routes -->|"dispatches query"| node_query_service
node_query_service -->|"retrieves chunks"| node_light_vector_store
node_query_service -->|"compresses and answers"| node_llm_service
node_light_routes -->|"resets store"| node_light_vector_store

click node_agent_examples "https://github.com/soumadip-dev/genai-playground/tree/main/python/01_llm_api_and_agents"
click node_agent_patterns "https://github.com/soumadip-dev/genai-playground/blob/main/python/01_llm_api_and_agents/09_react_agent.py"
click node_prompt_examples "https://github.com/soumadip-dev/genai-playground/tree/main/python/02_prompt_engineering"
click node_prompt_strategies "https://github.com/soumadip-dev/genai-playground/blob/main/python/02_prompt_engineering/04_chain_of_thought.py"
click node_langchain_building "https://github.com/soumadip-dev/genai-playground/tree/main/python/03_langchain"
click node_context_management "https://github.com/soumadip-dev/genai-playground/blob/main/python/03_langchain/06_context_management/main.py"
click node_rag_examples "https://github.com/soumadip-dev/genai-playground/tree/main/python/04_rag"
click node_document_loading "https://github.com/soumadip-dev/genai-playground/blob/main/python/04_rag/01_document_loaders/main.py"
click node_text_splitting "https://github.com/soumadip-dev/genai-playground/tree/main/python/04_rag/02_text_splitters"
click node_vector_stores "https://github.com/soumadip-dev/genai-playground/blob/main/python/04_rag/03_vector_stores/main.py"
click node_retrievers "https://github.com/soumadip-dev/genai-playground/tree/main/python/04_rag/04_retrievers"
click node_youtube_rag "https://github.com/soumadip-dev/genai-playground/blob/main/python/04_rag/youtube-rag-chatbot/main.py"
click node_youtube_ui "https://github.com/soumadip-dev/genai-playground/blob/main/python/04_rag/youtube-rag-chatbot/streamlit_app.py"
click node_structured_ui "https://github.com/soumadip-dev/genai-playground/blob/main/javascript/02_structured_output/client/src/app/page.tsx"
click node_structured_api "https://github.com/soumadip-dev/genai-playground/blob/main/javascript/02_structured_output/client/src/app/api/ask/route.ts"
click node_structured_core "https://github.com/soumadip-dev/genai-playground/blob/main/javascript/02_structured_output/server/src/ask-core.ts"
click node_search_ui "https://github.com/soumadip-dev/genai-playground/blob/main/javascript/03_search_tool_langchain/client/src/app/page.tsx"
click node_search_api "https://github.com/soumadip-dev/genai-playground/blob/main/javascript/03_search_tool_langchain/client/src/app/api/search/route.ts"
click node_search_routes "https://github.com/soumadip-dev/genai-playground/blob/main/javascript/03_search_tool_langchain/agent/src/routes/search_lcel.ts"
click node_search_strategy "https://github.com/soumadip-dev/genai-playground/blob/main/javascript/03_search_tool_langchain/agent/src/search_tool/routeStrategy.ts"
click node_search_direct "https://github.com/soumadip-dev/genai-playground/blob/main/javascript/03_search_tool_langchain/agent/src/search_tool/directPipeline.ts"
click node_search_web "https://github.com/soumadip-dev/genai-playground/blob/main/javascript/03_search_tool_langchain/agent/src/search_tool/webPipeline.ts"
click node_web_search_service "https://github.com/soumadip-dev/genai-playground/blob/main/javascript/03_search_tool_langchain/agent/src/utils/search-web.utils.ts"
click node_page_fetch "https://github.com/soumadip-dev/genai-playground/blob/main/javascript/03_search_tool_langchain/agent/src/utils/fetch-page-content.utils.ts"
click node_page_summary "https://github.com/soumadip-dev/genai-playground/blob/main/javascript/03_search_tool_langchain/agent/src/utils/summarize.utils.ts"
click node_light_ui "https://github.com/soumadip-dev/genai-playground/blob/main/javascript/04_light_rag/client/app/page.tsx"
click node_light_proxy "https://github.com/soumadip-dev/genai-playground/blob/main/javascript/04_light_rag/client/app/api/ingest/route.ts"
click node_light_routes "https://github.com/soumadip-dev/genai-playground/blob/main/javascript/04_light_rag/agent/src/routes/knowledge-base.routes.ts"
click node_indexer "https://github.com/soumadip-dev/genai-playground/blob/main/javascript/04_light_rag/agent/src/knowledge/indexer.ts"
click node_chunker "https://github.com/soumadip-dev/genai-playground/blob/main/javascript/04_light_rag/agent/src/knowledge/chunker.ts"
click node_light_vector_store "https://github.com/soumadip-dev/genai-playground/blob/main/javascript/04_light_rag/agent/src/knowledge/vector-store.ts"
click node_query_service "https://github.com/soumadip-dev/genai-playground/blob/main/javascript/04_light_rag/agent/src/knowledge/query-service.ts"

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_agent_examples,node_agent_patterns toneBlue
class node_prompt_examples,node_prompt_strategies toneAmber
class node_langchain_building,node_context_management toneMint
class node_rag_examples,node_document_loading,node_text_splitting,node_vector_stores,node_retrievers,node_youtube_rag,node_youtube_ui toneRose
class node_structured_ui,node_structured_api,node_structured_core,node_search_ui,node_search_api,node_search_routes,node_search_strategy,node_search_direct,node_search_web,node_web_search_service,node_page_fetch,node_page_summary,node_light_ui,node_light_proxy,node_light_routes,node_indexer,node_chunker,node_light_vector_store,node_query_service,node_learner,node_llm_service toneIndigo
```

## Components

### Agents and workflows

- [Agent examples](https://github.com/soumadip-dev/genai-playground/tree/main/python/01_llm_api_and_agents): `python/01_llm_api_and_agents`
- [Agent patterns](https://github.com/soumadip-dev/genai-playground/blob/main/python/01_llm_api_and_agents/09_react_agent.py): `python/01_llm_api_and_agents/09_react_agent.py`

### Prompt engineering

- [Prompt examples](https://github.com/soumadip-dev/genai-playground/tree/main/python/02_prompt_engineering): `python/02_prompt_engineering`
- [Prompt strategies](https://github.com/soumadip-dev/genai-playground/blob/main/python/02_prompt_engineering/04_chain_of_thought.py): `python/02_prompt_engineering/04_chain_of_thought.py`

### LangChain and LCEL

- [LangChain building blocks](https://github.com/soumadip-dev/genai-playground/tree/main/python/03_langchain): `python/03_langchain`
- [Conversation context](https://github.com/soumadip-dev/genai-playground/blob/main/python/03_langchain/06_context_management/main.py): `python/03_langchain/06_context_management/main.py`

### Retrieval augmented generation

- [RAG examples](https://github.com/soumadip-dev/genai-playground/tree/main/python/04_rag): `python/04_rag`
- [Document loading](https://github.com/soumadip-dev/genai-playground/blob/main/python/04_rag/01_document_loaders/main.py): `python/04_rag/01_document_loaders/main.py`
- [Text splitting](https://github.com/soumadip-dev/genai-playground/tree/main/python/04_rag/02_text_splitters): `python/04_rag/02_text_splitters`
- [Vector stores](https://github.com/soumadip-dev/genai-playground/blob/main/python/04_rag/03_vector_stores/main.py): `python/04_rag/03_vector_stores/main.py`
- [Advanced retrieval](https://github.com/soumadip-dev/genai-playground/tree/main/python/04_rag/04_retrievers): `python/04_rag/04_retrievers`
- [YouTube RAG](https://github.com/soumadip-dev/genai-playground/blob/main/python/04_rag/youtube-rag-chatbot/main.py): `python/04_rag/youtube-rag-chatbot/main.py`
- [YouTube chat UI](https://github.com/soumadip-dev/genai-playground/blob/main/python/04_rag/youtube-rag-chatbot/streamlit_app.py): `python/04_rag/youtube-rag-chatbot/streamlit_app.py`

### Full-stack applications

- [Structured output UI](https://github.com/soumadip-dev/genai-playground/blob/main/javascript/02_structured_output/client/src/app/page.tsx): `javascript/02_structured_output/client/src/app/page.tsx`
- [Structured output API](https://github.com/soumadip-dev/genai-playground/blob/main/javascript/02_structured_output/client/src/app/api/ask/route.ts): `javascript/02_structured_output/client/src/app/api/ask/route.ts`
- [Structured answer core](https://github.com/soumadip-dev/genai-playground/blob/main/javascript/02_structured_output/server/src/ask-core.ts): `javascript/02_structured_output/server/src/ask-core.ts`
- [Search app UI](https://github.com/soumadip-dev/genai-playground/blob/main/javascript/03_search_tool_langchain/client/src/app/page.tsx): `javascript/03_search_tool_langchain/client/src/app/page.tsx`
- [Search app API](https://github.com/soumadip-dev/genai-playground/blob/main/javascript/03_search_tool_langchain/client/src/app/api/search/route.ts): `javascript/03_search_tool_langchain/client/src/app/api/search/route.ts`
- [Search routes](https://github.com/soumadip-dev/genai-playground/blob/main/javascript/03_search_tool_langchain/agent/src/routes/search_lcel.ts): `javascript/03_search_tool_langchain/agent/src/routes/search_lcel.ts`
- [Search strategy](https://github.com/soumadip-dev/genai-playground/blob/main/javascript/03_search_tool_langchain/agent/src/search_tool/routeStrategy.ts): `javascript/03_search_tool_langchain/agent/src/search_tool/routeStrategy.ts`
- [Direct answering](https://github.com/soumadip-dev/genai-playground/blob/main/javascript/03_search_tool_langchain/agent/src/search_tool/directPipeline.ts): `javascript/03_search_tool_langchain/agent/src/search_tool/directPipeline.ts`
- [Web search pipeline](https://github.com/soumadip-dev/genai-playground/blob/main/javascript/03_search_tool_langchain/agent/src/search_tool/webPipeline.ts): `javascript/03_search_tool_langchain/agent/src/search_tool/webPipeline.ts`
- [Web search service](https://github.com/soumadip-dev/genai-playground/blob/main/javascript/03_search_tool_langchain/agent/src/utils/search-web.utils.ts): `javascript/03_search_tool_langchain/agent/src/utils/search-web.utils.ts`
- [Page extraction](https://github.com/soumadip-dev/genai-playground/blob/main/javascript/03_search_tool_langchain/agent/src/utils/fetch-page-content.utils.ts): `javascript/03_search_tool_langchain/agent/src/utils/fetch-page-content.utils.ts`
- [Page summaries](https://github.com/soumadip-dev/genai-playground/blob/main/javascript/03_search_tool_langchain/agent/src/utils/summarize.utils.ts): `javascript/03_search_tool_langchain/agent/src/utils/summarize.utils.ts`
- [Light RAG UI](https://github.com/soumadip-dev/genai-playground/blob/main/javascript/04_light_rag/client/app/page.tsx): `javascript/04_light_rag/client/app/page.tsx`
- [Light RAG API proxy](https://github.com/soumadip-dev/genai-playground/blob/main/javascript/04_light_rag/client/app/api/ingest/route.ts): `javascript/04_light_rag/client/app/api/ingest/route.ts`
- [Knowledge base routes](https://github.com/soumadip-dev/genai-playground/blob/main/javascript/04_light_rag/agent/src/routes/knowledge-base.routes.ts): `javascript/04_light_rag/agent/src/routes/knowledge-base.routes.ts`
- [Text indexer](https://github.com/soumadip-dev/genai-playground/blob/main/javascript/04_light_rag/agent/src/knowledge/indexer.ts): `javascript/04_light_rag/agent/src/knowledge/indexer.ts`
- [Text chunker](https://github.com/soumadip-dev/genai-playground/blob/main/javascript/04_light_rag/agent/src/knowledge/chunker.ts): `javascript/04_light_rag/agent/src/knowledge/chunker.ts`
- [In-memory vector store](https://github.com/soumadip-dev/genai-playground/blob/main/javascript/04_light_rag/agent/src/knowledge/vector-store.ts): `javascript/04_light_rag/agent/src/knowledge/vector-store.ts`
- [Knowledge query service](https://github.com/soumadip-dev/genai-playground/blob/main/javascript/04_light_rag/agent/src/knowledge/query-service.ts): `javascript/04_light_rag/agent/src/knowledge/query-service.ts`

### Other components

- **Learner**
- **LLM provider**

## Connections

- Learner → Agent examples: explores examples
- Learner → Prompt examples: tries prompts
- Learner → LangChain building blocks: explores abstractions
- Learner → RAG examples: explores retrieval
- Agent examples → LLM provider: calls models
- Agent patterns → LLM provider: calls models
- Prompt examples → Prompt strategies: demonstrates strategies
- Conversation context → LLM provider: invokes model
- RAG examples → Document loading: demonstrates loading
- RAG examples → Text splitting: demonstrates splitting
- RAG examples → Vector stores: demonstrates storage
- RAG examples → Advanced retrieval: demonstrates retrieval
- YouTube chat UI → YouTube RAG: submits questions
- YouTube RAG → LLM provider: embeds and generates
- Learner → Structured output UI: asks question
- Structured output UI → Structured output API: posts request
- Structured output API → Structured answer core: forwards request
- Structured answer core → LLM provider: requests answer
- Learner → Search app UI: searches
- Search app UI → Search app API: posts query
- Search app API → Search routes: forwards query
- Search routes → Search strategy: selects mode
- Search strategy → Direct answering: dispatches direct
- Search strategy → Web search pipeline: dispatches web
- Direct answering → LLM provider: invokes model
- Web search pipeline → Web search service: searches web
- Web search pipeline → Page extraction: opens pages
- Web search pipeline → Page summaries: summarizes content
- Web search pipeline → LLM provider: composes answer
- Learner → Light RAG UI: ingests or queries
- Light RAG UI → Light RAG API proxy: calls API
- Light RAG API proxy → Knowledge base routes: forwards request
- Knowledge base routes → Text indexer: dispatches ingestion
- Text indexer → Text chunker: splits text
- Text indexer → In-memory vector store: stores vectors
- Knowledge base routes → Knowledge query service: dispatches query
- Knowledge query service → In-memory vector store: retrieves chunks
- Knowledge query service → LLM provider: compresses and answers
- Knowledge base routes → In-memory vector store: resets store
