Offline Thai intent router in 1.1 MB: Thai or Thai-English text in, one of 15 intents out. Typo-tolerant, CPU only, no dependencies. Plus Thai TTS and music tools.
An offline Thai intent router in 1.1 MB: it reads one Thai or Thai-English message and returns one of 15 intents with a confidence score. CPU only, no runtime dependencies, no network. Typo correction is LLM-only via route_with_llm() (the former rule table has been removed).
Try it in the browser · Documentation index · Contributing · Good first issues · Project wiki on Wikova
pip install git+https://github.com/klanarongz2009-sketch/ter-ai.git
terai "เส็ดหรือยัง"
python -c "from terai_router import route; print(route('ช้วยบวก 15+27 หน้อย')['intent'])"
| Input (typos kept as typed) | Intent | Confidence | Normalized text |
|---|---|---|---|
เส็ดหรือยัง | status | 1.00 | เสร็จหรือยัง |
ช้วยบวก 15+27 หน้อย | calc | 1.00 | ช่วยบวก 15+27 หน้อย |
help me หน่อย | help | 0.99 | help me หน่อย |
พิมพิด แก้ใหม่ | fix | 1.00 | พิมพ์ผิด แก้ใหม่ |
ไม่เอาแล้ว | refuse | 1.00 | ไม่เอาแล้ว |
These rows are real output of terai "<text>" on v0.19.0. The 15 intents are calc, fix, forget, get_name, go_on, greet, help, random, refuse, set_name, stats, status, thanks, time and who.
Measured: 97.6% (121/124) on the frozen 124-sentence test set and 99.1% (111/112) on the held-out set, about 0.2 ms per message on one CPU thread (python training/evaluate.py). The three test-set misses are English name/number questions. This is an internal evaluation, not an independent benchmark; details in Results.
Use it as the first step of a Thai chatbot, a voice command, or an IoT switch: route the message, then run your own handler for that intent. Examples: examples/basic.py, examples/bot_router.py, examples/iot_switch.py.
The wider project also includes local chat, Thai speech (TTH, deprecated), SVG graphics (SANKPUP, deprecated) and music tools (MuML, deprecated); some optional components download models or use online services. See the sections below for exact offline scope, current release status, model/data licenses and limitations. Code and optional model/data licenses differ; check the license table before commercial use.
Project notice: TER-AI is an indie project and may pause or close with little warning. Read the project notice.
AI assistant: Developed with Wabi as main assistant since Dec 2026 (previously with Sesame).
TTH (every version: Wayu-Paxa-TTS-Edge, the edge-tts fallback and TTH-MTL) is deprecated, with end of service on 2026-11-30. MuML (MuML 1.0 WA and MUML 1.0 HIQ), Temmo 1.0 and SANKPUP are deprecated, with end of service on 2027-01-10.
terai subcommand starts (terai tth, terai chat --speak, terai muml --hiq, terai muml-wa, terai temmo, terai sankpup) and raises a DeprecationWarning once per process in Python (on import of terai_router.muml_wa, terai_router.muml_hiq or terai_router.temmo, on the first terai_router.sankpup.generate() call, and when a terai_router.tth.TTH or engine object is created).main, with their tabs in the browser demo. Releases tagged before that date keep them.terai chat --speak (chat without --speak is not affected) the MUML 1.0 HIQ split engine (TTH Wayu speech) and the voice clips that Temmo makes with TTH by default (games are still made without TTH, only without voice clips). The browser demo's "Speak replies (TTH)" switch uses the browser's Web Speech API, not TTH. Tagentic1 and its Telegram bot do not use TTH.src/terai_router/tth.py, docs/tth.js, its tests and eval cases) is MIT (none of these files carries a TER-AI License marker), which allows commercial use and AI training as long as the copyright and license notice is kept; the Wayu-Paxa-TTS-Edge weights belong to Paxa Labs / Wayu Research under CC-BY-NC-4.0 plus the Wayu Research Acceptable Use terms (non-commercial, attribution required; TER-AI cannot relicense them); the OmniVoice weights used by TTH-MTL are CC-BY-NC from k2-fsa, with the Boson Higgs Audio 2 Community License for its audio tokenizer. Both weight sets are non-commercial, so commercial users of either Wayu or TTH-MTL must use other weights or get permission from that weight owner. The MIT code itself has no such limit; edge-tts is a separate LGPL-3.0 library that sends text to Microsoft's online service under that service's own terms. Details are in NOTICE items 1, 2 and 15.TEMUX BUG
https://github.com/klanarongz2009-sketch/ter-ai/issues/33
Labels: None
Router misses three English name/number questions in the test set
https://github.com/klanarongz2009-sketch/ter-ai/issues/21
Labels: enhancement, help wanted, get-ideas
TERAI1 memory recall works in-session, but misses exact-output instruction
https://github.com/klanarongz2009-sketch/ter-ai/issues/10
Labels: get-ideas
Announcement: TERM AI limited-time trial (until 2027-01-01 00:00 UTC+7)
https://github.com/klanarongz2009-sketch/ter-ai/issues/6
Labels: get-ideas, announcement
Define SANKPUP core unknowns before architecture lock
https://github.com/klanarongz2009-sketch/ter-ai/issues/5
Labels: documentation, enhancement, help wanted, good first issue, invalid, question, wontfix, get-ideas
Web Demo: UI text leaks into name capture and corrupts session memory
https://github.com/klanarongz2009-sketch/ter-ai/issues/4
Labels: bug, get-ideas
ขอ gemini4
https://github.com/klanarongz2009-sketch/ter-ai/issues/3
Labels: get-ideas
(TEST USER)ขอ gemini4
https://github.com/klanarongz2009-sketch/ter-ai/issues/2
Labels: get-ideas
Thanks for looking. The easiest place to start is the intent router: LLM typo correction, test cases and docs. Open tasks are labelled good first issue and help wanted.
The maintainer is a boarding-school student and cannot use a phone or computer during school terms. Replies to issues and pull requests can take days or weeks. Read the project notice.
Two AI helpers run by the maintainer may reply before a human does:
Their replies are suggestions and can be wrong. They do not merge pull requests, publish releases or make project decisions; the maintainer does.
Python 3.11 or newer. The core package has no runtime dependencies.
git clone https://github.com/klanarongz2009-sketch/ter-ai.git
cd ter-ai
python -m venv .venv && . .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -e ".[dev]"
pytest -q # real speech and real model runs are opt-in and show as skipped
python training/evaluate.py # router accuracy on the frozen test and held-out sets
python eval/parity.py # needs Node.js: checks the browser (JS) and Python versions agree
A pull request should keep pytest green and should not lower the numbers from training/evaluate.py.
Typo correction is entirely LLM-based now (the former rule table
src/terai_router/data/typo_pairs.json has been removed). Do not add typo
pairs or context rules. To change correction behaviour, edit the LLM system
prompt in src/terai_router/intent_llm.py (LLM_CORRECT_SYSTEM) and the
Ollama Modelfiles in ollama/, then add a test to
tests/test_intent_llm.py with a fake client. normalize() only collapses
repeated characters now.
tests/, for example a route('...')['intent'] == '...' assertion.eval/test_set.json or eval/heldout_v07.json. They are frozen so results stay comparable
across versions; eval/router_report.py prints their hashes.main.README.th.md) may use their target language; the English version remains canonical unless the project says otherwise. Thai examples are welcome in tests.main and say what you changed and how you tested it.Code is MIT. Some data and optional model weights use other licenses; see the license table in the README and NOTICE. By contributing you agree that your contribution is released under the license of the file you change. Do not add files you do not have the right to share.