---
title: "Named Entity Recognition (NER) use case"
method: POST
path: "/ai/prediction/ner/{MODEL_ID}"
tags: ["Get predictions"]
---

# Named Entity Recognition (NER) use case

`POST /ai/prediction/ner/{MODEL_ID}`

In the Named Entity Recognition (NER) use case, the LLM ingests text and entities to extract and return a JSON response that contains a list of entities extracted from the text. No options can be configured.

This use case can be used to extract nouns and proper nouns such as Brand, Date, Company, Places, and Category in order to guide and refine searches.

## Headers

- `Authorization` string, required
- `Content-Type` string

## Request body

- NerRequest
  - `batch` object[] — The batch of key:value pairs used as inputs in the prediction. Up to 32 inputs per request are allowed.
    - `text` string — The content the model analyzes.
  - `useCaseConfig` UseCaseConfigNer
    - `entityTypeMap` object
      - `entity` string[] — "entity": [exampleA, exampleB], "entity1": [exampleC, exampleD] For example: "Location": ["India", "South Africa"] This parameter provides a map with entity type as a key with a list of example values to search. The entity type is required, but example values are optional and can be empty. Multiple entities with examples can be entered in the request. In the <a href="https://doc.lucidworks.com/fusion/5.9/bzik28/lwai-prediction">LWAI Prediction index stage</a> and the <a href="https://doc.lucidworks.com/fusion/5.9/hnuyky/lwai-prediction">LWAI Prediction query stage</a>, the `useCaseConfig entityTypeMap` parameter only supports a string. Therefore, the string entered in Fusion is converted to a JSON string, which is required in the Lucidworks AI `entityTypeMap` variable.
  - `modelConfig` ModelConfig — Provides fields and values that specify ranges for tokens.
    - `vectorQuantizationMethod` string — Vector quantization compresses data size, as well as reducing memory usage. The methods are: * `min-max` - Creates tensors of the text and converts it to uint8 by normalizing it to the range [0, 255]. * `max-scale` - Finds the maximum absolute value for the encoded text, normalizes it by scaling the text to a range of -127 to 127, and then returns the quantized text as an 8-bit integer tensor.
    - `dimReductionSize` integer — Used to reduce vector size while maintaining good quality. This field allows any integer above 0, but less than or equal to the vector dimension of the model. If you send a vector dimension larger than the model, a 400 Bad Request error is returned. Not every model is designed to support this parameter. In this scenario, a warning message is generated that indicates quality can decrease.

## Response `200`

OK

- NerResponse
  - `predictions` NerResponseTokens[]
    - `tokensUsed` Token
      - `promptTokens` integer — The number of tokens generated to prompt the model to continue generating results.
      - `completionTokens` integer — The number of tokens used until the model completes.
      - `totalTokens` integer — The sum of the prompt and completion tokens used in the model.
    - `entities` object
      - `entity` string[] — The result of the requested entity type that was a key with a list of example values to search. For example: { "Location": [ "Porbandar", "India", "South Africa" ] }
    - `response` string — The results returned from the request.

---

[API](https://skmtc.dev/lucidworks/apis/rules-rewrites-api.md) · [All operations](https://skmtc.dev/lucidworks/apis/rules-rewrites-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/lucidworks/rules-rewrites-api/revisions/f2d3747848e8/schema)
