# abhishekadbhute-create/hi architecture

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

- Interactive diagram: https://gitdiagram.com/abhishekadbhute-create/hi
- Repository: https://github.com/abhishekadbhute-create/hi

## Overview

This repository is a small notebook-style YouTube transcript question-answering chatbot. It fetches a video transcript, chunks and indexes it, retrieves relevant chunks for a rewritten question, and asks a Hugging Face-hosted model to answer from the retrieved context and in-memory chat history. The single source file supports the relationships shown; there is no separate user interface or persistent history store.

Main entry points: [`code.py`](https://github.com/abhishekadbhute-create/hi/blob/main/code.py) (Question handler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_indexing["Transcript indexing"]
  node_transcript_fetch["Transcript fetch<br/>[code.py]"]
  node_chunking["Text chunking<br/>[code.py]"]
  node_embeddings["Text embeddings<br/>[code.py]"]
  node_faiss[("FAISS index<br/>[code.py]")]
end

subgraph group_retrieval["Question retrieval"]
  node_question_handler["Question handler<br/>[code.py]"]
  node_query_rewrite["Query rewrite<br/>[code.py]"]
  node_retriever["Chunk retriever<br/>[code.py]"]
end

subgraph group_answering["Answer generation"]
  node_chat_history["Chat history<br/>[code.py]"]
  node_answer_prompt["Answer prompt<br/>[code.py]"]
  node_model_call["Model call<br/>[code.py]"]
  node_output_parser["Output parser<br/>[code.py]"]
end

node_user(("Questioner"))
node_youtube["YouTube captions"]
node_huggingface["Hugging Face inference"]

node_youtube -->|"provides captions"| node_transcript_fetch
node_transcript_fetch -->|"splits transcript"| node_chunking
node_chunking -->|"embeds chunks"| node_embeddings
node_embeddings -->|"indexes vectors"| node_faiss
node_user -->|"asks question"| node_question_handler
node_question_handler -->|"formats query"| node_query_rewrite
node_question_handler -->|"retrieves chunks"| node_retriever
node_retriever -->|"searches index"| node_faiss
node_question_handler -->|"supplies context"| node_answer_prompt
node_question_handler -->|"reads and appends"| node_chat_history
node_answer_prompt -->|"builds prompt"| node_model_call
node_model_call -->|"requests completion"| node_huggingface
node_model_call -->|"parses response"| node_output_parser
node_output_parser -->|"returns answer"| node_question_handler
node_question_handler -->|"returns answer"| node_user

click node_transcript_fetch "https://github.com/abhishekadbhute-create/hi/blob/main/code.py"
click node_chunking "https://github.com/abhishekadbhute-create/hi/blob/main/code.py"
click node_embeddings "https://github.com/abhishekadbhute-create/hi/blob/main/code.py"
click node_faiss "https://github.com/abhishekadbhute-create/hi/blob/main/code.py"
click node_question_handler "https://github.com/abhishekadbhute-create/hi/blob/main/code.py"
click node_query_rewrite "https://github.com/abhishekadbhute-create/hi/blob/main/code.py"
click node_retriever "https://github.com/abhishekadbhute-create/hi/blob/main/code.py"
click node_chat_history "https://github.com/abhishekadbhute-create/hi/blob/main/code.py"
click node_answer_prompt "https://github.com/abhishekadbhute-create/hi/blob/main/code.py"
click node_model_call "https://github.com/abhishekadbhute-create/hi/blob/main/code.py"
click node_output_parser "https://github.com/abhishekadbhute-create/hi/blob/main/code.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_transcript_fetch,node_chunking,node_embeddings,node_faiss toneBlue
class node_question_handler,node_query_rewrite,node_retriever toneAmber
class node_chat_history,node_answer_prompt,node_model_call,node_output_parser toneMint
class node_user,node_youtube,node_huggingface toneIndigo
```

## Components

### Transcript indexing

- [Transcript fetch](https://github.com/abhishekadbhute-create/hi/blob/main/code.py): `code.py`
- [Text chunking](https://github.com/abhishekadbhute-create/hi/blob/main/code.py): `code.py`
- [Text embeddings](https://github.com/abhishekadbhute-create/hi/blob/main/code.py): `code.py`
- [FAISS index](https://github.com/abhishekadbhute-create/hi/blob/main/code.py): `code.py`

### Question retrieval

- [Question handler](https://github.com/abhishekadbhute-create/hi/blob/main/code.py): `code.py`
- [Query rewrite](https://github.com/abhishekadbhute-create/hi/blob/main/code.py): `code.py`
- [Chunk retriever](https://github.com/abhishekadbhute-create/hi/blob/main/code.py): `code.py`

### Answer generation

- [Chat history](https://github.com/abhishekadbhute-create/hi/blob/main/code.py): `code.py`
- [Answer prompt](https://github.com/abhishekadbhute-create/hi/blob/main/code.py): `code.py`
- [Model call](https://github.com/abhishekadbhute-create/hi/blob/main/code.py): `code.py`
- [Output parser](https://github.com/abhishekadbhute-create/hi/blob/main/code.py): `code.py`

### Other components

- **Questioner**
- **YouTube captions**
- **Hugging Face inference**

## Connections

- YouTube captions → Transcript fetch: provides captions (evidence: `code.py`)
- Transcript fetch → Text chunking: splits transcript (evidence: `code.py`)
- Text chunking → Text embeddings: embeds chunks (evidence: `code.py`)
- Text embeddings → FAISS index: indexes vectors (evidence: `code.py`)
- Questioner → Question handler: asks question (evidence: `code.py`)
- Question handler → Query rewrite: formats query (evidence: `code.py`)
- Question handler → Chunk retriever: retrieves chunks (evidence: `code.py`)
- Chunk retriever → FAISS index: searches index (evidence: `code.py`)
- Question handler → Answer prompt: supplies context (evidence: `code.py`)
- Question handler → Chat history: reads and appends (evidence: `code.py`)
- Answer prompt → Model call: builds prompt (evidence: `code.py`)
- Model call → Hugging Face inference: requests completion (evidence: `code.py`)
- Model call → Output parser: parses response (evidence: `code.py`)
- Output parser → Question handler: returns answer (evidence: `code.py`)
- Question handler → Questioner: returns answer (evidence: `code.py`)
