The Pass-through use case of the Lucidworks AI Async Prediction API lets you use the service as a proxy to the LLM. The service sends text (no additional prompts or other information) to the LLM and returns a response. The Pass-through use case contains two requests:
  • POST request - submits a prediction task for a specific useCase and modelId. The API responds with the following information:
    • predictionId. A unique UUID for the submitted prediction task that can be used later to retrieve the results.
    • status. The current state of the prediction task.
  • GET request - uses the predictionId you submit from a previously-submitted POST request and returns the results associated with that previous request.
For detailed API specifications in Swagger/OpenAPI format, see Platform APIs.

Prerequisites

To use this API, you need:
  • The unique APPLICATION_ID for your Lucidworks AI application. For more information, see credentials to use APIs.
  • A bearer token generated with a scope value of machinelearning.predict. For more information, see Authentication API.
  • The USE_CASE and MODEL_ID fields in the /async-prediction for the POST request. The path is /ai/async-prediction/USE_CASE/MODEL_ID. A list of supported modes is returned in the Lucidworks AI Use Case API. For more information about supported models, see Generative AI models.

Common POST request parameters and fields

Some parameters in the /ai/async-prediction/USE_CASE/MODEL_ID POST request are common to all of the generative AI (GenAI) use cases, such as the modelConfig parameter. Also referred to as hyperparameters, these fields set certain controls on the response. Refer to the API spec for more information.

Unique values for the pass-through use case

Some parameter values available in the pass-through use case are unique to this use case, including values for the useCaseConfig parameter. Refer to the API spec for more information.

Use System Prompt

useCaseConfig.useSystemPrompt
boolean
This parameter controls whether the LLM input is automatically wrapped with a system prompt or passed directly.Use this parameter if custom prompts are needed or if the prompt response format needs to be manipulated. Be aware that including a system prompt may increase response time.
Examples: POST example This useSystemPrompt POST example does not include modelConfig parameters, but you can submit requests that include parameters described in Common POST request parameters and fields.
curl --request POST \
  --url https://APPLICATION_ID.applications.lucidworks.com/ai/async-prediction/passthrough/MODEL_ID \
  --header 'Authorization: Bearer ACCESS_TOKEN' \
  --header 'Content-type: application/json' \
  --data '{
  "batch": [
    {
      "text": "who was the first president of the USA?"
      }
    ],
  "useCaseConfig": {
    "useSystemPrompt": true
    }
  }'
GET example
curl --request GET
--url https://APPLICATION_ID.applications.lucidworks.com/ai/async-prediction/PREDICTION_ID
--header 'Authorization: Bearer Auth '

Data Type

useCaseConfig.dataType
string
This optional parameter enables model-specific handling in the Async Prediction API to help improve model accuracy. Use the most applicable value based on available data and the data type that best aligns with the text sent to the API.
POST example This "dataType": "json_prompt"`` example does not include modelConfig` parameters, but you can submit requests that include parameters described in Common parameters and fields.
curl --request POST \
  --url https://APPLICATION_ID.applications.lucidworks.com/ai/async-prediction/passthrough/MODEL_ID \
  --header 'Authorization: Bearer ACCESS_TOKEN' \
  --header 'Content-type: application/json' \
  --data '{
   "batch": [
     {
       "text": "[{\"role\": \"system\", \"content\": \"You are a helpful utility program instructed to accomplish a word correction task. Provide the most likely suggestion to the user without a preamble or elaboration.\"}, {\"role\": \"user\", \"content\": \"misspeled\"}, {\"role\": \"assistant\", \"content\": \"CORRECT:\"}]"
       }
   ],
   "useCaseConfig" :{
     "dataType" : "json_prompt"
   }
}'
GET example
curl --request GET \
  --url https://APPLICATION_ID.applications.lucidworks.com/ai/async-prediction/fd110486-f168-47c0-a419-1518a4840589 \
  --header 'Authorization: Bearer ACCESS_TOKEN'