Skip to content

ListPromptTemplates

Obtains a list of prompt templates.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples. Debug

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 Resources is 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.
OperationAccess levelResource typeCondition keyAssociated operation
sfm:ListPromptTemplateslist* All Resources *nonenone

Request syntax

GET /{workspaceId}/promptTemplates HTTP/1.1

Request parameters

ParameterTypeRequiredDescriptionExample
workspaceIdstringYesThe workspace ID.llm-us9hjmt32nysdxxx
namestringNoThe keyword that is used to search for templates.
typestringNoThe type of the template. Valid values: · System · CustomSystem
maxResultsintegerNoThe maximum number of returned entries.10
nextTokenstringNoThe 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

ParameterTypeDescriptionExample
objectSchema of Response
maxResultsintegerThe maximum number of returned entries.10
nextTokenstringThe token that determines the start position of the next query.dc270401186b433f975d7e1faaa34e0e
promptTemplatesarrayThe templates.
PromptTemplatesobject
contentstringThe template content
namestringThe template name.
promptTemplateIdstringThe template ID.d6935b7efbe34d11b13df9307151cf8c
typestringThe template type."System"
variablesarrayThe variables of the template.
VariablesstringThe template variable."theme"
requestIdstringThe request ID.FE9B6CBF-47E6-5D76-9C5D-B814DD5AB071
totalCountintegerThe total number of entries returned.15
workspaceIdstringThe workspace ID.llm-us9hjmt32nysdxxx

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 codeError codeError messageDescription
400PromptTemplate.MaxResultsInvalidInput parameter MaxResults is invalid.The input parameter maxResults format is invalid.
400PromptTemplate.NameInvalidInput parameter Name is invalid.The format of the input parameter Name is invalid.
400PromptTemplate.NextTokenInvalidInput parameter NextToken is invalid.The input nextToken is invalid.
400PromptTemplate.TypeInvalidInput parameter type is invalid.input type format is invalid
500PromptTemplate.InternalErrorPrompt template service inner exception.prompt template service internal exception

For a list of error codes, visit the Service error codes.

Mirror of Alibaba Cloud Model Studio docs for reference and RAG. Not affiliated with Alibaba Cloud.