Skip to main content

K-CHAT — Universal Chatbot Engine. Anti-hallucination by construction.

Project description

K-CHAT — Universal Chatbot Engine

Zero-hallucination chatbot engine. Folder-based. No ML expertise needed.

pip install kstudiochat
kstudiochat init ./bot --template restaurant
kstudiochat chat --data ./bot

Three commands. Working bot. No API key required (SimulatedLLM built-in).


Quick Start

# Install
pip install kstudiochat

# Create a bot from a pre-built template
kstudiochat init ./bot --template government

# Chat (uses SimulatedLLM — offline, no API key)
kstudiochat chat --data ./bot

# Or use a real LLM
pip install kstudiochat[openai]
# Edit bot/config.json → llm.provider: "openai" | "deepseek" | "mimo"

Templates

Template Description
government FAQ for passports, permits, taxes
restaurant Menu, hours, reservations
healthcare General health info, clinic FAQ

How It Works

Drop a folder. Get a chatbot. No code.

my-bot/
├── config.json       # Bot identity, LLM provider
├── knowledge/        # Documents the bot answers from
│   ├── faq.md
│   └── pricing.md
├── SOUL.md           # Personality (optional)
├── intents.json      # Keywords (optional)
└── refusal.json      # Fallback messages (optional)

Pipeline

User → Sanitize → Ethics → Intent → Feed ALL data → LLM → Verify → Response

Three-gate prompt:

  • Gate 1 — Greeting/thanks/farewell → LLM without data (natural)
  • Gate 2 — Questions → LLM with all knowledge chunks
  • Gate 3 — Out of scope → Polite redirect

Anti-Hallucination

  • Grounded prompt: LLM answers only from provided data
  • Verification: entity consistency + overlap check
  • Refusal detection: catches "I don't know" responses
  • Ethical guard: blocks harmful content

LLM Providers

Provider Model Config
Simulated (built-in, offline) simulated Default — no setup
OpenAI gpt-4o-mini Set OPENAI_API_KEY
DeepSeek deepseek-v4-flash Set DEEPSEEK_API_KEY
Xiaomi MiMo mimo-v2-flash Set MIMO_API_KEY
"llm": {"provider": "mimo", "model": "mimo-v2-flash", "temperature": 0.3}

CLI Reference

Command Description
kstudiochat init <path> Create a new pack
kstudiochat init <path> --template <name> Create from template
kstudiochat templates List templates
kstudiochat chat --data <path> Interactive chat
kstudiochat serve --data <path> REST API server
kstudiochat validate --data <path> Validate pack
kstudiochat info --data <path> Show config

Multi-Tenant API (for clients)

K-CHAT can run as a multi-tenant API — clients upload their data and get a chatbot endpoint.

Endpoints

Method Path Description
POST /api/packs Upload zip → get API key
POST /api/chat Chat with bot (Authorization: Bearer kc_xxx)
DELETE /api/packs/:id Delete pack
GET /api/widget.js?key=xxx Widget embed snippet

Client embed (shared hosting)

<div id="kchat-widget"></div>
<script src="https://your-api.url/api/widget.js?key=kc_xxx"></script>

Direct API usage

curl -X POST https://your-api.url/api/chat \
  -H "Authorization: Bearer kc_xxx" \
  -H "Content-Type: application/json" \
  -d '{"message": "What are your hours?"}'

Extensions

Config-driven, enabled via config.json:

"extensions": {
  "conversational_memory": {"enabled": true},
  "predictive": {"enabled": true},
  "multimodal": {"enabled": true}
}
Extension What it does
conversational_memory Tracks user preferences, mood
multimodal Enhances emotion detection
predictive Flags risky interactions
live Injects real-time data
adaptive Tracks strategy effectiveness
rlhf Collects feedback
voice STT → chat → TTS pipeline

Why K-CHAT?

Instead of... K-CHAT gives you
LangChain Folder-based data contract, zero code
Building from scratch Anti-hallucination out of the box
SaaS chatbots ($30+/mo) One-time deploy, free to run
ML pipelines Deterministic, auditable verification

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kstudiochat-1.1.0.tar.gz (122.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kstudiochat-1.1.0-py3-none-any.whl (116.8 kB view details)

Uploaded Python 3

File details

Details for the file kstudiochat-1.1.0.tar.gz.

File metadata

  • Download URL: kstudiochat-1.1.0.tar.gz
  • Upload date:
  • Size: 122.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for kstudiochat-1.1.0.tar.gz
Algorithm Hash digest
SHA256 d091010f534563a7dbea4d4c67a7eeccae2683b18d35dab25e8b12221fd061d9
MD5 8a76fa7fa9a562ba9cb0d5f643a4e991
BLAKE2b-256 da2a09c4975b7acdc617760a6f6fe1c4a031b82f4eef8cb856271132753e9701

See more details on using hashes here.

File details

Details for the file kstudiochat-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: kstudiochat-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 116.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for kstudiochat-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7b0dae528ea66c2a722bd16e42c25ee7d4c3e60baa806691dbce3c6d9d815ac0
MD5 bc61cfd8f997ad2bd7e2d30166dedf68
BLAKE2b-256 17391e49acac7a91955360464c8feef078ceb38a6bc005d7d8dba29adf688e6c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page