Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Temicide/thcode/llms.txt

Use this file to discover all available pages before exploring further.

Named Entity Recognition (NER) is the language-category specialist service in thcode’s AI for Thai catalog. It analyzes Thai text — or text mixing Thai and other scripts — and identifies spans that represent named entities such as people, places, and organizations, returning each entity with its label and character offset. This is useful whenever thcode needs to reason about proper nouns embedded in Thai source code comments, documentation strings, user-facing copy, or natural-language task descriptions.
NER is catalogued in this release. It is discoverable and fully inspectable via /tools, but the endpoint mapping, live transport, and contract test are a subsequent integration phase. Invoking the service now returns a stub refusal: "Catalogued — Not available yet".NER is a member of the Verification Quartet — the four services required to pass live contract tests in Phase 1. It is verified coverage, but it is not part of the public Demo Portfolio. See ADR 0011 for the distinction.

Service Identity

FieldValue
Service IDnamed-entity-recognition
Upstream nameNamed Entity Recognition
Thai nameการรู้จำเอนทิตี
Categorylanguage
Modalitytext
Endpointhttps://api.aiforthai.in.th/thainer
Support levelcatalogued
Contract ver.1.0.0
Adapter ver.1.0.0

Search Terms

The router matches NER against the following terms. You can use any of them in the /tools search command:
ner   entity   แยกชื่อ   language

Handler: Input Contract

The NerSpecialistHandler builds a transport request from a text artifact. The handler reads the first prepared artifact, preferring the text property and falling back to extractedText when text is absent. The plain text string is then sent as a JSON body.
Request body sent to the NER endpoint
{
  "text": "นายสมชาย ใจดี ทำงานที่บริษัท ไทยเทค จำกัด ในกรุงเทพมหานคร"
}
The request is dispatched as an authenticated POST to https://api.aiforthai.in.th/thainer with:
  • Authorization: Bearer <key> — the raw API key is resolved in scope only and never appears in Evidence, logs, or the secret-free headersSummary (which shows [redacted]).
  • Content-Type: application/json
If the artifact is absent or the text is empty, the handler throws before a transport call is made.

Handler: Output Contract

The NerSpecialistHandler maps the upstream JSON response into two typed SpecialistFieldValue fields:
Kind: structuredMapped from the entities array in the upstream response. Each element must be a non-null, non-array object with both text: string and label: string properties to be kept — elements missing either field are dropped. Valid entities are wrapped verbatim (including the optional offset property) in { items: [...] }.
{
  "kind": "structured",
  "value": {
    "items": [
      { "text": "สมชาย ใจดี",    "label": "PERSON",       "offset": 3 },
      { "text": "ไทยเทค จำกัด",   "label": "ORGANIZATION", "offset": 28 },
      { "text": "กรุงเทพมหานคร",  "label": "LOCATION",     "offset": 47 },
      { "text": "สมหญิง รักเรียน","label": "PERSON",       "offset": 88 },
      { "text": "สนามบินสุวรรณภูมิ","label": "LOCATION",   "offset": 107 }
    ]
  },
  "present": true
}
The handler never fabricates entities or labels. If the upstream array is empty or contains no valid elements, the field is present: false and listed in emptyFields.

Fixture

The handler ships with a deterministic, built-in (non-user) fixture for health probes. The canary uses text/plain as the media type and sends the following Thai/mixed-language text containing known names, organizations, and locations:
นายสมชาย ใจดี ทำงานที่บริษัท ไทยเทค จำกัด ในกรุงเทพมหานคร
เมื่อวันที่ 15 มกราคม 2024 เขาได้พบกับ คุณสมหญิง รักเรียน ที่สนามบินสุวรรณภูมิ
The fixture’s expected entities are:
TextLabelOffset
สมชาย ใจดีPERSON3
ไทยเทค จำกัดORGANIZATION28
กรุงเทพมหานครLOCATION47
สมหญิง รักเรียนPERSON88
สนามบินสุวรรณภูมิLOCATION107
Expected confidence: 0.92. Any media type other than text/plain is rejected before the probe is dispatched.

Use Cases

Code Comments & Docstrings

Identify Thai proper nouns in inline comments or JSDoc/TSDoc blocks so Typhoon can reference them accurately in generated code or documentation.

User-Facing Strings

Detect names, places, and organizations in Thai UI copy or localization files, enabling targeted string substitution or validation.

Natural-Language Task Descriptions

Extract entities from a Thai task description before it is passed to the reasoning model, enriching the context with structured provenance.

Pipeline Chaining

Feed a Speech-to-Text transcript directly into NER to identify entities in spoken Thai — combining two specialist services in a single task flow.

Using /tools with NER

Inspect the NER catalog entry
/tools inspect named-entity-recognition
Search for language or entity services
/tools search ner
/tools search แยกชื่อ
The inspect output will show invokable: false with reason "Catalogued — Not available yet". Attempting to invoke NER before integration is complete will produce a pre-transport refusal — no network call is made.

Phase 1 Role

NER is a member of the Verification Quartet — the four services required to pass live contract tests before the Phase 1 prototype is considered fully verified. It is verified coverage, but it is not in the public Demo Portfolio: T-OCR, Speech-to-Text, and Extract Address carry the three independent demo scenarios. See ADR 0011 for details on the distinction between verified coverage and demo-certification.

Build docs developers (and LLMs) love