# campusx-official/langchain-prompts architecture

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

- Interactive diagram: https://gitdiagram.com/campusx-official/langchain-prompts
- Repository: https://github.com/campusx-official/langchain-prompts

## Overview

This repository is a set of small, standalone LangChain examples rather than one integrated application. It demonstrates direct chat, message-history handling, prompt construction, and a Streamlit research-paper summarizer. The scripts independently invoke a chat model or render prompts; the research UI loads a prompt template that can be produced by the generator. Relationships shown below come from the excerpts; the empty README provides no additional architecture details.

Main entry points: [`prompt_ui.py`](https://github.com/campusx-official/langchain-prompts/blob/main/prompt_ui.py) (Research summary UI), [`message_placeholder.py`](https://github.com/campusx-official/langchain-prompts/blob/main/message_placeholder.py) (History prompt), [`prompt_template.py`](https://github.com/campusx-official/langchain-prompts/blob/main/prompt_template.py) (Text prompt example), [`chatbot.py`](https://github.com/campusx-official/langchain-prompts/blob/main/chatbot.py) (Interactive chatbot)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_chat["Chat examples"]
  node_chatbot["Interactive chatbot<br/>[chatbot.py]"]
  node_messages["Message exchange<br/>[messages.py]"]
  node_history_prompt["History prompt"]
  node_history_file["Chat history<br/>[chat_history.txt]"]
end

subgraph group_prompts["Prompt examples"]
  node_chat_prompt["Chat prompt example"]
  node_plain_prompt["Text prompt example<br/>[prompt_template.py]"]
  node_prompt_generator["Prompt generator"]
  node_saved_template["Saved prompt template<br/>[template.json]"]
end

subgraph group_research["Research summarizer"]
  node_research_ui["Research summary UI<br/>[prompt_ui.py]"]
end

node_user(("User"))
node_model{{"OpenAI chat model"}}

node_user -->|"enters messages"| node_chatbot
node_chatbot -->|"invokes"| node_model
node_user -->|"provides question"| node_messages
node_messages -->|"invokes"| node_model
node_history_prompt -->|"reads"| node_history_file
node_history_prompt -->|"prints rendered prompt"| node_user
node_chat_prompt -->|"prints rendered prompt"| node_user
node_plain_prompt -->|"invokes"| node_model
node_plain_prompt -->|"prints response"| node_user
node_prompt_generator -->|"saves"| node_saved_template
node_user -->|"selects options"| node_research_ui
node_research_ui -->|"loads"| node_saved_template
node_research_ui -->|"invokes"| node_model
node_research_ui -->|"displays summary"| node_user

click node_chatbot "https://github.com/campusx-official/langchain-prompts/blob/main/chatbot.py"
click node_messages "https://github.com/campusx-official/langchain-prompts/blob/main/messages.py"
click node_history_prompt "https://github.com/campusx-official/langchain-prompts/blob/main/message_placeholder.py"
click node_history_file "https://github.com/campusx-official/langchain-prompts/blob/main/chat_history.txt"
click node_chat_prompt "https://github.com/campusx-official/langchain-prompts/blob/main/chat_prompt_template.py"
click node_plain_prompt "https://github.com/campusx-official/langchain-prompts/blob/main/prompt_template.py"
click node_prompt_generator "https://github.com/campusx-official/langchain-prompts/blob/main/prompt_generator.py"
click node_saved_template "https://github.com/campusx-official/langchain-prompts/blob/main/template.json"
click node_research_ui "https://github.com/campusx-official/langchain-prompts/blob/main/prompt_ui.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_chatbot,node_messages,node_history_prompt,node_history_file,node_user toneBlue
class node_chat_prompt,node_plain_prompt,node_prompt_generator,node_saved_template toneAmber
class node_research_ui toneMint
class node_model toneIndigo
```

## Components

### Chat examples

- [Interactive chatbot](https://github.com/campusx-official/langchain-prompts/blob/main/chatbot.py): `chatbot.py`
- [Message exchange](https://github.com/campusx-official/langchain-prompts/blob/main/messages.py): `messages.py`
- [History prompt](https://github.com/campusx-official/langchain-prompts/blob/main/message_placeholder.py): `message_placeholder.py`
- [Chat history](https://github.com/campusx-official/langchain-prompts/blob/main/chat_history.txt): `chat_history.txt`

### Prompt examples

- [Chat prompt example](https://github.com/campusx-official/langchain-prompts/blob/main/chat_prompt_template.py): `chat_prompt_template.py`
- [Text prompt example](https://github.com/campusx-official/langchain-prompts/blob/main/prompt_template.py): `prompt_template.py`
- [Prompt generator](https://github.com/campusx-official/langchain-prompts/blob/main/prompt_generator.py): `prompt_generator.py`
- [Saved prompt template](https://github.com/campusx-official/langchain-prompts/blob/main/template.json): `template.json`

### Research summarizer

- [Research summary UI](https://github.com/campusx-official/langchain-prompts/blob/main/prompt_ui.py): `prompt_ui.py`

### Other components

- **User**
- **OpenAI chat model**

## Connections

- User → Interactive chatbot: enters messages (evidence: `chatbot.py`)
- Interactive chatbot → OpenAI chat model: invokes (evidence: `chatbot.py`)
- User → Message exchange: provides question (evidence: `messages.py`)
- Message exchange → OpenAI chat model: invokes (evidence: `messages.py`)
- History prompt → Chat history: reads (evidence: `message_placeholder.py`)
- History prompt → User: prints rendered prompt (evidence: `message_placeholder.py`)
- Chat prompt example → User: prints rendered prompt (evidence: `chat_prompt_template.py`)
- Text prompt example → OpenAI chat model: invokes (evidence: `prompt_template.py`)
- Text prompt example → User: prints response (evidence: `prompt_template.py`)
- Prompt generator → Saved prompt template: saves (evidence: `prompt_generator.py`)
- User → Research summary UI: selects options (evidence: `prompt_ui.py`)
- Research summary UI → Saved prompt template: loads (evidence: `prompt_ui.py`)
- Research summary UI → OpenAI chat model: invokes (evidence: `prompt_ui.py`)
- Research summary UI → User: displays summary (evidence: `prompt_ui.py`)
