> ## Documentation Index
> Fetch the complete documentation index at: https://doc.lucidworks.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Part Number Detection use case

> 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. 



## OpenAPI

````yaml /api-reference/saas/machine-learning-platform-predict.json post /ai/prediction/part-number-detection/{CUSTOM_DEPLOYMENT_ID}
openapi: 3.0.1
info:
  title: Lucidworks AI Prediction API
  version: v0
  description: >-
    The Lucidworks AI Prediction API is used to send synchronous API calls that
    run predictions from pre-trained models or custom models.


    The Use Case API returns a list of all supported models.


    The `prediction` endpoints require an authentication token with scope
    `machinelearning.predict`.
  contact:
    name: Lucidworks
    url: https://lucidworks.com/
    email: support@lucidworks.com
  termsOfService: https://lucidworks.com/legal/developer-license-agreement/
  license:
    name: Lucidworks
    url: https://lucidworks.com/legal/developer-license-agreement/
servers:
  - url: https://APPLICATION_ID.applications.lucidworks.com
    description: Production
security: []
tags:
  - name: Get predictions
    description: Submit prediction tasks to Lucidworks AI.
paths:
  /ai/prediction/part-number-detection/{CUSTOM_DEPLOYMENT_ID}:
    post:
      tags:
        - Get predictions
      summary: Part Number Detection use case
      description: >-
        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. 
      operationId: post-ai-prediction-part-number-detection-customDeploymentId
      parameters:
        - in: path
          name: CUSTOM_DEPLOYMENT_ID
          required: true
          schema:
            type: string
          description: >-
            Unique deployment ID for the model. This use case is only supported
            with a custom-trained embedding model trained with the Part Number
            Classification data schema option.
          example: part-number-model-v1
        - in: header
          name: Authorization
          required: true
          schema:
            type: string
          description: >-
            Bearer token used for authentication with machinelearning.predict
            scope.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PartNumberRequest'
            example:
              batch:
                - text: 54956gf-98796v
                - text: bright pink sprinkles
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PartNumberResponse'
              example:
                predictions:
                  - tokensUsed:
                      inputTokens: 6
                      labelsTokens: 2
                    labels:
                      'true': 0.6388378143310547
                    response: 'true: 0.64'
                  - tokensUsed:
                      inputTokens: 4
                      labelsTokens: 2
                    labels:
                      'false': 0.6262129545211792
                    response: 'false: 0.63'
components:
  schemas:
    PartNumberRequest:
      title: PartNumberRequest
      type: object
      x-examples:
        Example 1:
          value:
            batch:
              - text: 54956gf-98796v
              - text: bright pink sprinkles
      properties:
        batch:
          type: array
          description: >-
            The batch of key:value pairs used as inputs in the prediction. Up to
            32 inputs per request are allowed.
          maxItems: 32
          items:
            type: object
            required:
              - text
            properties:
              text:
                type: string
                description: >-
                  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.
                example: 54956gf-98796v
        modelConfig:
          $ref: '#/components/schemas/ModelConfigPartNumber'
      required:
        - batch
    PartNumberResponse:
      type: object
      properties:
        predictions:
          type: array
          items:
            $ref: '#/components/schemas/PartNumberResponseTokens'
      x-examples:
        Example 1:
          value:
            predictions:
              - tokensUsed:
                  inputTokens: 6
                  labelsTokens: 2
                labels:
                  'true': 0.6388378143310547
                response: 'true: 0.64'
              - tokensUsed:
                  inputTokens: 4
                  labelsTokens: 2
                labels:
                  'false': 0.6262129545211792
                response: 'false: 0.63'
    ModelConfigPartNumber:
      title: ModelConfigPartNumber
      type: object
      description: Provides fields and values specific to part number detection prediction.
      properties:
        vectorQuantizatonMethod:
          type: integer
          description: >-
            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:
          type: boolean
          default: false
          description: >-
            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`.
          example: true
    PartNumberResponseTokens:
      type: object
      properties:
        response:
          type: string
          description: >-
            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.
          example: 'true: 0.64'
        labels:
          type: object
          description: >-
            Object containing the predicted label (`true` or `false`) as a key
            with its confidence score as the value.
          properties:
            'true':
              type: number
              description: Confidence score if predicted as a part number.
            'false':
              type: number
              description: Confidence score if predicted as not a part number.
        tokensUsed:
          type: object
          description: Token usage information for this prediction.
          properties:
            inputTokens:
              type: integer
              description: Number of input tokens used.
            labelsTokens:
              type: integer
              description: Number of label tokens used.

````