# dameerahmed/langchain_practice architecture

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

- Interactive diagram: https://gitdiagram.com/dameerahmed/langchain_practice
- Repository: https://github.com/dameerahmed/langchain_practice

## Overview

This repository is a collection of standalone LangChain learning scripts, not one integrated application. Its examples cover Gemini models and embeddings, prompts and structured output, runnable composition, document loading and splitting, vector stores and retrieval, YouTube transcript question-answering, and tool calling. Each script runs its own demonstration; there is no documented shared user workflow or orchestration across examples. Several ingestion, model, and tool examples are represented as capability nodes because their implementations were not excerpted.

Main entry points: [`28_langchain_faiss_vdb_alternative.py`](https://github.com/dameerahmed/langchain_practice/blob/main/28_langchain_faiss_vdb_alternative.py) (FAISS vector store), [`29_langchain_through_yt_transcript.py`](https://github.com/dameerahmed/langchain_practice/blob/main/29_langchain_through_yt_transcript.py) (Transcript Q&A), [`27_langchain_chroma_vdb.py`](https://github.com/dameerahmed/langchain_practice/blob/main/27_langchain_chroma_vdb.py) (Chroma vector store), [`10_langchain_str_outputparser.py`](https://github.com/dameerahmed/langchain_practice/blob/main/10_langchain_str_outputparser.py) (String parsing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_models["Models and prompts"]
  node_gemini["Gemini model"]
  node_embmodel["Embedding model"]
  node_embdoc["Document embeddings"]
  node_embsearch["Embedding search"]
  node_messages["Chat messages"]
  node_placeholder["Prompt placeholders"]
  node_structured["Structured outputs"]
  node_pydantic["Pydantic output"]
  node_jsonschema["JSON schema output"]
  node_stringparser["String parsing"]
  node_jsonparser["JSON parsing"]
end

subgraph group_runnables["Runnable patterns"]
  node_simplechain["Simple chains"]
  node_two_model["Two-model chain"]
  node_sequence["Runnable sequence"]
  node_parallel["Parallel runnables"]
  node_passthrough["Passthrough runnable"]
  node_lambda["Lambda runnable"]
  node_branch["Conditional branch"]
end

subgraph group_documents["Document processing"]
  node_textload["Text loading"]
  node_pdfload["PDF loading"]
  node_directoryload["Directory loading"]
  node_webload["Web loading"]
  node_lengthsplit["Length splitting"]
  node_structuresplit["Structure splitting"]
  node_codesplit["Code splitting"]
  node_markdownsplit["Markdown splitting"]
end

subgraph group_retrieval["Vector retrieval"]
  node_chroma[("Chroma vector store")]
  node_faiss[("FAISS vector store")]
end

subgraph group_applications["Applied examples"]
  node_youtube["Transcript Q&amp;A"]
  node_tools["Tool calling"]
end

node_google_api{{"Google AI"}}
node_groq_api{{"Groq"}}
node_youtube_service{{"YouTube transcripts"}}

node_stringparser -->|"invokes model"| node_gemini
node_stringparser -.->|"invokes model"| node_groq_api
node_jsonparser -->|"invokes model"| node_groq_api
node_two_model -->|"generates story"| node_groq_api
node_two_model -->|"returns review"| node_google_api
node_sequence -->|"generates story"| node_groq_api
node_sequence -->|"returns review"| node_google_api
node_parallel -->|"generates joke"| node_groq_api
node_parallel -->|"generates joke"| node_google_api
node_passthrough -->|"generates story"| node_groq_api
node_passthrough -->|"structures review"| node_google_api
node_lambda -->|"generates story"| node_groq_api
node_branch -->|"classifies feedback"| node_groq_api
node_branch -->|"writes response"| node_groq_api
node_chroma -->|"embeds documents"| node_google_api
node_chroma -->|"stores and searches"| node_chroma
node_faiss -->|"embeds documents"| node_google_api
node_faiss -->|"stores and retrieves"| node_faiss
node_youtube -->|"fetches transcript"| node_youtube_service
node_youtube -->|"indexes chunks"| node_faiss
node_youtube -->|"embeds and answers"| node_google_api

click node_gemini "https://github.com/dameerahmed/langchain_practice/blob/main/1_langchain_gemini_model.py"
click node_embmodel "https://github.com/dameerahmed/langchain_practice/blob/main/02_langchain_gemini_emb_model.py"
click node_embdoc "https://github.com/dameerahmed/langchain_practice/blob/main/03_langchain_gemini_emb_doc.py"
click node_embsearch "https://github.com/dameerahmed/langchain_practice/blob/main/04_langchain_gemini_emb_serach.py"
click node_messages "https://github.com/dameerahmed/langchain_practice/blob/main/05_langchain_messages.py"
click node_placeholder "https://github.com/dameerahmed/langchain_practice/blob/main/06_langchain_message_placeholder.py"
click node_structured "https://github.com/dameerahmed/langchain_practice/blob/main/07_langchain_with_structure_output_dic.py"
click node_pydantic "https://github.com/dameerahmed/langchain_practice/blob/main/08_langchain_with_structure_output_pydantic.py"
click node_jsonschema "https://github.com/dameerahmed/langchain_practice/blob/main/09_langchain_with_structure_output_json_schema.py"
click node_stringparser "https://github.com/dameerahmed/langchain_practice/blob/main/10_langchain_str_outputparser.py"
click node_jsonparser "https://github.com/dameerahmed/langchain_practice/blob/main/11_langchain_json_outputparser.py"
click node_simplechain "https://github.com/dameerahmed/langchain_practice/blob/main/12_langchain_simple_chain.py"
click node_two_model "https://github.com/dameerahmed/langchain_practice/blob/main/13_langchain_simple_2llm_chain.py"
click node_sequence "https://github.com/dameerahmed/langchain_practice/blob/main/14_langchain_runnable_sequence.py"
click node_parallel "https://github.com/dameerahmed/langchain_practice/blob/main/15_langchain_runnable_parallel.py"
click node_passthrough "https://github.com/dameerahmed/langchain_practice/blob/main/16_langchain_runnable_passthrough.py"
click node_lambda "https://github.com/dameerahmed/langchain_practice/blob/main/17_langchain_runnable_lambda.py"
click node_branch "https://github.com/dameerahmed/langchain_practice/blob/main/18_langchain_runnable_branch.py"
click node_textload "https://github.com/dameerahmed/langchain_practice/blob/main/19_langchain_text_loader.py"
click node_pdfload "https://github.com/dameerahmed/langchain_practice/blob/main/20_langchain_pdf_loader.py"
click node_directoryload "https://github.com/dameerahmed/langchain_practice/blob/main/21_langchain_directory_loader.py"
click node_webload "https://github.com/dameerahmed/langchain_practice/blob/main/22_langchain_webbase_loader.py"
click node_lengthsplit "https://github.com/dameerahmed/langchain_practice/blob/main/23_langchain_text_splitter_length_based.py"
click node_structuresplit "https://github.com/dameerahmed/langchain_practice/blob/main/24_langchain_text_splitter_structure_based.py"
click node_codesplit "https://github.com/dameerahmed/langchain_practice/blob/main/25_langchain_text_splitter_python_code.py"
click node_markdownsplit "https://github.com/dameerahmed/langchain_practice/blob/main/26_langchain_text_splitter_markdown.py"
click node_chroma "https://github.com/dameerahmed/langchain_practice/blob/main/27_langchain_chroma_vdb.py"
click node_faiss "https://github.com/dameerahmed/langchain_practice/blob/main/28_langchain_faiss_vdb_alternative.py"
click node_youtube "https://github.com/dameerahmed/langchain_practice/blob/main/29_langchain_through_yt_transcript.py"
click node_tools "https://github.com/dameerahmed/langchain_practice/blob/main/30_langchain_tools_call.py"

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_gemini,node_embmodel,node_embdoc,node_embsearch,node_messages,node_placeholder,node_structured,node_pydantic,node_jsonschema,node_stringparser,node_jsonparser toneBlue
class node_simplechain,node_two_model,node_sequence,node_parallel,node_passthrough,node_lambda,node_branch toneAmber
class node_textload,node_pdfload,node_directoryload,node_webload,node_lengthsplit,node_structuresplit,node_codesplit,node_markdownsplit toneMint
class node_chroma,node_faiss toneRose
class node_youtube,node_tools,node_google_api,node_groq_api,node_youtube_service toneIndigo
```

## Components

### Models and prompts

- [Gemini model](https://github.com/dameerahmed/langchain_practice/blob/main/1_langchain_gemini_model.py): `1_langchain_gemini_model.py`
- [Embedding model](https://github.com/dameerahmed/langchain_practice/blob/main/02_langchain_gemini_emb_model.py): `02_langchain_gemini_emb_model.py`
- [Document embeddings](https://github.com/dameerahmed/langchain_practice/blob/main/03_langchain_gemini_emb_doc.py): `03_langchain_gemini_emb_doc.py`
- [Embedding search](https://github.com/dameerahmed/langchain_practice/blob/main/04_langchain_gemini_emb_serach.py): `04_langchain_gemini_emb_serach.py`
- [Chat messages](https://github.com/dameerahmed/langchain_practice/blob/main/05_langchain_messages.py): `05_langchain_messages.py`
- [Prompt placeholders](https://github.com/dameerahmed/langchain_practice/blob/main/06_langchain_message_placeholder.py): `06_langchain_message_placeholder.py`
- [Structured outputs](https://github.com/dameerahmed/langchain_practice/blob/main/07_langchain_with_structure_output_dic.py): `07_langchain_with_structure_output_dic.py`
- [Pydantic output](https://github.com/dameerahmed/langchain_practice/blob/main/08_langchain_with_structure_output_pydantic.py): `08_langchain_with_structure_output_pydantic.py`
- [JSON schema output](https://github.com/dameerahmed/langchain_practice/blob/main/09_langchain_with_structure_output_json_schema.py): `09_langchain_with_structure_output_json_schema.py`
- [String parsing](https://github.com/dameerahmed/langchain_practice/blob/main/10_langchain_str_outputparser.py): `10_langchain_str_outputparser.py`
- [JSON parsing](https://github.com/dameerahmed/langchain_practice/blob/main/11_langchain_json_outputparser.py): `11_langchain_json_outputparser.py`

### Runnable patterns

- [Simple chains](https://github.com/dameerahmed/langchain_practice/blob/main/12_langchain_simple_chain.py): `12_langchain_simple_chain.py`
- [Two-model chain](https://github.com/dameerahmed/langchain_practice/blob/main/13_langchain_simple_2llm_chain.py): `13_langchain_simple_2llm_chain.py`
- [Runnable sequence](https://github.com/dameerahmed/langchain_practice/blob/main/14_langchain_runnable_sequence.py): `14_langchain_runnable_sequence.py`
- [Parallel runnables](https://github.com/dameerahmed/langchain_practice/blob/main/15_langchain_runnable_parallel.py): `15_langchain_runnable_parallel.py`
- [Passthrough runnable](https://github.com/dameerahmed/langchain_practice/blob/main/16_langchain_runnable_passthrough.py): `16_langchain_runnable_passthrough.py`
- [Lambda runnable](https://github.com/dameerahmed/langchain_practice/blob/main/17_langchain_runnable_lambda.py): `17_langchain_runnable_lambda.py`
- [Conditional branch](https://github.com/dameerahmed/langchain_practice/blob/main/18_langchain_runnable_branch.py): `18_langchain_runnable_branch.py`

### Document processing

- [Text loading](https://github.com/dameerahmed/langchain_practice/blob/main/19_langchain_text_loader.py): `19_langchain_text_loader.py`
- [PDF loading](https://github.com/dameerahmed/langchain_practice/blob/main/20_langchain_pdf_loader.py): `20_langchain_pdf_loader.py`
- [Directory loading](https://github.com/dameerahmed/langchain_practice/blob/main/21_langchain_directory_loader.py): `21_langchain_directory_loader.py`
- [Web loading](https://github.com/dameerahmed/langchain_practice/blob/main/22_langchain_webbase_loader.py): `22_langchain_webbase_loader.py`
- [Length splitting](https://github.com/dameerahmed/langchain_practice/blob/main/23_langchain_text_splitter_length_based.py): `23_langchain_text_splitter_length_based.py`
- [Structure splitting](https://github.com/dameerahmed/langchain_practice/blob/main/24_langchain_text_splitter_structure_based.py): `24_langchain_text_splitter_structure_based.py`
- [Code splitting](https://github.com/dameerahmed/langchain_practice/blob/main/25_langchain_text_splitter_python_code.py): `25_langchain_text_splitter_python_code.py`
- [Markdown splitting](https://github.com/dameerahmed/langchain_practice/blob/main/26_langchain_text_splitter_markdown.py): `26_langchain_text_splitter_markdown.py`

### Vector retrieval

- [Chroma vector store](https://github.com/dameerahmed/langchain_practice/blob/main/27_langchain_chroma_vdb.py): `27_langchain_chroma_vdb.py`
- [FAISS vector store](https://github.com/dameerahmed/langchain_practice/blob/main/28_langchain_faiss_vdb_alternative.py): `28_langchain_faiss_vdb_alternative.py`

### Applied examples

- [Transcript Q&A](https://github.com/dameerahmed/langchain_practice/blob/main/29_langchain_through_yt_transcript.py): `29_langchain_through_yt_transcript.py`
- [Tool calling](https://github.com/dameerahmed/langchain_practice/blob/main/30_langchain_tools_call.py): `30_langchain_tools_call.py`

### Other components

- **Google AI**
- **Groq**
- **YouTube transcripts**

## Connections

- String parsing → Gemini model: invokes model (evidence: `10_langchain_str_outputparser.py`)
- String parsing → Groq: invokes model
- JSON parsing → Groq: invokes model (evidence: `11_langchain_json_outputparser.py`)
- Two-model chain → Groq: generates story (evidence: `13_langchain_simple_2llm_chain.py`)
- Two-model chain → Google AI: returns review (evidence: `13_langchain_simple_2llm_chain.py`)
- Runnable sequence → Groq: generates story (evidence: `14_langchain_runnable_sequence.py`)
- Runnable sequence → Google AI: returns review (evidence: `14_langchain_runnable_sequence.py`)
- Parallel runnables → Groq: generates joke (evidence: `15_langchain_runnable_parallel.py`)
- Parallel runnables → Google AI: generates joke (evidence: `15_langchain_runnable_parallel.py`)
- Passthrough runnable → Groq: generates story (evidence: `16_langchain_runnable_passthrough.py`)
- Passthrough runnable → Google AI: structures review (evidence: `16_langchain_runnable_passthrough.py`)
- Lambda runnable → Groq: generates story (evidence: `17_langchain_runnable_lambda.py`)
- Conditional branch → Groq: classifies feedback (evidence: `18_langchain_runnable_branch.py`)
- Conditional branch → Groq: writes response (evidence: `18_langchain_runnable_branch.py`)
- Chroma vector store → Google AI: embeds documents (evidence: `27_langchain_chroma_vdb.py`)
- Chroma vector store → Chroma vector store: stores and searches (evidence: `27_langchain_chroma_vdb.py`)
- FAISS vector store → Google AI: embeds documents (evidence: `28_langchain_faiss_vdb_alternative.py`)
- FAISS vector store → FAISS vector store: stores and retrieves (evidence: `28_langchain_faiss_vdb_alternative.py`)
- Transcript Q&A → YouTube transcripts: fetches transcript (evidence: `29_langchain_through_yt_transcript.py`)
- Transcript Q&A → FAISS vector store: indexes chunks (evidence: `29_langchain_through_yt_transcript.py`)
- Transcript Q&A → Google AI: embeds and answers (evidence: `29_langchain_through_yt_transcript.py`)
