LM-Kit OneDocs2026.8.10lm-kit.com
AI Analysis

Categorization

Determines the most relevant categories from the input text, PDF, HTML, EML, MBOX, MS Office document or image.#

POST/lmkit/v1/categorize

Analyzes the provided content to determine the most appropriate categories from the provided list using the specified or default model. Optional parameters, such as the desired number of top categories and additional guidance, can be provided. Returns the identified categories as defined in the response model. 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 ·

PropertyTypeDescription
modelstring

The identifier of the language model to be used for categorization. If not provided, the default model is used.

inputrequiredstring

The input for categorization. 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'.

categoriesrequiredstring[]

A collection of predefined categories. The API will determine the best match(es) from this list.

category_descriptionsstring[]

Optional semantic descriptions for each category. If provided, each description offers additional context or nuances that aid in categorization. The list must contain one entry per category in the 'categories' collection.

max_categoriesobject (int32)

The maximum number of top categories to return; defaults to 1 if not specified.

guidancestring

Additional guidance text that can influence the categorization process (e.g., focusing on certain themes).

Responses

StatusTypeDescription
200

OK

202

Accepted

400

Bad Request

500application/json

Internal Server Error

404

Not Found

curl -X POST "$LMKIT_ONE_URL/lmkit/v1/categorize" \
  -H "Authorization: Bearer $LMKIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "",
  "input": "",
  "input_format": "PlainText",
  "categories": [
    "string"
  ],
  "category_descriptions": [
    "string"
  ],
  "max_categories": 1
}'