kstudiochat 1.0.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.
- kstudiochat-1.0.0/PKG-INFO +243 -0
- kstudiochat-1.0.0/README.md +213 -0
- kstudiochat-1.0.0/deployments/cli.py +318 -0
- kstudiochat-1.0.0/deployments/server.py +491 -0
- kstudiochat-1.0.0/deployments/start.py +22 -0
- kstudiochat-1.0.0/engine/__init__.py +57 -0
- kstudiochat-1.0.0/engine/__main__.py +5 -0
- kstudiochat-1.0.0/engine/audit.py +809 -0
- kstudiochat-1.0.0/engine/bot.py +632 -0
- kstudiochat-1.0.0/engine/config.py +255 -0
- kstudiochat-1.0.0/engine/curator.py +225 -0
- kstudiochat-1.0.0/engine/extension_base.py +48 -0
- kstudiochat-1.0.0/engine/extensions/__init__.py +28 -0
- kstudiochat-1.0.0/engine/extensions/adaptive.py +272 -0
- kstudiochat-1.0.0/engine/extensions/conversational_memory.py +285 -0
- kstudiochat-1.0.0/engine/extensions/live.py +420 -0
- kstudiochat-1.0.0/engine/extensions/multiagent.py +231 -0
- kstudiochat-1.0.0/engine/extensions/multimodal.py +218 -0
- kstudiochat-1.0.0/engine/extensions/predictive.py +187 -0
- kstudiochat-1.0.0/engine/extensions/rlhf.py +308 -0
- kstudiochat-1.0.0/engine/extensions/voice.py +312 -0
- kstudiochat-1.0.0/engine/llm.py +236 -0
- kstudiochat-1.0.0/engine/memory.py +253 -0
- kstudiochat-1.0.0/engine/modules/__init__.py +6 -0
- kstudiochat-1.0.0/engine/modules/cultural.py +78 -0
- kstudiochat-1.0.0/engine/modules/empathy.py +56 -0
- kstudiochat-1.0.0/engine/modules/ethics.py +96 -0
- kstudiochat-1.0.0/engine/modules/intent.py +85 -0
- kstudiochat-1.0.0/engine/modules/wcce.py +112 -0
- kstudiochat-1.0.0/engine/modules/xai.py +55 -0
- kstudiochat-1.0.0/engine/pack_context.py +110 -0
- kstudiochat-1.0.0/engine/personality.py +102 -0
- kstudiochat-1.0.0/engine/provider_runtime.py +163 -0
- kstudiochat-1.0.0/engine/retrieval.py +347 -0
- kstudiochat-1.0.0/engine/session.py +190 -0
- kstudiochat-1.0.0/engine/skills.py +559 -0
- kstudiochat-1.0.0/engine/templates.py +189 -0
- kstudiochat-1.0.0/engine/tools.py +227 -0
- kstudiochat-1.0.0/engine/utils.py +120 -0
- kstudiochat-1.0.0/engine/verification.py +204 -0
- kstudiochat-1.0.0/kstudiochat.egg-info/PKG-INFO +243 -0
- kstudiochat-1.0.0/kstudiochat.egg-info/SOURCES.txt +72 -0
- kstudiochat-1.0.0/kstudiochat.egg-info/dependency_links.txt +1 -0
- kstudiochat-1.0.0/kstudiochat.egg-info/entry_points.txt +2 -0
- kstudiochat-1.0.0/kstudiochat.egg-info/requires.txt +14 -0
- kstudiochat-1.0.0/kstudiochat.egg-info/top_level.txt +3 -0
- kstudiochat-1.0.0/pyproject.toml +60 -0
- kstudiochat-1.0.0/setup.cfg +4 -0
- kstudiochat-1.0.0/tests/test_adaptive.py +153 -0
- kstudiochat-1.0.0/tests/test_audit.py +198 -0
- kstudiochat-1.0.0/tests/test_context.py +88 -0
- kstudiochat-1.0.0/tests/test_conversational_memory.py +162 -0
- kstudiochat-1.0.0/tests/test_curator.py +162 -0
- kstudiochat-1.0.0/tests/test_extensions.py +114 -0
- kstudiochat-1.0.0/tests/test_integrations.py +126 -0
- kstudiochat-1.0.0/tests/test_kchat.py +618 -0
- kstudiochat-1.0.0/tests/test_live.py +234 -0
- kstudiochat-1.0.0/tests/test_memory.py +134 -0
- kstudiochat-1.0.0/tests/test_multiagent.py +99 -0
- kstudiochat-1.0.0/tests/test_multimodal.py +102 -0
- kstudiochat-1.0.0/tests/test_personality.py +83 -0
- kstudiochat-1.0.0/tests/test_predictive.py +100 -0
- kstudiochat-1.0.0/tests/test_provider_runtime.py +101 -0
- kstudiochat-1.0.0/tests/test_rlhf.py +200 -0
- kstudiochat-1.0.0/tests/test_session.py +191 -0
- kstudiochat-1.0.0/tests/test_skills.py +420 -0
- kstudiochat-1.0.0/tests/test_tools.py +108 -0
- kstudiochat-1.0.0/tests/test_voice.py +111 -0
- kstudiochat-1.0.0/widgets/integrations/__init__.py +26 -0
- kstudiochat-1.0.0/widgets/integrations/adapters.py +933 -0
- kstudiochat-1.0.0/widgets/integrations/base.py +112 -0
- kstudiochat-1.0.0/widgets/integrations/slack.py +144 -0
- kstudiochat-1.0.0/widgets/integrations/telegram.py +149 -0
- kstudiochat-1.0.0/widgets/integrations/whatsapp.py +141 -0
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: kstudiochat
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: K-CHAT — Universal Chatbot Engine. Anti-hallucination by construction.
|
|
5
|
+
Author: K-CHAT Contributors
|
|
6
|
+
License: MIT
|
|
7
|
+
Keywords: chatbot,rag,anti-hallucination,nlp,ai,framework,universal
|
|
8
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
18
|
+
Requires-Python: >=3.9
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
Provides-Extra: openai
|
|
21
|
+
Requires-Dist: openai>=1.0.0; extra == "openai"
|
|
22
|
+
Provides-Extra: deepseek
|
|
23
|
+
Requires-Dist: openai>=1.0.0; extra == "deepseek"
|
|
24
|
+
Provides-Extra: all
|
|
25
|
+
Requires-Dist: openai>=1.0.0; extra == "all"
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
28
|
+
Requires-Dist: pytest-cov>=4.0; extra == "dev"
|
|
29
|
+
Requires-Dist: pytest-asyncio>=0.21; extra == "dev"
|
|
30
|
+
|
|
31
|
+
# K-CHAT — Universal Chatbot Engine
|
|
32
|
+
|
|
33
|
+
**Zero-hallucination by construction.**
|
|
34
|
+
Drop a folder of documents. Get a chatbot. No ML expertise needed.
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
pip install kchat
|
|
38
|
+
kchat init ./helpdesk --template government
|
|
39
|
+
kchat chat --data ./helpdesk
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
**Three commands. Working bot. No API key required.**
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Quick Start
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
# Install
|
|
50
|
+
pip install kchat
|
|
51
|
+
|
|
52
|
+
# Create a bot from a pre-built template
|
|
53
|
+
kchat init ./my-bot --template restaurant
|
|
54
|
+
|
|
55
|
+
# Chat with it (uses SimulatedLLM — works offline, no API key)
|
|
56
|
+
kchat chat --data ./my-bot
|
|
57
|
+
|
|
58
|
+
# Or use OpenAI/DeepSeek
|
|
59
|
+
pip install kchat[openai]
|
|
60
|
+
# Edit my-bot/config.json → change llm.provider to "openai" or "deepseek"
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Available templates
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
kchat templates
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
| Template | Description |
|
|
70
|
+
|----------|-------------|
|
|
71
|
+
| `government` | FAQ bot for passports, permits, taxes |
|
|
72
|
+
| `restaurant` | Menu info, hours, reservations |
|
|
73
|
+
| `healthcare` | General health information and clinic FAQ |
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## How It Works
|
|
78
|
+
|
|
79
|
+
K-CHAT uses an **Industry Pack** — a folder of data files. No code changes needed to onboard a new domain.
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
my-industry-pack/
|
|
83
|
+
├── config.json # Bot identity, LLM choice, retrieval settings
|
|
84
|
+
├── intents.json # Intent taxonomy (optional)
|
|
85
|
+
├── refusal.json # Fallback responses + escalation contact
|
|
86
|
+
├── knowledge/ # Documents the bot answers from
|
|
87
|
+
│ ├── overview.md
|
|
88
|
+
│ └── faq.md
|
|
89
|
+
├── context/ # Style guides, policies (optional)
|
|
90
|
+
├── SOUL.md # Personality definition (optional)
|
|
91
|
+
├── skills/ # Custom Python workflows (optional)
|
|
92
|
+
└── tools/ # Custom API tools (optional)
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
The pipeline:
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
User Input → Sanitize → Ethics Check → Intent Classify → Emotion Detect
|
|
99
|
+
→ Cultural Adapt → Retrieve Knowledge → LLM (grounded prompt)
|
|
100
|
+
→ Anti-Hallucination Verify → Tone Apply → Response
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Anti-Hallucination
|
|
104
|
+
|
|
105
|
+
K-CHAT never asks the LLM to recall facts. It:
|
|
106
|
+
1. Injects only retrieved context into the prompt
|
|
107
|
+
2. Verifies every response against the source documents
|
|
108
|
+
3. Falls back to extractive answers if verification fails
|
|
109
|
+
|
|
110
|
+
Three verification strategies: **entity consistency**, **citation coverage**, **text overlap**.
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## CLI Reference
|
|
115
|
+
|
|
116
|
+
| Command | Description |
|
|
117
|
+
|---------|-------------|
|
|
118
|
+
| `kchat init <path>` | Create a new industry pack |
|
|
119
|
+
| `kchat init <path> --template <name>` | Create from pre-built template |
|
|
120
|
+
| `kchat templates` | List available templates |
|
|
121
|
+
| `kchat chat --data <path>` | Interactive chat in terminal |
|
|
122
|
+
| `kchat serve --data <path>` | REST API server (stdlib HTTP) |
|
|
123
|
+
| `kchat validate --data <path>` | Validate pack structure |
|
|
124
|
+
| `kchat curate --data <path>` | Audit knowledge quality |
|
|
125
|
+
| `kchat info --data <path>` | Show resolved config |
|
|
126
|
+
| `kchat audit --data <path>` | Full self-audit |
|
|
127
|
+
|
|
128
|
+
### Chat REPL
|
|
129
|
+
|
|
130
|
+
```
|
|
131
|
+
(My Bot) You > /help
|
|
132
|
+
/quit - Exit
|
|
133
|
+
/clear - Clear screen
|
|
134
|
+
/multiline - Enter multiline mode (end line with """)
|
|
135
|
+
/help - Show this help
|
|
136
|
+
|
|
137
|
+
(My Bot) You > What are your hours?
|
|
138
|
+
Bot: We are open Monday to Saturday: Lunch 11-2:30, Dinner 5-10.
|
|
139
|
+
sources: faq.md | confidence: High (0.93) | intent: info_lookup
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### REST API
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
kchat serve --data ./my-bot --port 8000
|
|
146
|
+
curl -X POST http://localhost:8000/chat \
|
|
147
|
+
-H 'Content-Type: application/json' \
|
|
148
|
+
-d '{"message": "What are your hours?"}'
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Endpoints: `GET /health`, `POST /chat`, `WS /ws`, `GET /info`
|
|
152
|
+
|
|
153
|
+
Auth: set `KCHAT_API_KEY` env var. Rate limit: set `KCHAT_RATE_LIMIT` (req/min).
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## Extensions
|
|
158
|
+
|
|
159
|
+
Enable via `config.json`:
|
|
160
|
+
|
|
161
|
+
```json
|
|
162
|
+
{
|
|
163
|
+
"extensions": {
|
|
164
|
+
"live": {"enabled": true},
|
|
165
|
+
"conversational_memory": {"enabled": true},
|
|
166
|
+
"multimodal": {"enabled": true},
|
|
167
|
+
"predictive": {"enabled": true}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
| Extension | What it does |
|
|
173
|
+
|-----------|-------------|
|
|
174
|
+
| `live` | Injects real-time data into context (prices, queues, sensors) |
|
|
175
|
+
| `conversational_memory` | Tracks user preferences, mood, relationship stage |
|
|
176
|
+
| `multiagent` | Routes queries to specialist agents |
|
|
177
|
+
| `multimodal` | Enhances emotion detection (text + optional voice/visual) |
|
|
178
|
+
| `adaptive` | Tracks strategy effectiveness, recommends adjustments |
|
|
179
|
+
| `predictive` | Assesses risk based on mood patterns and conversation signals |
|
|
180
|
+
| `rlhf` | Collects feedback and computes reward signals |
|
|
181
|
+
| `voice` | STT → Bot.chat() → TTS pipeline |
|
|
182
|
+
|
|
183
|
+
Import directly: `from engine.extensions.voice import VoiceManager`
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## Configuration
|
|
188
|
+
|
|
189
|
+
Minimal `config.json`:
|
|
190
|
+
|
|
191
|
+
```json
|
|
192
|
+
{
|
|
193
|
+
"name": "My Bot",
|
|
194
|
+
"persona": "Helpful, accurate, and concise.",
|
|
195
|
+
"llm": {"provider": "simulated"}
|
|
196
|
+
}
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Available LLM providers: `simulated` (default, offline), `openai`, `deepseek`.
|
|
200
|
+
|
|
201
|
+
Full config reference: `kchat info --data ./my-bot`
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## Deployment
|
|
206
|
+
|
|
207
|
+
### Railway
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
# Deploy from GitHub
|
|
211
|
+
# Set KCHAT_DATA=./my-bot
|
|
212
|
+
# Set PORT=8000
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### VPS / Docker
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
# Install, create pack, run server
|
|
219
|
+
pip install kchat
|
|
220
|
+
kchat init ./my-bot --template government
|
|
221
|
+
kchat serve --data ./my-bot --host 0.0.0.0 --port 8000
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### Vercel (serverless)
|
|
225
|
+
|
|
226
|
+
See `clients/nail-art/` for a working Vercel deployment example.
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
## Why K-CHAT?
|
|
231
|
+
|
|
232
|
+
| Instead of... | K-CHAT gives you... |
|
|
233
|
+
|--------------|-------------------|
|
|
234
|
+
| LangChain (framework) | A turnkey engine with a data contract |
|
|
235
|
+
| Building from scratch | Anti-hallucination out of the box |
|
|
236
|
+
| Paying per chatbot | One engine, infinite domains |
|
|
237
|
+
| Complex ML pipelines | Deterministic, auditable verification |
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
## License
|
|
242
|
+
|
|
243
|
+
MIT
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
# K-CHAT — Universal Chatbot Engine
|
|
2
|
+
|
|
3
|
+
**Zero-hallucination by construction.**
|
|
4
|
+
Drop a folder of documents. Get a chatbot. No ML expertise needed.
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
pip install kchat
|
|
8
|
+
kchat init ./helpdesk --template government
|
|
9
|
+
kchat chat --data ./helpdesk
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
**Three commands. Working bot. No API key required.**
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Quick Start
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
# Install
|
|
20
|
+
pip install kchat
|
|
21
|
+
|
|
22
|
+
# Create a bot from a pre-built template
|
|
23
|
+
kchat init ./my-bot --template restaurant
|
|
24
|
+
|
|
25
|
+
# Chat with it (uses SimulatedLLM — works offline, no API key)
|
|
26
|
+
kchat chat --data ./my-bot
|
|
27
|
+
|
|
28
|
+
# Or use OpenAI/DeepSeek
|
|
29
|
+
pip install kchat[openai]
|
|
30
|
+
# Edit my-bot/config.json → change llm.provider to "openai" or "deepseek"
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Available templates
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
kchat templates
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
| Template | Description |
|
|
40
|
+
|----------|-------------|
|
|
41
|
+
| `government` | FAQ bot for passports, permits, taxes |
|
|
42
|
+
| `restaurant` | Menu info, hours, reservations |
|
|
43
|
+
| `healthcare` | General health information and clinic FAQ |
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## How It Works
|
|
48
|
+
|
|
49
|
+
K-CHAT uses an **Industry Pack** — a folder of data files. No code changes needed to onboard a new domain.
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
my-industry-pack/
|
|
53
|
+
├── config.json # Bot identity, LLM choice, retrieval settings
|
|
54
|
+
├── intents.json # Intent taxonomy (optional)
|
|
55
|
+
├── refusal.json # Fallback responses + escalation contact
|
|
56
|
+
├── knowledge/ # Documents the bot answers from
|
|
57
|
+
│ ├── overview.md
|
|
58
|
+
│ └── faq.md
|
|
59
|
+
├── context/ # Style guides, policies (optional)
|
|
60
|
+
├── SOUL.md # Personality definition (optional)
|
|
61
|
+
├── skills/ # Custom Python workflows (optional)
|
|
62
|
+
└── tools/ # Custom API tools (optional)
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
The pipeline:
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
User Input → Sanitize → Ethics Check → Intent Classify → Emotion Detect
|
|
69
|
+
→ Cultural Adapt → Retrieve Knowledge → LLM (grounded prompt)
|
|
70
|
+
→ Anti-Hallucination Verify → Tone Apply → Response
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Anti-Hallucination
|
|
74
|
+
|
|
75
|
+
K-CHAT never asks the LLM to recall facts. It:
|
|
76
|
+
1. Injects only retrieved context into the prompt
|
|
77
|
+
2. Verifies every response against the source documents
|
|
78
|
+
3. Falls back to extractive answers if verification fails
|
|
79
|
+
|
|
80
|
+
Three verification strategies: **entity consistency**, **citation coverage**, **text overlap**.
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## CLI Reference
|
|
85
|
+
|
|
86
|
+
| Command | Description |
|
|
87
|
+
|---------|-------------|
|
|
88
|
+
| `kchat init <path>` | Create a new industry pack |
|
|
89
|
+
| `kchat init <path> --template <name>` | Create from pre-built template |
|
|
90
|
+
| `kchat templates` | List available templates |
|
|
91
|
+
| `kchat chat --data <path>` | Interactive chat in terminal |
|
|
92
|
+
| `kchat serve --data <path>` | REST API server (stdlib HTTP) |
|
|
93
|
+
| `kchat validate --data <path>` | Validate pack structure |
|
|
94
|
+
| `kchat curate --data <path>` | Audit knowledge quality |
|
|
95
|
+
| `kchat info --data <path>` | Show resolved config |
|
|
96
|
+
| `kchat audit --data <path>` | Full self-audit |
|
|
97
|
+
|
|
98
|
+
### Chat REPL
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
(My Bot) You > /help
|
|
102
|
+
/quit - Exit
|
|
103
|
+
/clear - Clear screen
|
|
104
|
+
/multiline - Enter multiline mode (end line with """)
|
|
105
|
+
/help - Show this help
|
|
106
|
+
|
|
107
|
+
(My Bot) You > What are your hours?
|
|
108
|
+
Bot: We are open Monday to Saturday: Lunch 11-2:30, Dinner 5-10.
|
|
109
|
+
sources: faq.md | confidence: High (0.93) | intent: info_lookup
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### REST API
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
kchat serve --data ./my-bot --port 8000
|
|
116
|
+
curl -X POST http://localhost:8000/chat \
|
|
117
|
+
-H 'Content-Type: application/json' \
|
|
118
|
+
-d '{"message": "What are your hours?"}'
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Endpoints: `GET /health`, `POST /chat`, `WS /ws`, `GET /info`
|
|
122
|
+
|
|
123
|
+
Auth: set `KCHAT_API_KEY` env var. Rate limit: set `KCHAT_RATE_LIMIT` (req/min).
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## Extensions
|
|
128
|
+
|
|
129
|
+
Enable via `config.json`:
|
|
130
|
+
|
|
131
|
+
```json
|
|
132
|
+
{
|
|
133
|
+
"extensions": {
|
|
134
|
+
"live": {"enabled": true},
|
|
135
|
+
"conversational_memory": {"enabled": true},
|
|
136
|
+
"multimodal": {"enabled": true},
|
|
137
|
+
"predictive": {"enabled": true}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
| Extension | What it does |
|
|
143
|
+
|-----------|-------------|
|
|
144
|
+
| `live` | Injects real-time data into context (prices, queues, sensors) |
|
|
145
|
+
| `conversational_memory` | Tracks user preferences, mood, relationship stage |
|
|
146
|
+
| `multiagent` | Routes queries to specialist agents |
|
|
147
|
+
| `multimodal` | Enhances emotion detection (text + optional voice/visual) |
|
|
148
|
+
| `adaptive` | Tracks strategy effectiveness, recommends adjustments |
|
|
149
|
+
| `predictive` | Assesses risk based on mood patterns and conversation signals |
|
|
150
|
+
| `rlhf` | Collects feedback and computes reward signals |
|
|
151
|
+
| `voice` | STT → Bot.chat() → TTS pipeline |
|
|
152
|
+
|
|
153
|
+
Import directly: `from engine.extensions.voice import VoiceManager`
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## Configuration
|
|
158
|
+
|
|
159
|
+
Minimal `config.json`:
|
|
160
|
+
|
|
161
|
+
```json
|
|
162
|
+
{
|
|
163
|
+
"name": "My Bot",
|
|
164
|
+
"persona": "Helpful, accurate, and concise.",
|
|
165
|
+
"llm": {"provider": "simulated"}
|
|
166
|
+
}
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Available LLM providers: `simulated` (default, offline), `openai`, `deepseek`.
|
|
170
|
+
|
|
171
|
+
Full config reference: `kchat info --data ./my-bot`
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## Deployment
|
|
176
|
+
|
|
177
|
+
### Railway
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
# Deploy from GitHub
|
|
181
|
+
# Set KCHAT_DATA=./my-bot
|
|
182
|
+
# Set PORT=8000
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### VPS / Docker
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
# Install, create pack, run server
|
|
189
|
+
pip install kchat
|
|
190
|
+
kchat init ./my-bot --template government
|
|
191
|
+
kchat serve --data ./my-bot --host 0.0.0.0 --port 8000
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### Vercel (serverless)
|
|
195
|
+
|
|
196
|
+
See `clients/nail-art/` for a working Vercel deployment example.
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## Why K-CHAT?
|
|
201
|
+
|
|
202
|
+
| Instead of... | K-CHAT gives you... |
|
|
203
|
+
|--------------|-------------------|
|
|
204
|
+
| LangChain (framework) | A turnkey engine with a data contract |
|
|
205
|
+
| Building from scratch | Anti-hallucination out of the box |
|
|
206
|
+
| Paying per chatbot | One engine, infinite domains |
|
|
207
|
+
| Complex ML pipelines | Deterministic, auditable verification |
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
## License
|
|
212
|
+
|
|
213
|
+
MIT
|