The Lucidworks AI Generative AI Prompting Preview API returns Prediction API passthrough use case prompts before being sent to any generative AI (GenAI) model. This API is used to help debug passthrough use case prompts to ensure the input to the GenAI model is valid, and within the model’s processing limits.
Before the prompt is passed to the GenAI model, it may be formatted, truncated, expanded, or modified in other ways to meet that model’s requirements so the API call is successful.
These preprocessing steps are integral to deliver an optimized prompt that generates coherent and relevant responses. By examining the prompt after preprocessing, you can better understand how your input is being interpreted by the AI, which can help you refine your queries for more accurate and useful outputs. The input parameter keys and values are the same used in the Prediction API passthrough use case except for apiKey or similar authentication params, which must be provided for consistency. However, the model third-party API is not called, so those parameters are not used. You can enter placeholder values instead.
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 GenAI model name in the MODEL_ID field for the request. The path is: /ai/prompt/passthrough/MODEL_ID. For more information about supported models, see Generative AI models.

Common parameters and fields

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

useCaseConfig parameters

The request also uses the following useCaseConfig parameters:
useCaseConfig
object
If both useSystemPrompt and dataType are present, the value in dataType is used.

Example

The following example is a POST prompt request. Replace the values in the APPLICATION_ID, MODEL_ID, and ACCESS_TOKEN fields with your information.
curl --request POST \
  --url https://APPLICATION_ID.applications.lucidworks.com/ai/prompt/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 product classififcation task. Please, classify the provided product name into one of the following categories:\\nGROCERIES, FURNITURE, UNKNOWN\"}, {\"role\": \"user\", \"content\": \"chocolate milk\"}, {\"role\": \"assistant\", \"content\": \"GROCERIES\"}, {\"role\": \"user\", \"content\": \"chocolate table\"}, {\"role\": \"assistant\", \"content\": \"FURNITURE\"}, {\"role\": \"user\", \"content\": \"stone baked pizza\"}]"
        }
    ],
    "useCaseConfig": {
        "dataType": "json_prompt"
    },
    "modelConfig": {
        "apiKey": "fake"
    }
}'