chatvat 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- chatvat-0.1.0/LICENSE +17 -0
- chatvat-0.1.0/PKG-INFO +235 -0
- chatvat-0.1.0/README.md +194 -0
- chatvat-0.1.0/chatvat/__init__.py +0 -0
- chatvat-0.1.0/chatvat/bot_template/.dockerignore +32 -0
- chatvat-0.1.0/chatvat/bot_template/Dockerfile +55 -0
- chatvat-0.1.0/chatvat/bot_template/docker-compose.yml +0 -0
- chatvat-0.1.0/chatvat/bot_template/requirements.txt +50 -0
- chatvat-0.1.0/chatvat/bot_template/src/__init__.py +0 -0
- chatvat-0.1.0/chatvat/bot_template/src/main.py +155 -0
- chatvat-0.1.0/chatvat/builder.py +241 -0
- chatvat-0.1.0/chatvat/config_loader.py +74 -0
- chatvat-0.1.0/chatvat/config_schema.py +58 -0
- chatvat-0.1.0/chatvat/connectors/crawler.py +82 -0
- chatvat-0.1.0/chatvat/connectors/loader.py +83 -0
- chatvat-0.1.0/chatvat/constants.py +20 -0
- chatvat-0.1.0/chatvat/core/engine.py +131 -0
- chatvat-0.1.0/chatvat/core/ingestor.py +147 -0
- chatvat-0.1.0/chatvat/core/vector.py +128 -0
- chatvat-0.1.0/chatvat/main.py +301 -0
- chatvat-0.1.0/chatvat/utils/__init__.py +0 -0
- chatvat-0.1.0/chatvat/utils/logger.py +64 -0
- chatvat-0.1.0/pyproject.toml +69 -0
chatvat-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Copyright (c) 2025 Madhav Kapila
|
|
2
|
+
|
|
3
|
+
All Rights Reserved.
|
|
4
|
+
|
|
5
|
+
NOTICE: All information contained herein is, and remains the property of Madhav Kapila.
|
|
6
|
+
The intellectual and technical concepts contained herein are proprietary to Madhav Kapila
|
|
7
|
+
and may be covered by Indian and Foreign Patents, patents in process, and are protected
|
|
8
|
+
by trade secret or copyright law.
|
|
9
|
+
|
|
10
|
+
Dissemination of this information or reproduction of this material is strictly forbidden
|
|
11
|
+
unless prior written permission is obtained from Madhav Kapila.
|
|
12
|
+
|
|
13
|
+
Access to the source code contained herein is hereby granted to anyone to use strictly
|
|
14
|
+
for educational or private testing purposes. You may not copy, modify, distribute,
|
|
15
|
+
sell, or lease any part of our services or included software, nor may you reverse
|
|
16
|
+
engineer or attempt to extract the source code of that software, unless you have
|
|
17
|
+
written permission.
|
chatvat-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: chatvat
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: The Universal RAG Chatbot Factory. Zero-dependency AI deployments.
|
|
5
|
+
License: Proprietary
|
|
6
|
+
Author: Madhav Kapila
|
|
7
|
+
Author-email: smartatk04@gmail.com
|
|
8
|
+
Requires-Python: >=3.11,<4.0
|
|
9
|
+
Classifier: License :: Other/Proprietary License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
16
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
17
|
+
Requires-Dist: beautifulsoup4 (>=4.12.0,<5.0.0)
|
|
18
|
+
Requires-Dist: chromadb (>=0.5.0,<0.6.0)
|
|
19
|
+
Requires-Dist: crawl4ai (>=0.4.0,<0.5.0)
|
|
20
|
+
Requires-Dist: fastapi (>=0.109.0,<0.110.0)
|
|
21
|
+
Requires-Dist: langchain (>=0.3.0,<0.4.0)
|
|
22
|
+
Requires-Dist: langchain-chroma (>=0.2.0,<0.3.0)
|
|
23
|
+
Requires-Dist: langchain-community (>=0.3.0,<0.4.0)
|
|
24
|
+
Requires-Dist: langchain-groq (>=0.2.0,<0.3.0)
|
|
25
|
+
Requires-Dist: langchain-huggingface (>=0.1.0,<0.2.0)
|
|
26
|
+
Requires-Dist: langchain-openai (>=0.2.0,<0.3.0)
|
|
27
|
+
Requires-Dist: openai (>=1.10.0,<2.0.0)
|
|
28
|
+
Requires-Dist: playwright (>=1.40.0,<2.0.0)
|
|
29
|
+
Requires-Dist: pydantic (>=2.0.0,<3.0.0)
|
|
30
|
+
Requires-Dist: pyfiglet (>=1.0.2,<2.0.0)
|
|
31
|
+
Requires-Dist: pypdf (>=4.0.0,<5.0.0)
|
|
32
|
+
Requires-Dist: python-dotenv (>=1.0.0,<2.0.0)
|
|
33
|
+
Requires-Dist: requests (>=2.31.0,<3.0.0)
|
|
34
|
+
Requires-Dist: rich (>=13.7.0,<14.0.0)
|
|
35
|
+
Requires-Dist: tiktoken (>=0.7.0,<0.8.0)
|
|
36
|
+
Requires-Dist: typer[all] (>=0.12.3,<0.13.0)
|
|
37
|
+
Requires-Dist: uvicorn[standard] (>=0.27.0,<0.28.0)
|
|
38
|
+
Project-URL: Homepage, https://github.com/madhavkapila
|
|
39
|
+
Project-URL: Repository, https://github.com/madhavkapila/ChatVat.git
|
|
40
|
+
Description-Content-Type: text/markdown
|
|
41
|
+
|
|
42
|
+
# ChatVat đźŹ
|
|
43
|
+
> **The Universal RAG Chatbot Factory**
|
|
44
|
+
|
|
45
|
+
[](#license)
|
|
46
|
+
[](https://www.python.org/)
|
|
47
|
+
[](https://www.docker.com/)
|
|
48
|
+
[](https://github.com/psf/black)
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## 🌟 The Vision
|
|
53
|
+
|
|
54
|
+
**ChatVat** is not just another chatbot script. It is a **Manufacturing Plant** for self-contained AI systems.
|
|
55
|
+
|
|
56
|
+
It solves the "It works on my machine" problem by adhering to a strict **"Zero-Dependency"** philosophy. ChatVat takes your raw data sources—websites, APIs, and documents—and fuses them with a production-grade RAG engine into a sealed Docker container. This "capsule" contains everything needed to run: the code, the database, the browser, and the API server.
|
|
57
|
+
|
|
58
|
+
You can deploy a ChatVat bot anywhere: from a MacBook Air to an air-gapped server in Antarctica, without installing Python or git.
|
|
59
|
+
|
|
60
|
+
### Core Philosophy
|
|
61
|
+
* **Production Parity:** The bot you test locally is bit-for-bit identical to the bot you deploy.
|
|
62
|
+
* **Source Injection:** The engine code is "injected" directly into the container during the build. No external git clones or PyPI downloads are required inside the image.
|
|
63
|
+
* **Self-Healing:** Built-in deduplication (MD5 Hashing), crash recovery, and "Ghost Entry" prevention.
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## ⚡ Quick Start
|
|
68
|
+
|
|
69
|
+
### 1. Installation
|
|
70
|
+
Install the ChatVat CLI from the source (or your private registry).
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
pip install chatvat
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### 2. Initialize the Assembly Line
|
|
77
|
+
Create a clean directory for your new bot and run the configuration wizard.
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
mkdir my-crypto-bot
|
|
81
|
+
cd my-crypto-bot
|
|
82
|
+
chatvat init
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
*The wizard will guide you through:*
|
|
86
|
+
* **Naming your bot**
|
|
87
|
+
* **Setting up AI Brain** (Groq Llama-3 + HuggingFace Embeddings)
|
|
88
|
+
* **Connecting Data Sources** (URLs, APIs, or Local Files)
|
|
89
|
+
* **Defining Deployment Ports**
|
|
90
|
+
|
|
91
|
+
### 3. Build the Capsule
|
|
92
|
+
Compile your configuration and the ChatVat engine into a Docker Image.
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
chatvat build
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
> **What happens here?** > The CLI locates the `chatvat` library on your system, copies the core engine code into a build context, injects your `chatvat.config.json`, and triggers a Docker build. The result is a sealed image containing your specific bot.
|
|
99
|
+
|
|
100
|
+
### 4. Deploy Anywhere
|
|
101
|
+
Run your bot using standard Docker commands. It injects your API keys at runtime for security.
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
# Example: Running on Port 8000
|
|
105
|
+
docker run -d \
|
|
106
|
+
-p 8000:8000 \
|
|
107
|
+
--env-file .env \
|
|
108
|
+
--name crypto-bot \
|
|
109
|
+
chatvat-bot
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## đź§ Architecture Deep Dive
|
|
115
|
+
|
|
116
|
+
ChatVat implements a modular **RAG (Retrieval-Augmented Generation)** pipeline designed for resilience.
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
### The Components
|
|
120
|
+
|
|
121
|
+
| Component | Role | Description |
|
|
122
|
+
| :--- | :--- | :--- |
|
|
123
|
+
| **The Cortex** | Intelligence | Powered by **Groq** for ultra-fast inference using the model of your choice and **HuggingFace** for embeddings. |
|
|
124
|
+
| **The Memory** | Vector Store | A persistent, thread-safe **ChromaDB** instance. It uses MD5 hashing to prevent duplicate data entry. |
|
|
125
|
+
| **The Eyes** | Crawler | A headless **Chromium** browser (via Crawl4AI/Playwright) capable of reading dynamic JS-heavy websites. |
|
|
126
|
+
| **The Nervous System** | Ingestor | A background worker that auto-updates knowledge every `X` minutes (configurable). |
|
|
127
|
+
| **The API** | Interface | A high-performance **FastAPI** server exposing REST endpoints. |
|
|
128
|
+
|
|
129
|
+
### The "Source Injection" Workflow
|
|
130
|
+
|
|
131
|
+
Unlike traditional builds that `pip install` libraries from the internet, ChatVat performs **Source Injection**:
|
|
132
|
+
|
|
133
|
+
1. **Locate:** The CLI finds where `chatvat` is installed on your host machine.
|
|
134
|
+
2. **Extract:** It copies the raw Python source code of the engine.
|
|
135
|
+
3. **Inject:** It places this code into the `/app` directory of the Docker container.
|
|
136
|
+
4. **Seal:** The Dockerfile sets `PYTHONPATH=/app`, making the injected code instantly executable without installation.
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## 🛠️ Configuration Guide
|
|
141
|
+
|
|
142
|
+
Your bot is defined by `chatvat.config.json`. You can edit this file manually after running `init`.
|
|
143
|
+
|
|
144
|
+
```json
|
|
145
|
+
{
|
|
146
|
+
"bot_name": "ChatVatBot",
|
|
147
|
+
"port": 8000,
|
|
148
|
+
"refresh_interval_minutes": 60,
|
|
149
|
+
"system_prompt": "You are a helpful assistant for the .....",
|
|
150
|
+
"llm_model": "llama-3.1-70b-versatile",
|
|
151
|
+
"embedding_model": "all-MiniLM-L6-v2",
|
|
152
|
+
"sources": [
|
|
153
|
+
{
|
|
154
|
+
"type": "static_url",
|
|
155
|
+
"target": "[https://www.amazon.com/gp/bestsellers/books/ref=zg_bs_nav](https://www.amazon.com/gp/bestsellers/books/ref=zg_bs_nav)"
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
"type": "dynamic_json",
|
|
159
|
+
"target": "[https://YOUR_API_ENDPOINT](https://YOUR_API_ENDPOINT)",
|
|
160
|
+
"headers": {
|
|
161
|
+
"Authorization": "Bearer ${API_KEY}"
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"type": "local_file",
|
|
166
|
+
"target": "./policy_docs.pdf"
|
|
167
|
+
}
|
|
168
|
+
]
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
* **`refresh_interval_minutes`**: Set to `0` to disable auto-updates.
|
|
173
|
+
* **`sources`**: Supports `static_url` (Websites), `dynamic_json` (REST APIs), and `local_file` (PDF/TXT).
|
|
174
|
+
* **`headers`**: Can use `${VAR_NAME}` syntax to reference environment variables from your `.env` file.
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## 📚 API Reference
|
|
179
|
+
|
|
180
|
+
Once the container is running, interact with it via HTTP REST API.
|
|
181
|
+
|
|
182
|
+
### 1. Health Check
|
|
183
|
+
Used by cloud balancers (AWS/Render) to verify the bot is alive.
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
GET /health
|
|
187
|
+
```
|
|
188
|
+
**Response:**
|
|
189
|
+
```json
|
|
190
|
+
{
|
|
191
|
+
"status": "healthy",
|
|
192
|
+
"version": "0.1.0"
|
|
193
|
+
}
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### 2. Chat Interface
|
|
197
|
+
The main endpoint for sending queries.
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
POST /chat
|
|
201
|
+
```
|
|
202
|
+
**Payload:**
|
|
203
|
+
```json
|
|
204
|
+
{
|
|
205
|
+
"message": "What events are happening on Day 1?"
|
|
206
|
+
}
|
|
207
|
+
```
|
|
208
|
+
**Response:**
|
|
209
|
+
```json
|
|
210
|
+
{
|
|
211
|
+
"message": "On Day 1, the opening ceremony starts at 10 AM..."
|
|
212
|
+
}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
## ⚖️ License & Proprietary Notice
|
|
218
|
+
|
|
219
|
+
**Copyright © 2025 Madhav Kapila. All Rights Reserved.**
|
|
220
|
+
|
|
221
|
+
This software is **Proprietary (Closed Source)**.
|
|
222
|
+
|
|
223
|
+
* **Usage:** You are granted a limited license to use this tool for educational, private testing, or internal business purposes.
|
|
224
|
+
* **Restrictions:**
|
|
225
|
+
* You **MAY NOT** copy, modify, redistribute, sell, or lease any part of the `chatvat` source code.
|
|
226
|
+
* You **MAY NOT** reverse engineer or attempt to extract the source code.
|
|
227
|
+
* You **MAY NOT** upload this package to public registries (like PyPI) or public repositories (like GitHub) without prior written permission.
|
|
228
|
+
|
|
229
|
+
*All intellectual property rights remain exclusively with Madhav Kapila.*
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
<p align="center">
|
|
234
|
+
Built with ❤️ by the <b>ChatVat Factory</b>.
|
|
235
|
+
</p>
|
chatvat-0.1.0/README.md
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
# ChatVat đźŹ
|
|
2
|
+
> **The Universal RAG Chatbot Factory**
|
|
3
|
+
|
|
4
|
+
[](#license)
|
|
5
|
+
[](https://www.python.org/)
|
|
6
|
+
[](https://www.docker.com/)
|
|
7
|
+
[](https://github.com/psf/black)
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## 🌟 The Vision
|
|
12
|
+
|
|
13
|
+
**ChatVat** is not just another chatbot script. It is a **Manufacturing Plant** for self-contained AI systems.
|
|
14
|
+
|
|
15
|
+
It solves the "It works on my machine" problem by adhering to a strict **"Zero-Dependency"** philosophy. ChatVat takes your raw data sources—websites, APIs, and documents—and fuses them with a production-grade RAG engine into a sealed Docker container. This "capsule" contains everything needed to run: the code, the database, the browser, and the API server.
|
|
16
|
+
|
|
17
|
+
You can deploy a ChatVat bot anywhere: from a MacBook Air to an air-gapped server in Antarctica, without installing Python or git.
|
|
18
|
+
|
|
19
|
+
### Core Philosophy
|
|
20
|
+
* **Production Parity:** The bot you test locally is bit-for-bit identical to the bot you deploy.
|
|
21
|
+
* **Source Injection:** The engine code is "injected" directly into the container during the build. No external git clones or PyPI downloads are required inside the image.
|
|
22
|
+
* **Self-Healing:** Built-in deduplication (MD5 Hashing), crash recovery, and "Ghost Entry" prevention.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## ⚡ Quick Start
|
|
27
|
+
|
|
28
|
+
### 1. Installation
|
|
29
|
+
Install the ChatVat CLI from the source (or your private registry).
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pip install chatvat
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### 2. Initialize the Assembly Line
|
|
36
|
+
Create a clean directory for your new bot and run the configuration wizard.
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
mkdir my-crypto-bot
|
|
40
|
+
cd my-crypto-bot
|
|
41
|
+
chatvat init
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
*The wizard will guide you through:*
|
|
45
|
+
* **Naming your bot**
|
|
46
|
+
* **Setting up AI Brain** (Groq Llama-3 + HuggingFace Embeddings)
|
|
47
|
+
* **Connecting Data Sources** (URLs, APIs, or Local Files)
|
|
48
|
+
* **Defining Deployment Ports**
|
|
49
|
+
|
|
50
|
+
### 3. Build the Capsule
|
|
51
|
+
Compile your configuration and the ChatVat engine into a Docker Image.
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
chatvat build
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
> **What happens here?** > The CLI locates the `chatvat` library on your system, copies the core engine code into a build context, injects your `chatvat.config.json`, and triggers a Docker build. The result is a sealed image containing your specific bot.
|
|
58
|
+
|
|
59
|
+
### 4. Deploy Anywhere
|
|
60
|
+
Run your bot using standard Docker commands. It injects your API keys at runtime for security.
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
# Example: Running on Port 8000
|
|
64
|
+
docker run -d \
|
|
65
|
+
-p 8000:8000 \
|
|
66
|
+
--env-file .env \
|
|
67
|
+
--name crypto-bot \
|
|
68
|
+
chatvat-bot
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## đź§ Architecture Deep Dive
|
|
74
|
+
|
|
75
|
+
ChatVat implements a modular **RAG (Retrieval-Augmented Generation)** pipeline designed for resilience.
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
### The Components
|
|
79
|
+
|
|
80
|
+
| Component | Role | Description |
|
|
81
|
+
| :--- | :--- | :--- |
|
|
82
|
+
| **The Cortex** | Intelligence | Powered by **Groq** for ultra-fast inference using the model of your choice and **HuggingFace** for embeddings. |
|
|
83
|
+
| **The Memory** | Vector Store | A persistent, thread-safe **ChromaDB** instance. It uses MD5 hashing to prevent duplicate data entry. |
|
|
84
|
+
| **The Eyes** | Crawler | A headless **Chromium** browser (via Crawl4AI/Playwright) capable of reading dynamic JS-heavy websites. |
|
|
85
|
+
| **The Nervous System** | Ingestor | A background worker that auto-updates knowledge every `X` minutes (configurable). |
|
|
86
|
+
| **The API** | Interface | A high-performance **FastAPI** server exposing REST endpoints. |
|
|
87
|
+
|
|
88
|
+
### The "Source Injection" Workflow
|
|
89
|
+
|
|
90
|
+
Unlike traditional builds that `pip install` libraries from the internet, ChatVat performs **Source Injection**:
|
|
91
|
+
|
|
92
|
+
1. **Locate:** The CLI finds where `chatvat` is installed on your host machine.
|
|
93
|
+
2. **Extract:** It copies the raw Python source code of the engine.
|
|
94
|
+
3. **Inject:** It places this code into the `/app` directory of the Docker container.
|
|
95
|
+
4. **Seal:** The Dockerfile sets `PYTHONPATH=/app`, making the injected code instantly executable without installation.
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## 🛠️ Configuration Guide
|
|
100
|
+
|
|
101
|
+
Your bot is defined by `chatvat.config.json`. You can edit this file manually after running `init`.
|
|
102
|
+
|
|
103
|
+
```json
|
|
104
|
+
{
|
|
105
|
+
"bot_name": "ChatVatBot",
|
|
106
|
+
"port": 8000,
|
|
107
|
+
"refresh_interval_minutes": 60,
|
|
108
|
+
"system_prompt": "You are a helpful assistant for the .....",
|
|
109
|
+
"llm_model": "llama-3.1-70b-versatile",
|
|
110
|
+
"embedding_model": "all-MiniLM-L6-v2",
|
|
111
|
+
"sources": [
|
|
112
|
+
{
|
|
113
|
+
"type": "static_url",
|
|
114
|
+
"target": "[https://www.amazon.com/gp/bestsellers/books/ref=zg_bs_nav](https://www.amazon.com/gp/bestsellers/books/ref=zg_bs_nav)"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"type": "dynamic_json",
|
|
118
|
+
"target": "[https://YOUR_API_ENDPOINT](https://YOUR_API_ENDPOINT)",
|
|
119
|
+
"headers": {
|
|
120
|
+
"Authorization": "Bearer ${API_KEY}"
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"type": "local_file",
|
|
125
|
+
"target": "./policy_docs.pdf"
|
|
126
|
+
}
|
|
127
|
+
]
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
* **`refresh_interval_minutes`**: Set to `0` to disable auto-updates.
|
|
132
|
+
* **`sources`**: Supports `static_url` (Websites), `dynamic_json` (REST APIs), and `local_file` (PDF/TXT).
|
|
133
|
+
* **`headers`**: Can use `${VAR_NAME}` syntax to reference environment variables from your `.env` file.
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## 📚 API Reference
|
|
138
|
+
|
|
139
|
+
Once the container is running, interact with it via HTTP REST API.
|
|
140
|
+
|
|
141
|
+
### 1. Health Check
|
|
142
|
+
Used by cloud balancers (AWS/Render) to verify the bot is alive.
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
GET /health
|
|
146
|
+
```
|
|
147
|
+
**Response:**
|
|
148
|
+
```json
|
|
149
|
+
{
|
|
150
|
+
"status": "healthy",
|
|
151
|
+
"version": "0.1.0"
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### 2. Chat Interface
|
|
156
|
+
The main endpoint for sending queries.
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
POST /chat
|
|
160
|
+
```
|
|
161
|
+
**Payload:**
|
|
162
|
+
```json
|
|
163
|
+
{
|
|
164
|
+
"message": "What events are happening on Day 1?"
|
|
165
|
+
}
|
|
166
|
+
```
|
|
167
|
+
**Response:**
|
|
168
|
+
```json
|
|
169
|
+
{
|
|
170
|
+
"message": "On Day 1, the opening ceremony starts at 10 AM..."
|
|
171
|
+
}
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## ⚖️ License & Proprietary Notice
|
|
177
|
+
|
|
178
|
+
**Copyright © 2025 Madhav Kapila. All Rights Reserved.**
|
|
179
|
+
|
|
180
|
+
This software is **Proprietary (Closed Source)**.
|
|
181
|
+
|
|
182
|
+
* **Usage:** You are granted a limited license to use this tool for educational, private testing, or internal business purposes.
|
|
183
|
+
* **Restrictions:**
|
|
184
|
+
* You **MAY NOT** copy, modify, redistribute, sell, or lease any part of the `chatvat` source code.
|
|
185
|
+
* You **MAY NOT** reverse engineer or attempt to extract the source code.
|
|
186
|
+
* You **MAY NOT** upload this package to public registries (like PyPI) or public repositories (like GitHub) without prior written permission.
|
|
187
|
+
|
|
188
|
+
*All intellectual property rights remain exclusively with Madhav Kapila.*
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
<p align="center">
|
|
193
|
+
Built with ❤️ by the <b>ChatVat Factory</b>.
|
|
194
|
+
</p>
|
|
File without changes
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# FILE: chatvat/bot_template/.dockerignore
|
|
2
|
+
|
|
3
|
+
# 1. Security (Never copy secrets into the image)
|
|
4
|
+
.env
|
|
5
|
+
.env.*
|
|
6
|
+
*.key
|
|
7
|
+
*.pem
|
|
8
|
+
|
|
9
|
+
# 2. Python Cache & compiled files
|
|
10
|
+
__pycache__
|
|
11
|
+
*.pyc
|
|
12
|
+
*.pyo
|
|
13
|
+
*.pyd
|
|
14
|
+
.Python
|
|
15
|
+
env/
|
|
16
|
+
venv/
|
|
17
|
+
.venv/
|
|
18
|
+
pip-log.txt
|
|
19
|
+
pip-delete-this-directory.txt
|
|
20
|
+
|
|
21
|
+
# 3. System / IDE files
|
|
22
|
+
.git
|
|
23
|
+
.gitignore
|
|
24
|
+
.idea/
|
|
25
|
+
.vscode/
|
|
26
|
+
.DS_Store
|
|
27
|
+
|
|
28
|
+
# 4. Local Data (Don't overwrite production DB with local testing DB)
|
|
29
|
+
data/
|
|
30
|
+
chroma_db/
|
|
31
|
+
|
|
32
|
+
.env
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# FILE: chatvat/bot_template/Dockerfile
|
|
2
|
+
|
|
3
|
+
FROM python:3.11-slim
|
|
4
|
+
|
|
5
|
+
# 1. Set Environment Variables FIRST
|
|
6
|
+
ENV PYTHONUNBUFFERED=1 \
|
|
7
|
+
PYTHONDONTWRITEBYTECODE=1 \
|
|
8
|
+
PLAYWRIGHT_BROWSERS_PATH=/usr/local/share/ms-playwright
|
|
9
|
+
|
|
10
|
+
# 2. Install System Dependencies (Required for Chrome to run)
|
|
11
|
+
# We do this early so it's cached.
|
|
12
|
+
RUN apt-get update && apt-get install -y \
|
|
13
|
+
curl \
|
|
14
|
+
build-essential \
|
|
15
|
+
libasound2 \
|
|
16
|
+
libatk-bridge2.0-0 \
|
|
17
|
+
libgtk-3-0 \
|
|
18
|
+
libnss3 \
|
|
19
|
+
libx11-xcb1 \
|
|
20
|
+
libxss1 \
|
|
21
|
+
libxtst6 \
|
|
22
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
23
|
+
|
|
24
|
+
WORKDIR /app
|
|
25
|
+
|
|
26
|
+
# 3. Install Python Dependencies (INCLUDES PLAYWRIGHT PACKAGE)
|
|
27
|
+
# This MUST happen before we try to use 'python -m playwright'
|
|
28
|
+
COPY requirements.txt .
|
|
29
|
+
RUN pip install --no-cache-dir -r requirements.txt
|
|
30
|
+
|
|
31
|
+
# 4. NOW Install the Browsers (The "Eyes")
|
|
32
|
+
# Since pip install is done, 'python -m playwright' will now work.
|
|
33
|
+
RUN mkdir -p $PLAYWRIGHT_BROWSERS_PATH && \
|
|
34
|
+
python -m playwright install --with-deps chromium && \
|
|
35
|
+
chmod -R 755 $PLAYWRIGHT_BROWSERS_PATH
|
|
36
|
+
|
|
37
|
+
# 5. Inject Source Code (The "Brain")
|
|
38
|
+
COPY . .
|
|
39
|
+
|
|
40
|
+
# 6. Runtime Configuration
|
|
41
|
+
ENV PYTHONPATH=/app
|
|
42
|
+
|
|
43
|
+
# 7. Security (Non-root user)
|
|
44
|
+
RUN useradd -m -u 1000 chatvat-user && \
|
|
45
|
+
mkdir -p /app/data && \
|
|
46
|
+
chown -R chatvat-user:chatvat-user /app
|
|
47
|
+
|
|
48
|
+
USER chatvat-user
|
|
49
|
+
EXPOSE 8000
|
|
50
|
+
|
|
51
|
+
# 8. Healthcheck & Start
|
|
52
|
+
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
|
|
53
|
+
CMD curl -f http://localhost:8000/health || exit 1
|
|
54
|
+
|
|
55
|
+
CMD ["python", "src/main.py"]
|
|
File without changes
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# FILE: chatvat/bot_template/requirements.txt
|
|
2
|
+
|
|
3
|
+
# This MUST be at the top. It tells pip to look for wheels in the CPU repository first.
|
|
4
|
+
# Prevents downloading massive CUDA (GPU) libraries, saving ~3GB of space.
|
|
5
|
+
--extra-index-url https://download.pytorch.org/whl/cpu
|
|
6
|
+
torch
|
|
7
|
+
torchvision
|
|
8
|
+
|
|
9
|
+
# --- Core API Server ---
|
|
10
|
+
# We use 'standard' to get 'uvicorn' and optimized JSON parsers automatically.
|
|
11
|
+
# This replaces the need for a separate 'uvicorn' entry.
|
|
12
|
+
fastapi[standard]>=0.109.0
|
|
13
|
+
python-dotenv>=1.0.0
|
|
14
|
+
|
|
15
|
+
# --- The "Eyes" (Crawling Engine) ---
|
|
16
|
+
beautifulsoup4
|
|
17
|
+
# This runs the background crawling loop inside the container.
|
|
18
|
+
# We need 'crawl4ai' for the headless browser logic.
|
|
19
|
+
crawl4ai>=0.4.0
|
|
20
|
+
# 'playwright' is usually installed by crawl4ai, but we list it explicitily
|
|
21
|
+
# to ensure the container has the core engine ready.
|
|
22
|
+
playwright>=1.40.0
|
|
23
|
+
|
|
24
|
+
# --- The "Brain" (RAG & Vector DB) ---
|
|
25
|
+
# We use ChromaDB for local vector storage.
|
|
26
|
+
chromadb>=0.4.22
|
|
27
|
+
# Specialized splitters for Markdown (better than generic text splitters).
|
|
28
|
+
langchain-text-splitters>=0.0.1
|
|
29
|
+
langchain-chroma>=0.1.0
|
|
30
|
+
|
|
31
|
+
# --- The "Intelligence" (LLM Integration) ---
|
|
32
|
+
# Specific integration for Groq (Llama-3 models).
|
|
33
|
+
langchain-groq>=0.0.1
|
|
34
|
+
# For generating embeddings (e.g., HuggingFace models).
|
|
35
|
+
langchain-huggingface>=0.0.1
|
|
36
|
+
huggingface-hub
|
|
37
|
+
# Core LangChain utilities
|
|
38
|
+
langchain-core>=0.1.0
|
|
39
|
+
sentence-transformers
|
|
40
|
+
langchain>=0.2.0
|
|
41
|
+
langchain-community
|
|
42
|
+
|
|
43
|
+
# --- Utilities ---
|
|
44
|
+
# For robust async HTTP calls (used by our JSON loader).
|
|
45
|
+
aiohttp>=3.9.0
|
|
46
|
+
# For structural validation (Pydantic V2).
|
|
47
|
+
pydantic>=2.5.0
|
|
48
|
+
|
|
49
|
+
# For RAG source aas file reading
|
|
50
|
+
pypdf>=4.0.0
|
|
File without changes
|