Obtains a list of prompt templates.
Debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- For mandatory resource types, indicate with a prefix of * .
- If the permissions cannot be granted at the resource level,
All Resourcesis used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
| Operation | Access level | Resource type | Condition key | Associated operation |
|---|---|---|---|---|
| sfm:ListPromptTemplates | list | *All Resources * |
| none |
Request syntax
GET /{workspaceId}/promptTemplates HTTP/1.1
Request parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| workspaceId | string | Yes | The workspace ID. | llm-us9hjmt32nysdxxx |
| name | string | No | The keyword that is used to search for templates. | |
| type | string | No | The type of the template. Valid values: · System · Custom | System |
| maxResults | integer | No | The maximum number of returned entries. | 10 |
| nextToken | string | No | The token that determines the start position of the query. Set this parameter to the value of the NextToken parameter that is returned from the last call. | dc270401186b433f975d7e1faaa34e0e |
Response parameters
Examples
Sample success responses
JSONformat
{
"maxResults": 10,
"nextToken": "dc270401186b433f975d7e1faaa34e0e",
"promptTemplates": [
{
"content": "",
"name": "",
"promptTemplateId": "d6935b7efbe34d11b13df9307151cf8c",
"type": "System",
"variables": [
"theme"
]
}
],
"requestId": "FE9B6CBF-47E6-5D76-9C5D-B814DD5AB071",
"totalCount": 15,
"workspaceId": "llm-us9hjmt32nysdxxx\n"
}Error codes
| HTTP status code | Error code | Error message | Description |
|---|---|---|---|
| 400 | PromptTemplate.MaxResultsInvalid | Input parameter MaxResults is invalid. | The input parameter maxResults format is invalid. |
| 400 | PromptTemplate.NameInvalid | Input parameter Name is invalid. | The format of the input parameter Name is invalid. |
| 400 | PromptTemplate.NextTokenInvalid | Input parameter NextToken is invalid. | The input nextToken is invalid. |
| 400 | PromptTemplate.TypeInvalid | Input parameter type is invalid. | input type format is invalid |
| 500 | PromptTemplate.InternalError | Prompt template service inner exception. | prompt template service internal exception |
For a list of error codes, visit the Service error codes.
