# ineshag/srmist_puchkaz_prism_genai architecture

> Architecture diagram of the GitHub repository ineshag/srmist_puchkaz_prism_genai, 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/ineshag/srmist_puchkaz_prism_genai
- Repository: https://github.com/ineshag/srmist_puchkaz_prism_genai

## Overview

The product is a guided device-troubleshooting API. A customer complaint enters through the API, is enriched into a canonical query and paraphrases, then checks the semantic cache. On a miss, the pipeline extracts a structured answer from relevant reference text, maps it to deeplinks, sanitizes it, and returns a validated response; eligible results can then be cached. README documents the stages and optional LLM providers. Some implementation details, especially API and deeplink-mapping internals, were not excerpted, so their links rely on the README or source-index references.

Main entry points: [`src/pipeline.py`](https://github.com/ineshag/srmist_puchkaz_prism_genai/blob/master/src/pipeline.py) (Pipeline orchestrator), [`src/api.py`](https://github.com/ineshag/srmist_puchkaz_prism_genai/blob/master/src/api.py) (Troubleshoot API), [`src/structure_extraction.py`](https://github.com/ineshag/srmist_puchkaz_prism_genai/blob/master/src/structure_extraction.py) (Structure extraction), [`src/cache.py`](https://github.com/ineshag/srmist_puchkaz_prism_genai/blob/master/src/cache.py) (Semantic cache)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Request and response"]
  node_api["Troubleshoot API<br/>[api.py]"]
end

subgraph group_stages["Troubleshooting stages"]
  node_enrichment["Query enrichment<br/>[enrichment.py]"]
  node_pipeline["Pipeline orchestrator<br/>[pipeline.py]"]
  node_structure["Structure extraction"]
  node_relevance["Relevance gate<br/>[relevance_gate.py]"]
  node_deeplinks["Deeplink mapping"]
  node_scrubber["Response scrubber<br/>[scrubber.py]"]
end

subgraph group_runtime["Runtime services"]
  node_cache[("Semantic cache<br/>[cache.py]")]
  node_embedder["TF-IDF embedder<br/>[embeddings.py]"]
  node_llm["LLM client<br/>[llm_client.py]"]
end

subgraph group_contracts["Response contract"]
  node_schema["Response schema<br/>[schema.py]"]
  node_models["API response models<br/>[response_models.py]"]
end

node_customer(("Customer"))
node_providers{{"LLM providers"}}

node_customer -->|"submits complaint"| node_api
node_api -->|"runs troubleshooting"| node_pipeline
node_api -->|"validates API response"| node_models
node_pipeline -->|"enriches query"| node_enrichment
node_pipeline -->|"checks cache"| node_cache
node_cache -->|"encodes query"| node_embedder
node_pipeline -->|"extracts structure"| node_structure
node_structure -->|"checks relevance"| node_relevance
node_pipeline -->|"maps deeplinks"| node_deeplinks
node_pipeline -->|"sanitizes response"| node_scrubber
node_pipeline -->|"validates response"| node_schema
node_structure -->|"builds response"| node_schema
node_enrichment -->|"requests paraphrases"| node_llm
node_structure -->|"requests extraction"| node_llm
node_llm -.->|"calls provider"| node_providers
node_pipeline -->|"stores eligible result"| node_cache
node_api -->|"returns response"| node_customer

click node_api "https://github.com/ineshag/srmist_puchkaz_prism_genai/blob/master/src/api.py"
click node_enrichment "https://github.com/ineshag/srmist_puchkaz_prism_genai/blob/master/src/enrichment.py"
click node_pipeline "https://github.com/ineshag/srmist_puchkaz_prism_genai/blob/master/src/pipeline.py"
click node_structure "https://github.com/ineshag/srmist_puchkaz_prism_genai/blob/master/src/structure_extraction.py"
click node_relevance "https://github.com/ineshag/srmist_puchkaz_prism_genai/blob/master/src/relevance_gate.py"
click node_deeplinks "https://github.com/ineshag/srmist_puchkaz_prism_genai/blob/master/src/deeplink_mapping.py"
click node_scrubber "https://github.com/ineshag/srmist_puchkaz_prism_genai/blob/master/src/scrubber.py"
click node_cache "https://github.com/ineshag/srmist_puchkaz_prism_genai/blob/master/src/cache.py"
click node_embedder "https://github.com/ineshag/srmist_puchkaz_prism_genai/blob/master/src/embeddings.py"
click node_llm "https://github.com/ineshag/srmist_puchkaz_prism_genai/blob/master/src/llm_client.py"
click node_schema "https://github.com/ineshag/srmist_puchkaz_prism_genai/blob/master/src/schema.py"
click node_models "https://github.com/ineshag/srmist_puchkaz_prism_genai/blob/master/src/response_models.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_api toneBlue
class node_enrichment,node_pipeline,node_structure,node_relevance,node_deeplinks,node_scrubber toneAmber
class node_cache,node_embedder,node_llm toneMint
class node_schema,node_models toneRose
class node_customer,node_providers toneIndigo
```

## Components

### Request and response

- [Troubleshoot API](https://github.com/ineshag/srmist_puchkaz_prism_genai/blob/master/src/api.py): `src/api.py`

### Troubleshooting stages

- [Query enrichment](https://github.com/ineshag/srmist_puchkaz_prism_genai/blob/master/src/enrichment.py): `src/enrichment.py`
- [Pipeline orchestrator](https://github.com/ineshag/srmist_puchkaz_prism_genai/blob/master/src/pipeline.py): `src/pipeline.py`
- [Structure extraction](https://github.com/ineshag/srmist_puchkaz_prism_genai/blob/master/src/structure_extraction.py): `src/structure_extraction.py`
- [Relevance gate](https://github.com/ineshag/srmist_puchkaz_prism_genai/blob/master/src/relevance_gate.py): `src/relevance_gate.py`
- [Deeplink mapping](https://github.com/ineshag/srmist_puchkaz_prism_genai/blob/master/src/deeplink_mapping.py): `src/deeplink_mapping.py`
- [Response scrubber](https://github.com/ineshag/srmist_puchkaz_prism_genai/blob/master/src/scrubber.py): `src/scrubber.py`

### Runtime services

- [Semantic cache](https://github.com/ineshag/srmist_puchkaz_prism_genai/blob/master/src/cache.py): `src/cache.py`
- [TF-IDF embedder](https://github.com/ineshag/srmist_puchkaz_prism_genai/blob/master/src/embeddings.py): `src/embeddings.py`
- [LLM client](https://github.com/ineshag/srmist_puchkaz_prism_genai/blob/master/src/llm_client.py): `src/llm_client.py`

### Response contract

- [Response schema](https://github.com/ineshag/srmist_puchkaz_prism_genai/blob/master/src/schema.py): `src/schema.py`
- [API response models](https://github.com/ineshag/srmist_puchkaz_prism_genai/blob/master/src/response_models.py): `src/response_models.py`

### Other components

- **Customer**
- **LLM providers**

## Connections

- Customer → Troubleshoot API: submits complaint (evidence: `README.md`)
- Troubleshoot API → Pipeline orchestrator: runs troubleshooting (evidence: `src/api.py`)
- Troubleshoot API → API response models: validates API response (evidence: `src/api.py`)
- Pipeline orchestrator → Query enrichment: enriches query (evidence: `src/pipeline.py`)
- Pipeline orchestrator → Semantic cache: checks cache (evidence: `src/pipeline.py`)
- Semantic cache → TF-IDF embedder: encodes query (evidence: `src/cache.py`)
- Pipeline orchestrator → Structure extraction: extracts structure (evidence: `README.md`)
- Structure extraction → Relevance gate: checks relevance (evidence: `src/structure_extraction.py`)
- Pipeline orchestrator → Deeplink mapping: maps deeplinks (evidence: `README.md`)
- Pipeline orchestrator → Response scrubber: sanitizes response (evidence: `src/pipeline.py`)
- Pipeline orchestrator → Response schema: validates response (evidence: `src/pipeline.py`)
- Structure extraction → Response schema: builds response (evidence: `src/structure_extraction.py`)
- Query enrichment → LLM client: requests paraphrases (evidence: `README.md`)
- Structure extraction → LLM client: requests extraction (evidence: `src/structure_extraction.py`)
- LLM client → LLM providers: calls provider (evidence: `README.md`)
- Pipeline orchestrator → Semantic cache: stores eligible result (evidence: `src/pipeline.py`)
- Troubleshoot API → Customer: returns response (evidence: `README.md`)
