import requests
url = "https://{APPLICATION_ID}.applications.lucidworks.com/ai/prediction/{USE_CASE}/{MODEL_ID}"
payload = {
"batch": [{ "text": "Not all those who wander are lost." }],
"useCaseConfig": { "labels": ["Harry Potter", "Lord of the Rings"] }
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"predictions": [
{
"tokensUsed": {
"inputTokens": 10,
"labelsTokens": 26
},
"labels": {
"Lord of the Rings": 0.40380859375,
"Harry Potter": 0.3681640625
},
"response": "Lord of the Rings: 0.40, Harry Potter: 0.37"
}
]
}Model predictions by use case
This is an all-purpose prediction endpoint you can use by specifying a USE_CASE and MODEL_ID.
IMPORTANT: The available use cases are detailed in their own section in this specification.
POST
/
ai
/
prediction
/
{USE_CASE}
/
{MODEL_ID}
import requests
url = "https://{APPLICATION_ID}.applications.lucidworks.com/ai/prediction/{USE_CASE}/{MODEL_ID}"
payload = {
"batch": [{ "text": "Not all those who wander are lost." }],
"useCaseConfig": { "labels": ["Harry Potter", "Lord of the Rings"] }
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"predictions": [
{
"tokensUsed": {
"inputTokens": 10,
"labelsTokens": 26
},
"labels": {
"Lord of the Rings": 0.40380859375,
"Harry Potter": 0.3681640625
},
"response": "Lord of the Rings: 0.40, Harry Potter: 0.37"
}
]
}Headers
Path Parameters
Body
application/json
Request information varies based on the use case in the request. See the specific use case for valid information for that use case.
Was this page helpful?