ListPromptTemplates - List prompt templates
Lists prompt templates.
Try it out
You can call this operation in OpenAPI Explorer without calculating a signature. After a successful call, OpenAPI Explorer can automatically generate SDK code examples.
Authorization information
The following table describes the authorization information for this API operation. You can use this information in the Action element of a RAM policy statement to grant a RAM user or RAM role permission to call the operation. The columns are described as follows:
-
Action: a specific permission.
-
Access level: the access level of an action. Valid values: Write, Read, and List.
-
Resource type: the types of resources for which the action supports authorization:
- Required resource types are marked with an asterisk (*).
- Actions that do not support resource-level authorization use
All resources.
-
Condition key: a condition key defined by the cloud service.
-
Dependent action: an additional permission required to perform the action. The caller must also have permission to perform the dependent action.
| Action | Access level | Resource type | Condition key | Dependent action |
|---|---|---|---|---|
| sfm:ListPromptTemplates | list | *All resources * |
| None |
Endpoint
/{workspaceId}/promptTemplatesPath parameters
workspaceIdstringRequiredThe workspace ID.
Query parameters
namestringOptionalThe keyword used to search template names.
typestringOptionalThe template type. Valid values: · System: system preset template · Custom: user-defined template
maxResultsintegerOptionalThe maximum number of results to return.
nextTokenstringOptionalThe token returned by the previous request. Pass this value to retrieve the next page of results.
Response fields
Schema of Response
maxResultsintegerThe maximum number of results to return.
nextTokenstringUsed for token-based pagination.
promptTemplatesarray<object>The list of templates.
PromptTemplatesobjectcontentstringThe template content.
namestringThe template name.
promptTemplateIdstringThe template ID.
typestringThe template type.
variablesarrayThe list of template variables.
VariablesstringA template variable.
requestIdstringThe request ID.
totalCountintegerThe total number of records.
workspaceIdstringThe workspace ID.
Response example
Sample success response
JSON format
{
"maxResults": 10,
"nextToken": "dc270401186b433f975d7e1faaa34e0e",
"promptTemplates": [
{
"content": "请写一篇小红书种草笔记,增加丰富的emoji元素,结尾作总结,并加上相关标签。主题为:${theme}",
"name": "小红书文案\n",
"promptTemplateId": "d6935b7efbe34d11b13df9307151cf8c",
"type": "System",
"variables": [
"theme"
]
}
],
"requestId": "FE9B6CBF-47E6-5D76-9C5D-B814DD5AB071",
"totalCount": 15,
"workspaceId": "llm-xxxxxxxxxxxx\n"
}
Error codes
| HTTP status code | Error code | Error message | Description |
|---|---|---|---|
| 400 | PromptTemplate.MaxResultsInvalid | Input parameter MaxResults is invalid. | The maxResults parameter has an invalid format. |
| 400 | PromptTemplate.NameInvalid | Input parameter Name is invalid. | The Name parameter has an invalid format. |
| 400 | PromptTemplate.NextTokenInvalid | Input parameter NextToken is invalid. | The nextToken parameter is invalid. |
| 400 | PromptTemplate.TypeInvalid | Input parameter type is invalid. | The type parameter has an invalid format. |
| 500 | PromptTemplate.InternalError | Prompt template service inner exception. | An internal error occurred in the prompt template service. |
For more error codes, see Error Center.