- Print
- PDF
Sliding window
- Print
- PDF
Available in Classic and VPC
Delete sentences that exceed the maximum number of tokens when using Chat completions API. The oldest conversation turns are deleted to free up tokens so that conversations can be created without interruption.
For a detailed description of how the sliding window works and how to work with it, see Utilize API of the CLOVA Studio user guide.
Request
This section describes the request format. The method and URI are as follows:
Method | URI |
---|---|
POST | /v1/api-tools/sliding/chat-messages/{modelName} |
Request headers
The following describes the request headers.
Field | Required | Description |
---|---|---|
Authorization | Required | API key for authentication <e.g.,> Bearer nv-************ |
X-NCP-CLOVASTUDIO-REQUEST-ID | Optional | Request ID |
Content-Type | Required | Request data format
|
Request path parameters
You can use the following path parameters with your request:
Field | Type | Required | Description |
---|---|---|---|
modelName | String | Required | Model name
|
Request body
You can include the following data in the body of your request:
Field | Type | Required | Description |
---|---|---|---|
maxTokens | Integer | Required | Maximum number of generated tokensmaxTokens ≤ 4096 (default: 100) |
messages | Array | Required | Conversation message list
|
messages.role | Enum | Required | Role of conversation messages
|
messages.content | String | Required | Content of conversation messages |
When entering some fields, check the following.
messages
: The sum of the number of tokens entered and the number of tokens entered inmaxTokens
can't exceed 4096 tokens. The number of tokens entered inmessages
can be checked by calling the Token calculation API.
Request example
The request example is as follows:
Response
This section describes the response format.
Response body
The following describes the body.
Field | Type | Required | Description |
---|---|---|---|
result | Object | - | Response result
|
result.messages | Array | - | Conversation message list |
result.messages.role | Enum | - | Role of conversation messages
|
result.messages.content | String | - | Content of conversation messages |
Response example
The response example is as follows:
Succeeded
The following is a sample response upon a successful call.
Failure
The following is a sample response upon a failed call.