---
title: "Part Number Detection use case"
method: POST
path: "/ai/prediction/part-number-detection/{CUSTOM_DEPLOYMENT_ID}"
tags: ["Get predictions"]
---

# Part Number Detection use case

`POST /ai/prediction/part-number-detection/{CUSTOM_DEPLOYMENT_ID}`

## Request

- Base URL: `https://commerce_studio_id.experiencemanager.lucidworks.com`
- URL: `https://commerce_studio_id.experiencemanager.lucidworks.com/ai/prediction/part-number-detection/{CUSTOM_DEPLOYMENT_ID}`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/lucidworks/apis/rules-rewrites-api/docs/ai/prediction/part-number-detection/:CUSTOM_DEPLOYMENT_ID/post.ts> (a function with typed inputs; its response is checked against the schema)

The Part Number Detection use case of the LWAI Prediction API detects part numbers in order to help with query routing and classification, and uses the embedding model to ingest text and return a JSON response of `true` if the input is a part number, or `false` if the input is not a part number.

## Path parameters

- `CUSTOM_DEPLOYMENT_ID` string, required

## Headers

- `Authorization` string, required

## Request body

- PartNumberRequest
  - `batch` object[], required: The batch of key:value pairs used as inputs in the prediction. Up to 32 inputs per request are allowed.
    - `text` string, required: The query text to analyze for part number identification. This text is freeform content contained in the document. If you have content in multiple fields that would be valuable, such as title and body, please concatenate the relevant fields to a single field before inputting to the parameter.
  - `modelConfig` ModelConfigPartNumber: Provides fields and values specific to part number detection prediction.
    - `vectorQuantizatonMethod` integer: Quantization is implemented by converting float vectors into integer vectors, allowing for byte vector search using 8-bit integers. The methods are named min-max and max-scale. The min-max method creates tensors of embeddings and converts them to uint8 by normalizing them to the range [0, 255]. The max-scale method finds the maximum absolute value along each embedding, normalizes the embeddings by scaling them to a range of -127 to 127, and returns the quantized embeddings as an 8-bit integer tensor.
    - `lowercaseInput` boolean: This parameter is optional, and controls how submitted text becomes vectors. If `lowercaseInput` is set to `true`, inputs are set to lowercase before encoding, so variation in embeddings is not introduced (which makes similarity search more stable and predictable). Default value is `false`.

## Response `200`

OK

- PartNumberResponse
  - `predictions` PartNumberResponseTokens[]
    - `response` string: The prediction result in the format `label: confidence` where label is either `true` or `false`, and confidence is a decimal value between 0 and 1.
    - `labels` object: Object containing the predicted label (`true` or `false`) as a key with its confidence score as the value.
      - `true` number: Confidence score if predicted as a part number.
      - `false` number: Confidence score if predicted as not a part number.
    - `tokensUsed` object: Token usage information for this prediction.
      - `inputTokens` integer: Number of input tokens used.
      - `labelsTokens` integer: Number of label tokens used.

---

[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.dev/lucidworks/apis/rules-rewrites-api/revisions/f2d3747848e8?raw)
