This topic describes the API used to generate summaries. This API uses a large language model (LLM) to generate concise and accurate summaries based on the input knowledge base content. This API operation is suitable for scenarios where you need to quickly extract key information or generate content summaries.
Prerequisites
An API key for identity authentication is obtained. When you call the API operations of OpenSearch LLM-Based Conversational Search Edition, you must be authenticated. For more information, see Manage API keys. LLM is short for large language model.
An endpoint is obtained. When you call the API operations of OpenSearch LLM-Based Conversational Search Edition, you must specify an endpoint. For more information, see Obtain endpoints.
Operation information
Request method | Request protocol | Request data format |
POST | HTTP | JSON |
Request URL
{host}/v3/openapi/apps/[app_group_identity]/actions/knowledge-summary{host}: the endpoint that is used to call the API operation. You can call the API operation over the Internet or a virtual private cloud (VPC). For more information about how to obtain an endpoint, see Obtain endpoints.{app_group_identity}: the name of the application that you want to access. You can log on to the OpenSearch LLM-Based Conversational Search Edition console and view the application name of the corresponding instance on the Instance Management page.
Request parameters
Header parameters
Parameter | Type | Required | Description | Example |
Content-Type | string | Yes | The data format of the request. Only the JSON format is supported. Set the value to application/json. | application/json |
Authorization | string | Yes | The API key used for request authentication. The value must start with Bearer. | Bearer OS-d1**2a |
Body parameters
Parameter | Type | Required | Description | Example |
doc_id | string | Yes | The document ID. | 06*************b8d2 |
Sample request body
{
"doc_id": "The document ID."
}Response parameters
Parameter | Type | Description |
request_id | string | The request ID. |
latency | double | The latency of the request. |
summary | string | The summary that is generated. |
code | string | The error code. |
message | string | The error message. |
Sample response body
{
"request_id": "abc123-ABC",
"status":"OK",
"latency": 10.0, # Unit: seconds.
"result": {
"summary": "The summary that is generated."
},
"errors": [
{
"code": "The error code that is returned if an error occurs.",
"message": "The error message that is returned if an error occurs."
}
]
}