Named Entity Recognition
Extracts named entities from the input text, PDF, HTML, EML, MBOX, MS Office document or image.#
/lmkit/v1/extract-entitiesAnalyzes the provided content to extract named entities (persons, organizations, locations, dates, monetary amounts, and more) using the specified or default model. Supports built-in entity types as well as custom labels. Returns the detected entities with label, value, positions, and confidence. If processing exceeds the configured timeout, returns 202 Accepted with a job_id. Poll GET /lmkit/v1/jobs/ for status and results.
Request body
application/json ·
| Property | Type | Description |
|---|---|---|
model | string | The identifier of the language model to be used for entity recognition. If not provided, the default model is used. |
inputrequired | string | The input for entity recognition. When input_format is 'PlainText', provide raw text. When 'Base64EncodedFile', provide a base64-encoded file payload (supported: HTML, PDF, XLSX, PPTX, DOCX, EML, MBOX, PNG, BMP, GIF, PSD, PIC, JPEG, PNM, HDR, TGA, WEBP, TIFF). When 'FileIdentifier', provide the file ID previously returned by the api/v1/files/upload endpoint. |
input_format | How the input is provided. Accepted values: 'PlainText', 'Base64EncodedFile', or 'FileIdentifier'. 'Base64EncodedFile' supports: HTML, PDF, XLSX, PPTX, DOCX, EML, MBOX, PNG, BMP, GIF, PSD, PIC, JPEG, PNM, HDR, TGA, WEBP, TIFF. 'FileIdentifier' references a file previously uploaded via api/v1/files/upload. Defaults to 'PlainText'. | |
enable_ocr | boolean | Whether to use OCR for pages that contain no extractable text (e.g., scanned images). Requires an OCR provider to be configured on the server. Defaults to true. |
guidance | string | Additional guidance text that can influence the recognition process (e.g., domain hints or formatting notes). |
built_in_types | [] | Optional list of built-in named entity types to detect (exclude 'Custom' and 'Other'). If omitted and no custom_labels are provided, all built-in types are considered. |
custom_labels | string[] | Optional list of custom entity labels (e.g., 'DiseaseName', 'ProductCode'). Each item must be a non-empty string. |
include_other_type | boolean | Whether to include the 'Other' catch-all entity category for entities that do not match any defined type. Defaults to false. |
Responses
| Status | Type | Description |
|---|---|---|
| 200 | OK | |
| 202 | Accepted | |
| 400 | Bad Request | |
| 500 | application/json | Internal Server Error |
| 404 | Not Found |
curl -X POST "$LMKIT_ONE_URL/lmkit/v1/extract-entities" \
-H "Authorization: Bearer $LMKIT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "",
"input": "",
"input_format": "PlainText",
"enable_ocr": true,
"guidance": ""
}'