Skip to main content
POST
/
ai
/
prediction
/
summarization
/
{MODEL_ID}
Summarization use case
import requests

url = "https://application_id.applications.lucidworks.com/ai/prediction/summarization/{MODEL_ID}"

payload = {
    "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 }
}
headers = {
    "Authorization": "<authorization>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
{
  "predictions": [
    {
      "tokensUsed": {
        "promptTokens": 255,
        "completionTokens": 99,
        "totalTokens": 354
      },
      "summary": "Ten years have passed since Harry Potter's arrival on Privet Drive, yet the Dursleys' home remains largely unchanged. The sun rises on the same tidy gardens, and the living room appears identical to its state on the night Harry's presence was first reported. However, the photographs on the mantelpiece reveal the passage of time, showcasing Dudley's growth from a baby to a young boy. Meanwhile, Harry's presence is completely erased from the room, as if he never existed.",
      "response": "Ten years have passed since Harry Potter's arrival on Privet Drive, yet the Dursleys' home remains largely unchanged. The sun rises on the same tidy gardens, and the living room appears identical to its state on the night Harry's presence was first reported. However, the photographs on the mantelpiece reveal the passage of time, showcasing Dudley's growth from a baby to a young boy. Meanwhile, Harry's presence is completely erased from the room, as if he never existed."
    }
  ]
}

Headers

Authorization
string
required

Bearer token used for authentication. Format: Authorization: Bearer ACCESS_TOKEN.

Content-Type
string

application/json

Example:

"application/json"

Path Parameters

MODEL_ID
string
required

Unique identifier for the model.

Body

application/json
batch
object[]

The batch of key:value pairs used as inputs in the prediction. Up to 32 inputs per request are allowed.

Maximum array length: 32
useCaseConfig
UseCaseConfigSummarization · object
modelConfig
ModelConfig · object

Provides fields and values that specify ranges for tokens. Fields used for specific use cases and models are specified. The default values are used if other values are not specified.

Response

200 - application/json

OK

predictions
object[]