Domain name for API request: lkeap.intl.tencentcloudapi.com.
QueryRewrite is mainly used in multi-round conversations for reference resolution and ellipsis completion. Using this API, you don't need to input prompt descriptions. A more accurate user query can be generated based on the conversation history. In terms of application scenarios, this API can be applied to various scenarios such as intelligent Q&A and conversational search.
There is a call limit for single-account for this API. If you need to increase the concurrency limit, please contact us (https://cloud.tencent.com/act/event/Online_service).
A maximum of 20 requests can be initiated per second for this API.
The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.
| Parameter Name | Required | Type | Description |
|---|---|---|---|
| Action | Yes | String | Common Params. The value used for this API: QueryRewrite. |
| Version | Yes | String | Common Params. The value used for this API: 2024-05-22. |
| Region | Yes | String | Common Params. For more information, please see the list of regions supported by the product. This API only supports: ap-jakarta. |
| Messages.N | Yes | Array of Message | The multi-round historical conversation that needs to be rewritten. Each round of historical conversation should include paired inputs of user (question) and assistant (answer). Due to the character limit of the model, a maximum of 4 rounds of conversations can be provided. The last round of conversation will be rewritten. |
| Model | No | String | Model name. |
| Parameter Name | Type | Description |
|---|---|---|
| Content | String | Rewritten result. |
| Usage | Usage | Consumption. The numbers of input tokens, output tokens, and total tokens will be returned. |
| RequestId | String | The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem. |
Multi-round rewriting.
POST / HTTP/1.1
Host: lkeap.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: QueryRewrite
<Common request parameters>
{
"Messages": [
{
"Role": "user",
"Content": "Where is your home"
},
{
"Role": "assistant",
"Content": "My home is in China"
},
{
"Role": "user",
"Content": "Where in the country"
}
]
}{
"Response": {
"Content": "Where is your home in the country? ",
"RequestId": "4de60215-13cd-4f90-afc4-9fe4ef63e245",
"Usage": {
"InputTokens": 45,
"OutputTokens": 6,
"TotalTokens": 51
}
}
}
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.
The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.
| Error Code | Description |
|---|---|
| FailedOperation | Operation failed. |
Feedback