Class PromptTemplatesApi
The Prompt Registry simplifies the lifecycle management of prompt templates across design and runtime environments. It comes with an imperative and declarative interface. This API specification describes the imperative API for managing prompt templates and also allows the retrieval of declarative managed prompt templates. A prompt template consists of chat messages where placeholders can be defined together with default values. Additional information such as metadata tags can be added to the resource as well.
-
Field Summary
Fields inherited from class com.sap.cloud.sdk.services.openapi.apache.apiclient.BaseApi
apiClient, defaultHeaders -
Constructor Summary
ConstructorsConstructorDescriptionPromptTemplatesApi(com.sap.cloud.sdk.cloudplatform.connectivity.Destination httpDestination) Instantiates this API class to invoke operations on the Prompt Registry.PromptTemplatesApi(com.sap.cloud.sdk.services.openapi.apache.apiclient.ApiClient apiClient) Instantiates this API class to invoke operations on the Prompt Registry based on a givenApiClient. -
Method Summary
Modifier and TypeMethodDescriptioncreateUpdatePromptTemplate(PromptTemplatePostRequest promptTemplatePostRequest) Prompt template createcreateUpdatePromptTemplate(PromptTemplatePostRequest promptTemplatePostRequest, String aiResourceGroup, String aiResourceGroupScope) Prompt template createdeletePromptTemplate(UUID promptTemplateId) Prompt template deletedeletePromptTemplate(UUID promptTemplateId, String aiResourceGroup, String aiResourceGroupScope) Prompt template deletedeletePromptTemplateHistory(String scenario, String version, String name) Prompt template history deletedeletePromptTemplateHistory(String scenario, String version, String name, String aiResourceGroup, String aiResourceGroupScope) Prompt template history deletedeletePromptTemplatesByScenario(String scenario) Prompt template scenario deletedeletePromptTemplatesByScenario(String scenario, String aiResourceGroup, String aiResourceGroupScope) Prompt template scenario deletebyte[]exportPromptTemplate(UUID promptTemplateId) Prompt template exportbyte[]exportPromptTemplate(UUID promptTemplateId, String aiResourceGroup, String aiResourceGroupScope) Prompt template exportgetPromptTemplateByUuid(UUID promptTemplateId) Prompt template getgetPromptTemplateByUuid(UUID promptTemplateId, String aiResourceGroup, String aiResourceGroupScope) Prompt template getPrompt template createimportPromptTemplate(String aiResourceGroup, String aiResourceGroupScope, File _file) Prompt template createlistPromptTemplateHistory(String scenario, String version, String name) Prompt template historylistPromptTemplateHistory(String scenario, String version, String name, String aiResourceGroup, String aiResourceGroupScope, Integer $top, Integer $skip) Prompt template historyPrompt template listlistPromptTemplates(String aiResourceGroup, String aiResourceGroupScope, String scenario, String name, String version, String retrieve, Boolean includeSpec, Integer $top, Integer $skip) Prompt template listparsePromptTemplateById(UUID promptTemplateId) Prompt template fillparsePromptTemplateById(UUID promptTemplateId, String aiResourceGroup, String aiResourceGroupScope, Boolean metadata, PromptTemplateSubstitutionRequest promptTemplateSubstitutionRequest) Prompt template fillparsePromptTemplateByNameVersion(String scenario, String version, String name) Prompt template fillparsePromptTemplateByNameVersion(String scenario, String version, String name, String aiResourceGroup, String aiResourceGroupScope, Boolean metadata, PromptTemplateSubstitutionRequest promptTemplateSubstitutionRequest) Prompt template fillwithDefaultHeaders(Map<String, String> defaultHeaders) Creates a new API instance with additional default headers.
-
Constructor Details
-
PromptTemplatesApi
public PromptTemplatesApi(@Nonnull com.sap.cloud.sdk.cloudplatform.connectivity.Destination httpDestination) Instantiates this API class to invoke operations on the Prompt Registry.- Parameters:
httpDestination- The destination that API should be used with
-
PromptTemplatesApi
public PromptTemplatesApi(@Nonnull com.sap.cloud.sdk.services.openapi.apache.apiclient.ApiClient apiClient) Instantiates this API class to invoke operations on the Prompt Registry based on a givenApiClient.- Parameters:
apiClient- ApiClient to invoke the API on
-
-
Method Details
-
withDefaultHeaders
Creates a new API instance with additional default headers.- Parameters:
defaultHeaders- Additional headers to include in all requests- Returns:
- A new API instance with the combined headers
-
createUpdatePromptTemplate
@Nonnull public PromptTemplatePostResponse createUpdatePromptTemplate(@Nonnull PromptTemplatePostRequest promptTemplatePostRequest, @Nullable String aiResourceGroup, @Nullable String aiResourceGroupScope) throws com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException Prompt template createCreate or update a prompt template
200 - Successful response
400 - Bad Request
403 - Forbidden Error
0 - Common Error
- Parameters:
promptTemplatePostRequest- (required) The value for the parameter promptTemplatePostRequestaiResourceGroup- (optional) Specify a resource group id to useaiResourceGroupScope- (optional) Specify whether the resource group scope is to be used- Returns:
- PromptTemplatePostResponse
- Throws:
com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException- if an error occurs while attempting to invoke the API
-
createUpdatePromptTemplate
@Nonnull public PromptTemplatePostResponse createUpdatePromptTemplate(@Nonnull PromptTemplatePostRequest promptTemplatePostRequest) throws com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException Prompt template createCreate or update a prompt template
200 - Successful response
400 - Bad Request
403 - Forbidden Error
0 - Common Error
- Parameters:
promptTemplatePostRequest- The value for the parameter promptTemplatePostRequest- Returns:
- PromptTemplatePostResponse
- Throws:
com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException- if an error occurs while attempting to invoke the API
-
deletePromptTemplate
@Nonnull public PromptTemplateDeleteResponse deletePromptTemplate(@Nonnull UUID promptTemplateId, @Nullable String aiResourceGroup, @Nullable String aiResourceGroupScope) throws com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException Prompt template deleteDelete an imperatively managed prompt template
200 - Successful response
403 - Forbidden Error
404 - Bad Request
0 - Common Error
- Parameters:
promptTemplateId- (required) UUID of the prompt template.aiResourceGroup- (optional) Specify a resource group id to useaiResourceGroupScope- (optional) Specify whether the resource group scope is to be used- Returns:
- PromptTemplateDeleteResponse
- Throws:
com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException- if an error occurs while attempting to invoke the API
-
deletePromptTemplate
@Nonnull public PromptTemplateDeleteResponse deletePromptTemplate(@Nonnull UUID promptTemplateId) throws com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException Prompt template deleteDelete an imperatively managed prompt template
200 - Successful response
403 - Forbidden Error
404 - Bad Request
0 - Common Error
- Parameters:
promptTemplateId- UUID of the prompt template.- Returns:
- PromptTemplateDeleteResponse
- Throws:
com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException- if an error occurs while attempting to invoke the API
-
deletePromptTemplateHistory
@Nonnull public PromptTemplateHistoryDeleteResponse deletePromptTemplateHistory(@Nonnull String scenario, @Nonnull String version, @Nonnull String name, @Nullable String aiResourceGroup, @Nullable String aiResourceGroupScope) throws com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException Prompt template history deleteDelete the version history of an imperatively managed prompt template
200 - Successful response
403 - Forbidden Error
404 - Bad Request
0 - Common Error
- Parameters:
scenario- (required) Scenario field of the resource.version- (required) Version field of the resource.name- (required) Name field of the resource.aiResourceGroup- (optional) Specify a resource group id to useaiResourceGroupScope- (optional) Specify whether the resource group scope is to be used- Returns:
- PromptTemplateHistoryDeleteResponse
- Throws:
com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException- if an error occurs while attempting to invoke the API
-
deletePromptTemplateHistory
@Nonnull public PromptTemplateHistoryDeleteResponse deletePromptTemplateHistory(@Nonnull String scenario, @Nonnull String version, @Nonnull String name) throws com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException Prompt template history deleteDelete the version history of an imperatively managed prompt template
200 - Successful response
403 - Forbidden Error
404 - Bad Request
0 - Common Error
- Parameters:
scenario- Scenario field of the resource.version- Version field of the resource.name- Name field of the resource.- Returns:
- PromptTemplateHistoryDeleteResponse
- Throws:
com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException- if an error occurs while attempting to invoke the API
-
deletePromptTemplatesByScenario
@Nonnull public PromptTemplateScenarioDeleteResponse deletePromptTemplatesByScenario(@Nonnull String scenario, @Nullable String aiResourceGroup, @Nullable String aiResourceGroupScope) throws com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException Prompt template scenario deleteDelete all imperatively managed prompt templates in a scenario
200 - Successful response
403 - Forbidden Error
404 - Bad Request
0 - Common Error
- Parameters:
scenario- (required) Scenario field of the resource.aiResourceGroup- (optional) Specify a resource group id to useaiResourceGroupScope- (optional) Specify whether the resource group scope is to be used- Returns:
- PromptTemplateScenarioDeleteResponse
- Throws:
com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException- if an error occurs while attempting to invoke the API
-
deletePromptTemplatesByScenario
@Nonnull public PromptTemplateScenarioDeleteResponse deletePromptTemplatesByScenario(@Nonnull String scenario) throws com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException Prompt template scenario deleteDelete all imperatively managed prompt templates in a scenario
200 - Successful response
403 - Forbidden Error
404 - Bad Request
0 - Common Error
- Parameters:
scenario- Scenario field of the resource.- Returns:
- PromptTemplateScenarioDeleteResponse
- Throws:
com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException- if an error occurs while attempting to invoke the API
-
exportPromptTemplate
@Nonnull public byte[] exportPromptTemplate(@Nonnull UUID promptTemplateId, @Nullable String aiResourceGroup, @Nullable String aiResourceGroupScope) throws com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException Prompt template exportDownload a prompt template as a file
200 - Successful response
400 - Bad Request
0 - Common Error
- Parameters:
promptTemplateId- (required) UUID of the prompt template.aiResourceGroup- (optional) Specify a resource group id to useaiResourceGroupScope- (optional) Specify whether the resource group scope is to be used- Returns:
- byte[]
- Throws:
com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException- if an error occurs while attempting to invoke the API
-
exportPromptTemplate
@Nonnull public byte[] exportPromptTemplate(@Nonnull UUID promptTemplateId) throws com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException Prompt template exportDownload a prompt template as a file
200 - Successful response
400 - Bad Request
0 - Common Error
- Parameters:
promptTemplateId- UUID of the prompt template.- Returns:
- byte[]
- Throws:
com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException- if an error occurs while attempting to invoke the API
-
getPromptTemplateByUuid
@Nonnull public PromptTemplateGetResponse getPromptTemplateByUuid(@Nonnull UUID promptTemplateId, @Nullable String aiResourceGroup, @Nullable String aiResourceGroupScope) throws com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException Prompt template getGet prompt template by UUID
200 - Successful response
400 - Bad Request
403 - Forbidden Error
0 - Common Error
- Parameters:
promptTemplateId- (required) UUID of the prompt template.aiResourceGroup- (optional) Specify a resource group id to useaiResourceGroupScope- (optional) Specify whether the resource group scope is to be used- Returns:
- PromptTemplateGetResponse
- Throws:
com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException- if an error occurs while attempting to invoke the API
-
getPromptTemplateByUuid
@Nonnull public PromptTemplateGetResponse getPromptTemplateByUuid(@Nonnull UUID promptTemplateId) throws com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException Prompt template getGet prompt template by UUID
200 - Successful response
400 - Bad Request
403 - Forbidden Error
0 - Common Error
- Parameters:
promptTemplateId- UUID of the prompt template.- Returns:
- PromptTemplateGetResponse
- Throws:
com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException- if an error occurs while attempting to invoke the API
-
importPromptTemplate
@Nonnull public PromptTemplatePostResponse importPromptTemplate(@Nullable String aiResourceGroup, @Nullable String aiResourceGroupScope, @Nullable File _file) throws com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException Prompt template createCreate an imperatively managed prompt template from a file
200 - Successful response
400 - Bad Request
0 - Common Error
- Parameters:
aiResourceGroup- (optional) Specify a resource group id to useaiResourceGroupScope- (optional) Specify whether the resource group scope is to be used_file- (optional) The value for the parameter _file- Returns:
- PromptTemplatePostResponse
- Throws:
com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException- if an error occurs while attempting to invoke the API
-
importPromptTemplate
@Nonnull public PromptTemplatePostResponse importPromptTemplate() throws com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestExceptionPrompt template createCreate an imperatively managed prompt template from a file
200 - Successful response
400 - Bad Request
0 - Common Error
- Returns:
- PromptTemplatePostResponse
- Throws:
com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException- if an error occurs while attempting to invoke the API
-
listPromptTemplateHistory
@Nonnull public PromptTemplateListResponse listPromptTemplateHistory(@Nonnull String scenario, @Nonnull String version, @Nonnull String name, @Nullable String aiResourceGroup, @Nullable String aiResourceGroupScope, @Nullable Integer $top, @Nullable Integer $skip) throws com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException Prompt template historyList prompt template history
200 - Successful response
400 - Bad Request
403 - Forbidden Error
413 - Payload Too Large — result set exceeds maximum allowed rows; use $top and $skip to paginate
0 - Common Error
- Parameters:
scenario- (required) Scenario field of the resource.version- (required) Version field of the resource.name- (required) Name field of the resource.aiResourceGroup- (optional) Specify a resource group id to useaiResourceGroupScope- (optional) Specify whether the resource group scope is to be used$top- (optional) Number of results to return (1–500). When omitted the full result set is returned (up to the server limit).$skip- (optional, default to 0) Number of results to skip before returning the page.- Returns:
- PromptTemplateListResponse
- Throws:
com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException- if an error occurs while attempting to invoke the API
-
listPromptTemplateHistory
@Nonnull public PromptTemplateListResponse listPromptTemplateHistory(@Nonnull String scenario, @Nonnull String version, @Nonnull String name) throws com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException Prompt template historyList prompt template history
200 - Successful response
400 - Bad Request
403 - Forbidden Error
413 - Payload Too Large — result set exceeds maximum allowed rows; use $top and $skip to paginate
0 - Common Error
- Parameters:
scenario- Scenario field of the resource.version- Version field of the resource.name- Name field of the resource.- Returns:
- PromptTemplateListResponse
- Throws:
com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException- if an error occurs while attempting to invoke the API
-
listPromptTemplates
@Nonnull public PromptTemplateListResponse listPromptTemplates(@Nullable String aiResourceGroup, @Nullable String aiResourceGroupScope, @Nullable String scenario, @Nullable String name, @Nullable String version, @Nullable String retrieve, @Nullable Boolean includeSpec, @Nullable Integer $top, @Nullable Integer $skip) throws com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException Prompt template listList prompt templates
200 - Successful response
400 - Bad Request
403 - Forbidden Error
413 - Payload Too Large — result set exceeds maximum allowed rows; use $top and $skip to paginate
0 - Common Error
- Parameters:
aiResourceGroup- (optional) Specify a resource group id to useaiResourceGroupScope- (optional) Specify whether the resource group scope is to be usedscenario- (optional) Scenario field of the resource.name- (optional) Name field of the resource.version- (optional) Version field of the resource.retrieve- (optional, default to both) Whether to retrieve 'imperative', 'declarative', or 'both'.includeSpec- (optional, default to false) Whether include the spec section or not.$top- (optional) Number of results to return (1–500). When omitted the full result set is returned (up to the server limit).$skip- (optional, default to 0) Number of results to skip before returning the page.- Returns:
- PromptTemplateListResponse
- Throws:
com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException- if an error occurs while attempting to invoke the API
-
listPromptTemplates
@Nonnull public PromptTemplateListResponse listPromptTemplates() throws com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestExceptionPrompt template listList prompt templates
200 - Successful response
400 - Bad Request
403 - Forbidden Error
413 - Payload Too Large — result set exceeds maximum allowed rows; use $top and $skip to paginate
0 - Common Error
- Returns:
- PromptTemplateListResponse
- Throws:
com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException- if an error occurs while attempting to invoke the API
-
parsePromptTemplateById
@Nonnull public PromptTemplateSubstitutionResponse parsePromptTemplateById(@Nonnull UUID promptTemplateId, @Nullable String aiResourceGroup, @Nullable String aiResourceGroupScope, @Nullable Boolean metadata, @Nullable PromptTemplateSubstitutionRequest promptTemplateSubstitutionRequest) throws com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException Prompt template fillFill the placeholders of a prompt template that is identified by its UUID
200 - Successful response
400 - Bad Request
403 - Forbidden Error
0 - Common Error
- Parameters:
promptTemplateId- (required) UUID of the prompt template.aiResourceGroup- (optional) Specify a resource group id to useaiResourceGroupScope- (optional) Specify whether the resource group scope is to be usedmetadata- (optional, default to false) Whether to not include metadata in the response.promptTemplateSubstitutionRequest- (optional) The value for the parameter promptTemplateSubstitutionRequest- Returns:
- PromptTemplateSubstitutionResponse
- Throws:
com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException- if an error occurs while attempting to invoke the API
-
parsePromptTemplateById
@Nonnull public PromptTemplateSubstitutionResponse parsePromptTemplateById(@Nonnull UUID promptTemplateId) throws com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException Prompt template fillFill the placeholders of a prompt template that is identified by its UUID
200 - Successful response
400 - Bad Request
403 - Forbidden Error
0 - Common Error
- Parameters:
promptTemplateId- UUID of the prompt template.- Returns:
- PromptTemplateSubstitutionResponse
- Throws:
com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException- if an error occurs while attempting to invoke the API
-
parsePromptTemplateByNameVersion
@Nonnull public PromptTemplateSubstitutionResponse parsePromptTemplateByNameVersion(@Nonnull String scenario, @Nonnull String version, @Nonnull String name, @Nullable String aiResourceGroup, @Nullable String aiResourceGroupScope, @Nullable Boolean metadata, @Nullable PromptTemplateSubstitutionRequest promptTemplateSubstitutionRequest) throws com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException Prompt template fillFill the placeholders of a prompt template that is identified by its scenario, name and version
200 - Successful response
400 - Bad Request
403 - Forbidden Error
0 - Common Error
- Parameters:
scenario- (required) Scenario field of the resource.version- (required) Version field of the resource.name- (required) Name field of the resource.aiResourceGroup- (optional) Specify a resource group id to useaiResourceGroupScope- (optional) Specify whether the resource group scope is to be usedmetadata- (optional, default to false) Whether to not include metadata in the response.promptTemplateSubstitutionRequest- (optional) The value for the parameter promptTemplateSubstitutionRequest- Returns:
- PromptTemplateSubstitutionResponse
- Throws:
com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException- if an error occurs while attempting to invoke the API
-
parsePromptTemplateByNameVersion
@Nonnull public PromptTemplateSubstitutionResponse parsePromptTemplateByNameVersion(@Nonnull String scenario, @Nonnull String version, @Nonnull String name) throws com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException Prompt template fillFill the placeholders of a prompt template that is identified by its scenario, name and version
200 - Successful response
400 - Bad Request
403 - Forbidden Error
0 - Common Error
- Parameters:
scenario- Scenario field of the resource.version- Version field of the resource.name- Name field of the resource.- Returns:
- PromptTemplateSubstitutionResponse
- Throws:
com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException- if an error occurs while attempting to invoke the API
-