import requests
url = "https://application_id.applications.lucidworks.com/ai/prediction/part-number-detection/{CUSTOM_DEPLOYMENT_ID}"
payload = { "batch": [{ "text": "54956gf-98796v" }, { "text": "bright pink sprinkles" }] }
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"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"
}
]
}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.
import requests
url = "https://application_id.applications.lucidworks.com/ai/prediction/part-number-detection/{CUSTOM_DEPLOYMENT_ID}"
payload = { "batch": [{ "text": "54956gf-98796v" }, { "text": "bright pink sprinkles" }] }
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"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"
}
]
}Headers
Bearer token used for authentication with machinelearning.predict scope.
Path Parameters
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.
Body
The batch of key:value pairs used as inputs in the prediction. Up to 32 inputs per request are allowed.
32Show child attributes
Show child attributes
Provides fields and values specific to part number detection prediction.
Show child attributes
Show child attributes
Response
OK
Show child attributes
Show child attributes
Was this page helpful?