---
title: "Generate a summary for the provided context"
method: POST
path: "/ai/v1/summarize"
tags: ["Summarization"]
---

# Generate a summary for the provided context

`POST /ai/v1/summarize`

## Request

- Base URL: `https://.clinia.cloud`
- URL: `https://.clinia.cloud/ai/v1/summarize`
- Auth: API key in header `X-Clinia-API-Key`

Generate a summary for the provided context.
This is similar to the `Complete` endpoint, but is designed for summarization tasks.
it does not require a conversation ID and does not store the conversation history.

## Request body

- V1SummarizationRequest
  - `task` string, required: The summarization task to perform (e.g. "knowledge-answer").
  - `params` object, required: Key/value inputs for that task, must conform to the JSON-Schema of the chosen task.
  - `retriever` V1RetrieverConfig: When provided, instructs the service how to fetch dynamic parameters from a vector store.
    - `partitionKey` string, required: The key of the data partition.
    - `collectionKeys` string[], required: Which collection(s) to query for retrieving context.
    - `searchParams` V1SearchParameters, required
      - `filter` union
        - object
          - `id` string
          - `and` V1Operator[], required
        - object
          - `id` string
          - `or` V1Operator[], required
        - object
          - `id` string
          - `all` object, required
        - object
          - `id` string
          - `any` object, required
        - object
          - `id` string
          - `composite` object, required
        - object
          - `id` string
          - `eq` object, required
        - object
          - `id` string
          - `knn` object, required
        - object
          - `id` string
          - `geoDistance` object, required
        - object
          - `id` string
          - `gt` object, required
        - object
          - `id` string
          - `lt` object, required
        - object
          - `id` string
          - `match` object, required
        - object
          - `id` string
          - `not` V1Operator, required (recursive)
      - `query` union
        - object
          - `id` string
          - `and` V1Operator[], required
        - object
          - `id` string
          - `or` V1Operator[], required
        - object
          - `id` string
          - `all` object, required
        - object
          - `id` string
          - `any` object, required
        - object
          - `id` string
          - `composite` object, required
        - object
          - `id` string
          - `eq` object, required
        - object
          - `id` string
          - `knn` object, required
        - object
          - `id` string
          - `geoDistance` object, required
        - object
          - `id` string
          - `gt` object, required
        - object
          - `id` string
          - `lt` object, required
        - object
          - `id` string
          - `match` object, required
        - object
          - `id` string
          - `not` V1Operator, required (recursive)
      - `highlighting` string[]
      - `page` integer
      - `perPage` integer
      - `sort` V1Sort
        - `direction` 'DESC' | 'ASC'
        - `path` string, required
      - `ranking` union
        - object
          - `type` 'DEFAULT' | 'SEMANTIC', required
        - object
          - `type` 'DEFAULT' | 'SEMANTIC', required
          - `query` string, required
          - `path` string, required
          - `modelId` string, required
      - `aggregations` V1Aggregation[]
        - `type` 'LEXICAL', required
        - `path` string, required: The path of the property to aggregate.
        - `prefix` string: The prefix is an optional query to filter the values to aggregate (e.g. 'mont' would match 'montreal', 'Montecarlo', etc.).
        - `size` integer: The maximum number of unique values to return in the aggregation.
      - `traversedProperties` string[]: The properties from the relationships or adjacent records that will be returned in the search response. The wildcard '*' can be used in itself or in combination with a prefix - `*` will return all traversed properties. - `@worksAt.*` will return all traversed properties from the relationship 'worksAt'. - `@worksAt.@clinic.*` will return all traversed properties from an adjacent 'clinic' connected with a 'worksAt' relationship.
  - `targetParam` string: A param name (e.g. "hits") that will be used to store the results of the retriever. Only necessary if retriever is specified.

## Response `201`

A successful response.

- V1Message[]: The list of new messages added to the conversation. This will only include the assistant message.
  - union
    - V1UserMessage
      - `role` 'user' | 'assistant', required
      - `id` string
      - `content` string, required: The content of the message. This should only be set when the message is created. It will never be returned by the API.
      - `parts` V1MessagePart[]
        - union
          - V1MessagePartText
            - `type` 'text' | 'object' | 'tool-call', required
            - `text` string, required: The content of the message.
          - V1MessagePartToolCall
            - `type` 'text' | 'object' | 'tool-call', required
            - `toolCall` object
              - …
    - V1AssistantMessage
      - `role` 'user' | 'assistant', required
      - `id` string, required
      - `parts` V1MessagePart[], required
        - union
          - V1MessagePartText
            - `type` 'text' | 'object' | 'tool-call', required
            - `text` string, required: The content of the message.
          - V1MessagePartToolCall
            - `type` 'text' | 'object' | 'tool-call', required
            - `toolCall` object
              - …

---

[API](https://skmtc.dev/clinia/apis/ai-api.md) - [All operations](https://skmtc.dev/clinia/apis/ai-api/llms.txt) - [OpenAPI document](https://skmtc.dev/clinia/apis/ai-api/revisions/caf49145c239?raw)
