Keyword Extraction
Extracts keywords from the input text, PDF, HTML, EML, MBOX, MS Office document or image.#
/lmkit/v1/extract-keywordsAnalyzes the provided content to extract the most important keywords using the specified or default extraction model. Optional extraction parameters, such as desired keyword count, and text shrinking strategy, can be provided. Returns the extracted keywords 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 ·
| Property | Type | Description |
|---|---|---|
model | string | The identifier of the language model to be used for keyword extraction. If not provided, the default model is used. |
inputrequired | string | The input for keyword extraction. 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'. | |
text_shrinking_strategy | one of object · | |
keyword_count | object (int32) | The desired number of keywords to extract. Must be between 1 and 50; defaults to 5 if not specified. |
max_ngram_size | object (int32) | The maximum n-gram size for the extracted keywords. Must be between 1 and 20; defaults to 3 if not specified. |
guidance | string | Additional guidance text that can influence the extraction process (e.g., focusing on certain themes). |
target_language | Specifies the preferred language for the generated keywords. If set to 'Undefined', the engine attempts to automatically detect the input content language and produces the output accordingly (note: automatic detection may affect performance). When explicitly set, the engine attempts to interpret content and generate summaries in the selected language. |
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-keywords" \
-H "Authorization: Bearer $LMKIT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "",
"input": "",
"input_format": "PlainText",
"keyword_count": 5,
"max_ngram_size": 3
}'