Skip to content

Commit e380c8d

Browse files
feat: [DevOps] Update prompt-registry specification (#402)
* spec update fix * Update prompt-registry based on main * fix --------- Co-authored-by: I538344 <[email protected]>
1 parent 544a067 commit e380c8d

File tree

7 files changed

+84
-615
lines changed

7 files changed

+84
-615
lines changed

.github/workflows/spec-update.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ jobs:
9393
;;
9494
prompt-registry)
9595
API_URL="$API_BASE_URL/AI/prompt-registry/contents/src/spec/prompt-registry.yaml?ref=$REF"
96-
FILE_PATH='prompt-registry/src/main/resources/spec/prompt-registry.yaml'
96+
FILE_PATH='core-services/prompt-registry/src/main/resources/spec/prompt-registry.yaml'
9797
;;
9898
esac
9999

core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/PromptClient.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
77
import com.google.common.collect.Iterables;
88
import com.sap.ai.sdk.core.AiCoreService;
9-
import com.sap.ai.sdk.prompt.registry.client.DefaultApi;
9+
import com.sap.ai.sdk.prompt.registry.client.PromptTemplatesApi;
1010
import com.sap.ai.sdk.prompt.registry.model.PromptTemplateSpecResponseFormat;
1111
import com.sap.ai.sdk.prompt.registry.model.ResponseFormatText;
1212
import com.sap.ai.sdk.prompt.registry.model.SingleChatTemplate;
@@ -26,7 +26,7 @@
2626
*
2727
* @since 1.6.0
2828
*/
29-
public class PromptClient extends DefaultApi {
29+
public class PromptClient extends PromptTemplatesApi {
3030

3131
/**
3232
* Instantiates this a client to invoke operations on the Prompt Registry service.

core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/client/DefaultApi.java renamed to core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/client/PromptTemplatesApi.java

Lines changed: 40 additions & 173 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import com.sap.ai.sdk.prompt.registry.model.PromptTemplatePostResponse;
99
import com.sap.ai.sdk.prompt.registry.model.PromptTemplateSubstitutionRequest;
1010
import com.sap.ai.sdk.prompt.registry.model.PromptTemplateSubstitutionResponse;
11-
import com.sap.ai.sdk.prompt.registry.model.ProvisioningResponse;
1211
import com.sap.cloud.sdk.cloudplatform.connectivity.Destination;
1312
import com.sap.cloud.sdk.services.openapi.apiclient.ApiClient;
1413
import com.sap.cloud.sdk.services.openapi.core.AbstractOpenApiService;
@@ -35,13 +34,13 @@
3534
* <p>Prompt Storage service for Design time & Runtime prompt templates.
3635
*/
3736
@Beta
38-
public class DefaultApi extends AbstractOpenApiService {
37+
public class PromptTemplatesApi extends AbstractOpenApiService {
3938
/**
4039
* Instantiates this API class to invoke operations on the Prompt Registry API.
4140
*
4241
* @param httpDestination The destination that API should be used with
4342
*/
44-
public DefaultApi(@Nonnull final Destination httpDestination) {
43+
public PromptTemplatesApi(@Nonnull final Destination httpDestination) {
4544
super(httpDestination);
4645
}
4746

@@ -52,12 +51,14 @@ public DefaultApi(@Nonnull final Destination httpDestination) {
5251
* @param apiClient ApiClient to invoke the API on
5352
*/
5453
@Beta
55-
public DefaultApi(@Nonnull final ApiClient apiClient) {
54+
public PromptTemplatesApi(@Nonnull final ApiClient apiClient) {
5655
super(apiClient);
5756
}
5857

5958
/**
60-
* <b>200</b> - Successful response
59+
* Create or update a prompt template
60+
*
61+
* <p><b>200</b> - Successful response
6162
*
6263
* <p><b>403</b> - Forbidden Error
6364
*
@@ -113,7 +114,9 @@ public PromptTemplatePostResponse createUpdatePromptTemplate(
113114
}
114115

115116
/**
116-
* <b>200</b> - Successful response
117+
* Delete prompt template
118+
*
119+
* <p><b>200</b> - Successful response
117120
*
118121
* <p><b>404</b> - Bad Request
119122
*
@@ -173,7 +176,9 @@ public PromptTemplateDeleteResponse deletePromptTemplate(@Nonnull final UUID pro
173176
}
174177

175178
/**
176-
* <b>200</b> - Successful response
179+
* Export prompt template
180+
*
181+
* <p><b>200</b> - Successful response
177182
*
178183
* <p><b>400</b> - Bad Request
179184
*
@@ -231,7 +236,9 @@ public File exportPromptTemplate(@Nonnull final UUID promptTemplateId)
231236
}
232237

233238
/**
234-
* <b>200</b> - Successful response
239+
* Get prompt template by UUID
240+
*
241+
* <p><b>200</b> - Successful response
235242
*
236243
* <p><b>400</b> - Bad Request
237244
*
@@ -291,49 +298,9 @@ public PromptTemplateGetResponse getPromptTemplateByUuid(@Nonnull final UUID pro
291298
}
292299

293300
/**
294-
* <b>200</b> - Service is up and running.
301+
* Import prompt template
295302
*
296-
* <p><b>503</b> - Service is unavailable.
297-
*
298-
* @return String
299-
* @throws OpenApiRequestException if an error occurs while attempting to invoke the API
300-
*/
301-
@Nonnull
302-
public String healthz() throws OpenApiRequestException {
303-
final Object localVarPostBody = null;
304-
305-
final String localVarPath = UriComponentsBuilder.fromPath("/healthz").build().toUriString();
306-
307-
final MultiValueMap<String, String> localVarQueryParams =
308-
new LinkedMultiValueMap<String, String>();
309-
final HttpHeaders localVarHeaderParams = new HttpHeaders();
310-
final MultiValueMap<String, Object> localVarFormParams =
311-
new LinkedMultiValueMap<String, Object>();
312-
313-
final String[] localVarAccepts = {"text/plain", "application/json"};
314-
final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
315-
final String[] localVarContentTypes = {};
316-
final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
317-
318-
final String[] localVarAuthNames = new String[] {};
319-
320-
final ParameterizedTypeReference<String> localVarReturnType =
321-
new ParameterizedTypeReference<String>() {};
322-
return apiClient.invokeAPI(
323-
localVarPath,
324-
HttpMethod.GET,
325-
localVarQueryParams,
326-
localVarPostBody,
327-
localVarHeaderParams,
328-
localVarFormParams,
329-
localVarAccept,
330-
localVarContentType,
331-
localVarAuthNames,
332-
localVarReturnType);
333-
}
334-
335-
/**
336-
* <b>200</b> - Successful response
303+
* <p><b>200</b> - Successful response
337304
*
338305
* <p><b>400</b> - Bad Request
339306
*
@@ -382,7 +349,9 @@ public PromptTemplatePostResponse importPromptTemplate(@Nullable final File _fil
382349
}
383350

384351
/**
385-
* <b>200</b> - Successful response
352+
* Import prompt template
353+
*
354+
* <p><b>200</b> - Successful response
386355
*
387356
* <p><b>400</b> - Bad Request
388357
*
@@ -397,7 +366,9 @@ public PromptTemplatePostResponse importPromptTemplate() throws OpenApiRequestEx
397366
}
398367

399368
/**
400-
* <b>200</b> - Successful response
369+
* List prompt template history
370+
*
371+
* <p><b>200</b> - Successful response
401372
*
402373
* <p><b>400</b> - Bad Request
403374
*
@@ -475,7 +446,9 @@ public PromptTemplateListResponse listPromptTemplateHistory(
475446
}
476447

477448
/**
478-
* <b>200</b> - Successful response
449+
* List prompt templates
450+
*
451+
* <p><b>200</b> - Successful response
479452
*
480453
* <p><b>400</b> - Bad Request
481454
*
@@ -540,7 +513,9 @@ public PromptTemplateListResponse listPromptTemplates(
540513
}
541514

542515
/**
543-
* <b>200</b> - Successful response
516+
* List prompt templates
517+
*
518+
* <p><b>200</b> - Successful response
544519
*
545520
* <p><b>400</b> - Bad Request
546521
*
@@ -557,123 +532,9 @@ public PromptTemplateListResponse listPromptTemplates() throws OpenApiRequestExc
557532
}
558533

559534
/**
560-
* <b>200</b> - Successful response
535+
* Parse prompt template by ID
561536
*
562-
* <p><b>403</b> - Forbidden Error
563-
*
564-
* <p><b>0</b> - Common Error
565-
*
566-
* @param aiMainTenant The main tenant name
567-
* @return ProvisioningResponse
568-
* @throws OpenApiRequestException if an error occurs while attempting to invoke the API
569-
*/
570-
@Nonnull
571-
public ProvisioningResponse offboardTenant(@Nonnull final String aiMainTenant)
572-
throws OpenApiRequestException {
573-
final Object localVarPostBody = null;
574-
575-
// verify the required parameter 'aiMainTenant' is set
576-
if (aiMainTenant == null) {
577-
throw new OpenApiRequestException(
578-
"Missing the required parameter 'aiMainTenant' when calling offboardTenant");
579-
}
580-
581-
final String localVarPath =
582-
UriComponentsBuilder.fromPath("/internal/promptTemplates/provisioning")
583-
.build()
584-
.toUriString();
585-
586-
final MultiValueMap<String, String> localVarQueryParams =
587-
new LinkedMultiValueMap<String, String>();
588-
final HttpHeaders localVarHeaderParams = new HttpHeaders();
589-
final MultiValueMap<String, Object> localVarFormParams =
590-
new LinkedMultiValueMap<String, Object>();
591-
592-
if (aiMainTenant != null)
593-
localVarHeaderParams.add("AI-Main-Tenant", apiClient.parameterToString(aiMainTenant));
594-
595-
final String[] localVarAccepts = {"application/json"};
596-
final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
597-
final String[] localVarContentTypes = {};
598-
final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
599-
600-
final String[] localVarAuthNames = new String[] {};
601-
602-
final ParameterizedTypeReference<ProvisioningResponse> localVarReturnType =
603-
new ParameterizedTypeReference<ProvisioningResponse>() {};
604-
return apiClient.invokeAPI(
605-
localVarPath,
606-
HttpMethod.DELETE,
607-
localVarQueryParams,
608-
localVarPostBody,
609-
localVarHeaderParams,
610-
localVarFormParams,
611-
localVarAccept,
612-
localVarContentType,
613-
localVarAuthNames,
614-
localVarReturnType);
615-
}
616-
617-
/**
618-
* <b>200</b> - Successful response
619-
*
620-
* <p><b>403</b> - Forbidden Error
621-
*
622-
* <p><b>0</b> - Common Error
623-
*
624-
* @param aiMainTenant The main tenant name
625-
* @return ProvisioningResponse
626-
* @throws OpenApiRequestException if an error occurs while attempting to invoke the API
627-
*/
628-
@Nonnull
629-
public ProvisioningResponse onboardTenant(@Nonnull final String aiMainTenant)
630-
throws OpenApiRequestException {
631-
final Object localVarPostBody = null;
632-
633-
// verify the required parameter 'aiMainTenant' is set
634-
if (aiMainTenant == null) {
635-
throw new OpenApiRequestException(
636-
"Missing the required parameter 'aiMainTenant' when calling onboardTenant");
637-
}
638-
639-
final String localVarPath =
640-
UriComponentsBuilder.fromPath("/internal/promptTemplates/provisioning")
641-
.build()
642-
.toUriString();
643-
644-
final MultiValueMap<String, String> localVarQueryParams =
645-
new LinkedMultiValueMap<String, String>();
646-
final HttpHeaders localVarHeaderParams = new HttpHeaders();
647-
final MultiValueMap<String, Object> localVarFormParams =
648-
new LinkedMultiValueMap<String, Object>();
649-
650-
if (aiMainTenant != null)
651-
localVarHeaderParams.add("AI-Main-Tenant", apiClient.parameterToString(aiMainTenant));
652-
653-
final String[] localVarAccepts = {"application/json"};
654-
final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
655-
final String[] localVarContentTypes = {};
656-
final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
657-
658-
final String[] localVarAuthNames = new String[] {};
659-
660-
final ParameterizedTypeReference<ProvisioningResponse> localVarReturnType =
661-
new ParameterizedTypeReference<ProvisioningResponse>() {};
662-
return apiClient.invokeAPI(
663-
localVarPath,
664-
HttpMethod.POST,
665-
localVarQueryParams,
666-
localVarPostBody,
667-
localVarHeaderParams,
668-
localVarFormParams,
669-
localVarAccept,
670-
localVarContentType,
671-
localVarAuthNames,
672-
localVarReturnType);
673-
}
674-
675-
/**
676-
* <b>200</b> - Successful response
537+
* <p><b>200</b> - Successful response
677538
*
678539
* <p><b>400</b> - Bad Request
679540
*
@@ -741,7 +602,9 @@ public PromptTemplateSubstitutionResponse parsePromptTemplateById(
741602
}
742603

743604
/**
744-
* <b>200</b> - Successful response
605+
* Parse prompt template by ID
606+
*
607+
* <p><b>200</b> - Successful response
745608
*
746609
* <p><b>400</b> - Bad Request
747610
*
@@ -760,7 +623,9 @@ public PromptTemplateSubstitutionResponse parsePromptTemplateById(
760623
}
761624

762625
/**
763-
* <b>200</b> - Successful response
626+
* Parse prompt template by name and version
627+
*
628+
* <p><b>200</b> - Successful response
764629
*
765630
* <p><b>400</b> - Bad Request
766631
*
@@ -847,7 +712,9 @@ public PromptTemplateSubstitutionResponse parsePromptTemplateByNameVersion(
847712
}
848713

849714
/**
850-
* <b>200</b> - Successful response
715+
* Parse prompt template by name and version
716+
*
717+
* <p><b>200</b> - Successful response
851718
*
852719
* <p><b>400</b> - Bad Request
853720
*

0 commit comments

Comments
 (0)