Product Selector

Fusion 5.9
    Fusion 5.9

    Summarization use caseLucidworks AI Async Prediction API

    In the Summarization use case of the Lucidworks AI Async Prediction API, the LLM ingests text and returns a summary of the text as a response.

    The context length is 2048 tokens. No options can be configured.

    This use case can be used to condense the text of a large document into a summarized response.

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

    To view the full configuration specification for an API, click the View API specification button.

    view api spec

    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 summarization use case

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

    Example POST request

    This 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/summarization/MODEL_ID \
      --header 'Authorization: Bearer ACCESS_TOKEN' \
      --header 'Content-type: application/json' \
      --data '{
      "batch": [
        {
          "text": "Nearly ten years had passed since the Dursleys had woken up to find their nephew on the front step, but Privet Drive had hardly changed at all. The sun rose on the same tidy front gardens and lit up the brass number four on the Dursleys'\'' front door; it crept into their living room, which was almost exactly the same as it had been on the night when Mr. Dursley had seen that fateful news report about the owls. Only the photographs on the mantelpiece really showed how much time had passed. Ten years ago, there had been lots of pictures of what looked like a large pink beach ball wearing different-colored bonnets - but Dudley Dursley was no longer a baby, and now the photographs showed a large blond boy riding his first bicycle, on a carousel at the fair, playing a computer game with his father, being hugged and kissed by his mother. The room held no sign at all that another boy lived in the house, too."
          },
      ],
        "useCaseConfig": {
          "maxWords": 100
        }
    }'

    The following is an example of a successful response:

    {
    	"predictionId": "fd110486-f168-47c0-a419-1518a4840589",
    	"status": "SUBMITTED"
    }

    The following is an example of an error response:

    {
    	"predictionId": "fd110486-f168-47c0-a419-1518a4840589",
    	"status": "ERROR",
    	"message": "System prompt exceeded the maximum number of allowed input tokens: 81 vs -1091798"
    }

    Example GET request

    curl --request GET
    --url https://APPLICATION_ID.applications.lucidworks.com/ai/async-prediction/PREDICTION_ID
    --header 'Authorization: Bearer Auth '

    The following is an example response:

    {
      "predictionId": "fd110486-f168-47c0-a419-1518a4840589",
      "status": "READY",
      "predictions": [
        {
          "tokensUsed": {
           "promptTokens": 248,
           "completionTokens": 65,
           "totalTokens": 313
           },
          "response": "A decade after the Dursleys found their nephew on their doorstep, Privet Drive remains largely unchanged. The only noticeable difference is in the family photographs, which now depict Dudley Dursley as a large blond boy engaged in various activities, replacing his baby pictures. There is no indication of another boy living in the house."
          }
        ]
      }