# campusx-official/langchain-models architecture

> Architecture diagram of the GitHub repository campusx-official/langchain-models, 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-models
- Repository: https://github.com/campusx-official/langchain-models

## Overview

This repository is a set of standalone LangChain examples, not a combined application. The examples demonstrate a text-completion call, chat-model calls across providers, embedding generation, and embedding-based document similarity. Each script owns its own model invocation and prints the result; there is no shared runtime or orchestration layer. The graph shows provider calls visible in the excerpts. The README is empty, so user-facing workflow and any unexcerpted behavior are not documented.

Main entry points: [`3.EmbeddingModels/4_document_similarity.py`](https://github.com/campusx-official/langchain-models/blob/master/3.EmbeddingModels/4_document_similarity.py) (Similarity example embeddings), [`1.LLMs/1_llm_demo.py`](https://github.com/campusx-official/langchain-models/blob/master/1.LLMs/1_llm_demo.py) (OpenAI completion demo), [`2.ChatModels/1_chatmodel_openai.py`](https://github.com/campusx-official/langchain-models/blob/master/2.ChatModels/1_chatmodel_openai.py) (OpenAI chat demo), [`2.ChatModels/2_chatmodel_anthropic.py`](https://github.com/campusx-official/langchain-models/blob/master/2.ChatModels/2_chatmodel_anthropic.py) (Anthropic chat demo)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_llm["Text completion"]
  node_llm_demo["OpenAI completion demo<br/>[1_llm_demo.py]"]
end

subgraph group_chat["Chat models"]
  node_chat_openai["OpenAI chat demo"]
  node_chat_anthropic["Anthropic chat demo"]
  node_chat_google["Google chat demo"]
  node_chat_hf_api["Hugging Face API demo"]
  node_chat_hf_local["Hugging Face local demo"]
end

subgraph group_embeddings["Embeddings"]
  node_embed_query["OpenAI query embedding"]
  node_embed_docs["OpenAI document embeddings"]
  node_embed_local["Local document embeddings"]
  node_similarity_embed["Similarity example embeddings"]
  node_similarity_rank["Cosine similarity ranking"]
end

node_openai_completion{{"OpenAI completion API"}}
node_openai_chat{{"OpenAI chat API"}}
node_anthropic_api{{"Anthropic API"}}
node_google_api{{"Google generative API"}}
node_hf_api{{"Hugging Face endpoint"}}
node_hf_local{{"Local Hugging Face model"}}
node_openai_embeddings{{"OpenAI embeddings API"}}
node_hf_embeddings{{"Local embedding model"}}

node_llm_demo -->|"invokes"| node_openai_completion
node_chat_openai -->|"invokes"| node_openai_chat
node_chat_anthropic -->|"invokes"| node_anthropic_api
node_chat_google -->|"invokes"| node_google_api
node_chat_hf_api -->|"invokes"| node_hf_api
node_chat_hf_local -->|"loads and invokes"| node_hf_local
node_embed_query -->|"embeds query"| node_openai_embeddings
node_embed_docs -->|"embeds documents"| node_openai_embeddings
node_embed_local -->|"embeds documents"| node_hf_embeddings
node_similarity_embed -->|"embeds query and documents"| node_openai_embeddings
node_similarity_embed -->|"scores vectors"| node_similarity_rank

click node_llm_demo "https://github.com/campusx-official/langchain-models/blob/master/1.LLMs/1_llm_demo.py"
click node_chat_openai "https://github.com/campusx-official/langchain-models/blob/master/2.ChatModels/1_chatmodel_openai.py"
click node_chat_anthropic "https://github.com/campusx-official/langchain-models/blob/master/2.ChatModels/2_chatmodel_anthropic.py"
click node_chat_google "https://github.com/campusx-official/langchain-models/blob/master/2.ChatModels/3_chatmodel_google.py"
click node_chat_hf_api "https://github.com/campusx-official/langchain-models/blob/master/2.ChatModels/4_chatmodel_hf_api.py"
click node_chat_hf_local "https://github.com/campusx-official/langchain-models/blob/master/2.ChatModels/5_chatmodel_hf_local.py"
click node_embed_query "https://github.com/campusx-official/langchain-models/blob/master/3.EmbeddingModels/1_embedding_openai_query.py"
click node_embed_docs "https://github.com/campusx-official/langchain-models/blob/master/3.EmbeddingModels/2_embedding_openai_docs.py"
click node_embed_local "https://github.com/campusx-official/langchain-models/blob/master/3.EmbeddingModels/3_embedding_hf_local.py"
click node_similarity_embed "https://github.com/campusx-official/langchain-models/blob/master/3.EmbeddingModels/4_document_similarity.py"
click node_similarity_rank "https://github.com/campusx-official/langchain-models/blob/master/3.EmbeddingModels/4_document_similarity.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_llm_demo toneBlue
class node_chat_openai,node_chat_anthropic,node_chat_google,node_chat_hf_api,node_chat_hf_local toneAmber
class node_embed_query,node_embed_docs,node_embed_local,node_similarity_embed,node_similarity_rank,node_openai_completion,node_openai_chat,node_anthropic_api,node_google_api,node_openai_embeddings toneMint
class node_hf_api,node_hf_local,node_hf_embeddings toneIndigo
```

## Components

### Text completion

- [OpenAI completion demo](https://github.com/campusx-official/langchain-models/blob/master/1.LLMs/1_llm_demo.py): `1.LLMs/1_llm_demo.py`

### Chat models

- [OpenAI chat demo](https://github.com/campusx-official/langchain-models/blob/master/2.ChatModels/1_chatmodel_openai.py): `2.ChatModels/1_chatmodel_openai.py`
- [Anthropic chat demo](https://github.com/campusx-official/langchain-models/blob/master/2.ChatModels/2_chatmodel_anthropic.py): `2.ChatModels/2_chatmodel_anthropic.py`
- [Google chat demo](https://github.com/campusx-official/langchain-models/blob/master/2.ChatModels/3_chatmodel_google.py): `2.ChatModels/3_chatmodel_google.py`
- [Hugging Face API demo](https://github.com/campusx-official/langchain-models/blob/master/2.ChatModels/4_chatmodel_hf_api.py): `2.ChatModels/4_chatmodel_hf_api.py`
- [Hugging Face local demo](https://github.com/campusx-official/langchain-models/blob/master/2.ChatModels/5_chatmodel_hf_local.py): `2.ChatModels/5_chatmodel_hf_local.py`

### Embeddings

- [OpenAI query embedding](https://github.com/campusx-official/langchain-models/blob/master/3.EmbeddingModels/1_embedding_openai_query.py): `3.EmbeddingModels/1_embedding_openai_query.py`
- [OpenAI document embeddings](https://github.com/campusx-official/langchain-models/blob/master/3.EmbeddingModels/2_embedding_openai_docs.py): `3.EmbeddingModels/2_embedding_openai_docs.py`
- [Local document embeddings](https://github.com/campusx-official/langchain-models/blob/master/3.EmbeddingModels/3_embedding_hf_local.py): `3.EmbeddingModels/3_embedding_hf_local.py`
- [Similarity example embeddings](https://github.com/campusx-official/langchain-models/blob/master/3.EmbeddingModels/4_document_similarity.py): `3.EmbeddingModels/4_document_similarity.py`
- [Cosine similarity ranking](https://github.com/campusx-official/langchain-models/blob/master/3.EmbeddingModels/4_document_similarity.py): `3.EmbeddingModels/4_document_similarity.py`

### Other components

- **OpenAI completion API**
- **OpenAI chat API**
- **Anthropic API**
- **Google generative API**
- **Hugging Face endpoint**
- **Local Hugging Face model**
- **OpenAI embeddings API**
- **Local embedding model**

## Connections

- OpenAI completion demo → OpenAI completion API: invokes (evidence: `1.LLMs/1_llm_demo.py`)
- OpenAI chat demo → OpenAI chat API: invokes (evidence: `2.ChatModels/1_chatmodel_openai.py`)
- Anthropic chat demo → Anthropic API: invokes (evidence: `2.ChatModels/2_chatmodel_anthropic.py`)
- Google chat demo → Google generative API: invokes (evidence: `2.ChatModels/3_chatmodel_google.py`)
- Hugging Face API demo → Hugging Face endpoint: invokes (evidence: `2.ChatModels/4_chatmodel_hf_api.py`)
- Hugging Face local demo → Local Hugging Face model: loads and invokes (evidence: `2.ChatModels/5_chatmodel_hf_local.py`)
- OpenAI query embedding → OpenAI embeddings API: embeds query (evidence: `3.EmbeddingModels/1_embedding_openai_query.py`)
- OpenAI document embeddings → OpenAI embeddings API: embeds documents (evidence: `3.EmbeddingModels/2_embedding_openai_docs.py`)
- Local document embeddings → Local embedding model: embeds documents (evidence: `3.EmbeddingModels/3_embedding_hf_local.py`)
- Similarity example embeddings → OpenAI embeddings API: embeds query and documents (evidence: `3.EmbeddingModels/4_document_similarity.py`)
- Similarity example embeddings → Cosine similarity ranking: scores vectors (evidence: `3.EmbeddingModels/4_document_similarity.py`)
