From 6501434862850fbafe25b5b10a132343500a03eb Mon Sep 17 00:00:00 2001 From: I538344 Date: Wed, 27 Aug 2025 14:57:29 +0200 Subject: [PATCH 01/15] feat: [DevOps] Orchestration spec update automation --- .github/workflows/weekly-spec-update.yaml | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/.github/workflows/weekly-spec-update.yaml b/.github/workflows/weekly-spec-update.yaml index 6ee440267..a06aed4aa 100644 --- a/.github/workflows/weekly-spec-update.yaml +++ b/.github/workflows/weekly-spec-update.yaml @@ -3,13 +3,13 @@ name: "Weekly Spec Update" on: schedule: - cron: '0 0 * * SUN' # Every Sunday at midnight UTC + workflow_dispatch: jobs: update-all-specs: runs-on: ubuntu-latest permissions: - contents: write - pull-requests: write + actions: write strategy: matrix: @@ -17,13 +17,30 @@ jobs: - core - document-grounding - prompt-registry + - orchestration steps: - name: "Checkout repository" uses: actions/checkout@v4 + - name: "Get orchestration version" + run: | + ORCH_VERSION=$(curl --silent --request GET --url "https://github.tools.sap/api/v3/repos/MLF-prod/mlf-gitops-prod/contents/services/llm-orchestration/source/Chart.yaml?ref=aws.eu-central-1.prod-eu/current" -H "Authorization: Bearer $TOKEN" -H "Accept: application/vnd.github.v3.raw" | grep 'version:' | awk '{print $2}') + + echo "Orchestration version: $ORCH_VERSION" + echo "ORCH_VERSION=$ORCH_VERSION" >> $GITHUB_ENV + env: + TOKEN: ${{ secrets.GH_TOOLS_TOKEN }} + + - name: "Trigger spec update" run: | + FILE_REF="main" + if [ "${{ matrix.file }}" = "orchestration" ]; then + FILE_REF="$ORCH_VERSION" + fi + echo "Using file ref: $FILE_REF" + gh workflow run spec-update.yaml \ --field file=${{ matrix.file }} \ --field file-ref=main \ From 2a45cd272a09cbffe6d7419ebaaac13fb9f25308 Mon Sep 17 00:00:00 2001 From: I538344 Date: Wed, 27 Aug 2025 15:01:48 +0200 Subject: [PATCH 02/15] fix branch name --- .github/workflows/weekly-spec-update.yaml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/weekly-spec-update.yaml b/.github/workflows/weekly-spec-update.yaml index a06aed4aa..540091b39 100644 --- a/.github/workflows/weekly-spec-update.yaml +++ b/.github/workflows/weekly-spec-update.yaml @@ -24,6 +24,7 @@ jobs: uses: actions/checkout@v4 - name: "Get orchestration version" + if: matrix.file == 'orchestration' run: | ORCH_VERSION=$(curl --silent --request GET --url "https://github.tools.sap/api/v3/repos/MLF-prod/mlf-gitops-prod/contents/services/llm-orchestration/source/Chart.yaml?ref=aws.eu-central-1.prod-eu/current" -H "Authorization: Bearer $TOKEN" -H "Accept: application/vnd.github.v3.raw" | grep 'version:' | awk '{print $2}') @@ -35,15 +36,15 @@ jobs: - name: "Trigger spec update" run: | - FILE_REF="main" + BRANCH="main" if [ "${{ matrix.file }}" = "orchestration" ]; then - FILE_REF="$ORCH_VERSION" + BRANCH="v$ORCH_VERSION" fi - echo "Using file ref: $FILE_REF" + echo "Using branch: $BRANCH" gh workflow run spec-update.yaml \ --field file=${{ matrix.file }} \ - --field file-ref=main \ + --field file-ref=$BRANCH \ --field create-pr=true env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 47a35bf570f9b067eecb5b07aa448e8ce3c03924 Mon Sep 17 00:00:00 2001 From: I538344 Date: Wed, 27 Aug 2025 15:24:04 +0200 Subject: [PATCH 03/15] finito --- .github/workflows/weekly-spec-update.yaml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/weekly-spec-update.yaml b/.github/workflows/weekly-spec-update.yaml index 540091b39..b7e6c653b 100644 --- a/.github/workflows/weekly-spec-update.yaml +++ b/.github/workflows/weekly-spec-update.yaml @@ -28,6 +28,10 @@ jobs: run: | ORCH_VERSION=$(curl --silent --request GET --url "https://github.tools.sap/api/v3/repos/MLF-prod/mlf-gitops-prod/contents/services/llm-orchestration/source/Chart.yaml?ref=aws.eu-central-1.prod-eu/current" -H "Authorization: Bearer $TOKEN" -H "Accept: application/vnd.github.v3.raw" | grep 'version:' | awk '{print $2}') + if [ -z "$ORCH_VERSION" ]; then + echo "Failed to fetch orchestration version" + exit 1 + fi echo "Orchestration version: $ORCH_VERSION" echo "ORCH_VERSION=$ORCH_VERSION" >> $GITHUB_ENV env: @@ -48,3 +52,16 @@ jobs: --field create-pr=true env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: "Slack Notification" + if: failure() + uses: slackapi/slack-github-action@v2.1.1 + with: + webhook: ${{ secrets.SLACK_WEBHOOK }} + webhook-type: incoming-webhook + payload: | + blocks: + - type: "section" + text: + type: "mrkdwn" + text: "⚠️ Weekly spec update failed! 😬 Please inspect & fix by clicking " From 2ae2a876a8a2268be4fd6125959c60f3f0793229 Mon Sep 17 00:00:00 2001 From: I538344 Date: Wed, 27 Aug 2025 15:29:21 +0200 Subject: [PATCH 04/15] fix tag name --- .github/workflows/weekly-spec-update.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/weekly-spec-update.yaml b/.github/workflows/weekly-spec-update.yaml index b7e6c653b..638a000e9 100644 --- a/.github/workflows/weekly-spec-update.yaml +++ b/.github/workflows/weekly-spec-update.yaml @@ -42,7 +42,7 @@ jobs: run: | BRANCH="main" if [ "${{ matrix.file }}" = "orchestration" ]; then - BRANCH="v$ORCH_VERSION" + BRANCH="rel/$ORCH_VERSION" fi echo "Using branch: $BRANCH" From 6fc321176febc02f2075044cee5660e4eb1db25a Mon Sep 17 00:00:00 2001 From: I538344 Date: Wed, 27 Aug 2025 15:37:25 +0200 Subject: [PATCH 05/15] remove workflow dispatch --- .github/workflows/weekly-spec-update.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/weekly-spec-update.yaml b/.github/workflows/weekly-spec-update.yaml index 638a000e9..73f82cd3a 100644 --- a/.github/workflows/weekly-spec-update.yaml +++ b/.github/workflows/weekly-spec-update.yaml @@ -3,7 +3,6 @@ name: "Weekly Spec Update" on: schedule: - cron: '0 0 * * SUN' # Every Sunday at midnight UTC - workflow_dispatch: jobs: update-all-specs: From d8d46f460a9670b2f8c2f4bbac292bdc7597b8e0 Mon Sep 17 00:00:00 2001 From: I538344 Date: Wed, 29 Oct 2025 14:29:24 +0100 Subject: [PATCH 06/15] feat: [DevOps] Replace Fosstars with OpenSSF Scorecard --- .github/workflows/fosstars-report.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/fosstars-report.yml b/.github/workflows/fosstars-report.yml index 5bd8804a5..2f5693114 100644 --- a/.github/workflows/fosstars-report.yml +++ b/.github/workflows/fosstars-report.yml @@ -70,12 +70,17 @@ jobs: path: ${{ env.CVE_CACHE_DIR }} key: ${{ env.CVE_CACHE_KEY }} - # This action changes the active branch! - - name: "Fosstars Rating" - uses: SAP/fosstars-rating-core-action@v1.14.0 + - name: "Run analysis" + uses: ossf/scorecard-action@v2.4.3 with: - report-branch: fosstars-report - token: ${{ secrets.GITHUB_TOKEN }} + results_file: results.sarif + results_format: sarif + # Scorecard team runs a weekly scan of public GitHub repos, + # see https://github.com/ossf/scorecard#public-data. + # Setting `publish_results: true` helps us scale by leveraging your workflow to + # extract the results instead of relying on our own infrastructure to run scans. + # And it's free for you! + publish_results: true - name: "Slack Notification" if: failure() From ca05f58f1d7c719d74c6c5670c535f2f8a8bdb6d Mon Sep 17 00:00:00 2001 From: I538344 Date: Wed, 29 Oct 2025 14:43:45 +0100 Subject: [PATCH 07/15] scorecard first --- .github/workflows/fosstars-report.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/fosstars-report.yml b/.github/workflows/fosstars-report.yml index 0e4bafc73..8760b5cea 100644 --- a/.github/workflows/fosstars-report.yml +++ b/.github/workflows/fosstars-report.yml @@ -22,6 +22,18 @@ jobs: - name: "Checkout repository" uses: actions/checkout@v5 + - name: "Run analysis" + uses: ossf/scorecard-action@v2.4.3 + with: + results_file: results.sarif + results_format: sarif + # Scorecard team runs a weekly scan of public GitHub repos, + # see https://github.com/ossf/scorecard#public-data. + # Setting `publish_results: true` helps us scale by leveraging your workflow to + # extract the results instead of relying on our own infrastructure to run scans. + # And it's free for you! + publish_results: true + - name: "Setup java" uses: actions/setup-java@v5 with: @@ -75,18 +87,6 @@ jobs: path: ${{ env.CVE_CACHE_DIR }} key: ${{ env.CVE_CACHE_KEY }} - - name: "Run analysis" - uses: ossf/scorecard-action@v2.4.3 - with: - results_file: results.sarif - results_format: sarif - # Scorecard team runs a weekly scan of public GitHub repos, - # see https://github.com/ossf/scorecard#public-data. - # Setting `publish_results: true` helps us scale by leveraging your workflow to - # extract the results instead of relying on our own infrastructure to run scans. - # And it's free for you! - publish_results: true - - name: "Slack Notification" if: failure() uses: slackapi/slack-github-action@v2.1.1 From 86efb3c7d9b20d5439a87975dfa189287377ff8d Mon Sep 17 00:00:00 2001 From: I538344 Date: Wed, 29 Oct 2025 14:54:36 +0100 Subject: [PATCH 08/15] added permissions --- .github/workflows/fosstars-report.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/fosstars-report.yml b/.github/workflows/fosstars-report.yml index 8760b5cea..cdc8e3b9b 100644 --- a/.github/workflows/fosstars-report.yml +++ b/.github/workflows/fosstars-report.yml @@ -18,6 +18,8 @@ jobs: permissions: contents: read actions: write + id-token: write + publish_results: true steps: - name: "Checkout repository" uses: actions/checkout@v5 From b9b05339659acf29250a102153a358a23e3074f6 Mon Sep 17 00:00:00 2001 From: I538344 Date: Wed, 29 Oct 2025 14:54:52 +0100 Subject: [PATCH 09/15] added permissions --- .github/workflows/fosstars-report.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/fosstars-report.yml b/.github/workflows/fosstars-report.yml index cdc8e3b9b..b98b35101 100644 --- a/.github/workflows/fosstars-report.yml +++ b/.github/workflows/fosstars-report.yml @@ -19,7 +19,6 @@ jobs: contents: read actions: write id-token: write - publish_results: true steps: - name: "Checkout repository" uses: actions/checkout@v5 From 4ecd132ab26ee12e66ce077632a6cb11fe26fb98 Mon Sep 17 00:00:00 2001 From: I538344 Date: Wed, 29 Oct 2025 15:00:25 +0100 Subject: [PATCH 10/15] no upload --- .github/workflows/fosstars-report.yml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/.github/workflows/fosstars-report.yml b/.github/workflows/fosstars-report.yml index b98b35101..7557f8a89 100644 --- a/.github/workflows/fosstars-report.yml +++ b/.github/workflows/fosstars-report.yml @@ -1,4 +1,4 @@ -name: "Fosstars (Security)" +name: "Security Rating & Vulnerability Scan" on: workflow_dispatch: schedule: @@ -18,7 +18,6 @@ jobs: permissions: contents: read actions: write - id-token: write steps: - name: "Checkout repository" uses: actions/checkout@v5 @@ -28,12 +27,6 @@ jobs: with: results_file: results.sarif results_format: sarif - # Scorecard team runs a weekly scan of public GitHub repos, - # see https://github.com/ossf/scorecard#public-data. - # Setting `publish_results: true` helps us scale by leveraging your workflow to - # extract the results instead of relying on our own infrastructure to run scans. - # And it's free for you! - publish_results: true - name: "Setup java" uses: actions/setup-java@v5 From 9cf771cfb39f530106d2f1ae89b6dc2b9eb46027 Mon Sep 17 00:00:00 2001 From: SAP Cloud SDK Bot Date: Sun, 7 Dec 2025 01:54:50 +0000 Subject: [PATCH 11/15] Update prompt-registry based on main --- .../registry/model/OrchestrationConfig.java | 10 ++-- .../model/OrchestrationConfigModules.java | 58 +++++++++++++++++++ .../main/resources/spec/prompt-registry.yaml | 13 ++++- 3 files changed, 74 insertions(+), 7 deletions(-) create mode 100644 core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/OrchestrationConfigModules.java diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/OrchestrationConfig.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/OrchestrationConfig.java index ab6472801..ba8c0b894 100644 --- a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/OrchestrationConfig.java +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/OrchestrationConfig.java @@ -29,7 +29,7 @@ public class OrchestrationConfig // CHECKSTYLE:ON { @JsonProperty("modules") - private ModuleConfigs modules; + private OrchestrationConfigModules modules; @JsonProperty("stream") private GlobalStreamOptions stream; @@ -47,7 +47,7 @@ protected OrchestrationConfig() {} * @return The same instance of this {@link OrchestrationConfig} class */ @Nonnull - public OrchestrationConfig modules(@Nonnull final ModuleConfigs modules) { + public OrchestrationConfig modules(@Nonnull final OrchestrationConfigModules modules) { this.modules = modules; return this; } @@ -58,7 +58,7 @@ public OrchestrationConfig modules(@Nonnull final ModuleConfigs modules) { * @return modules The modules of this {@link OrchestrationConfig} instance. */ @Nonnull - public ModuleConfigs getModules() { + public OrchestrationConfigModules getModules() { return modules; } @@ -67,7 +67,7 @@ public ModuleConfigs getModules() { * * @param modules The modules of this {@link OrchestrationConfig} */ - public void setModules(@Nonnull final ModuleConfigs modules) { + public void setModules(@Nonnull final OrchestrationConfigModules modules) { this.modules = modules; } @@ -217,6 +217,6 @@ public interface Builder { * @param modules The modules of this {@link OrchestrationConfig} * @return The OrchestrationConfig instance. */ - OrchestrationConfig modules(@Nonnull final ModuleConfigs modules); + OrchestrationConfig modules(@Nonnull final OrchestrationConfigModules modules); } } diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/OrchestrationConfigModules.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/OrchestrationConfigModules.java new file mode 100644 index 000000000..02d0bdb01 --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/OrchestrationConfigModules.java @@ -0,0 +1,58 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import java.util.List; +import javax.annotation.Nonnull; + +/** OrchestrationConfigModules */ +public interface OrchestrationConfigModules { + /** + * Helper class to create {@code ModuleConfigs } that implements {@link + * OrchestrationConfigModules}. + */ + record InnerModuleConfigs( + @com.fasterxml.jackson.annotation.JsonValue @Nonnull ModuleConfigs value) + implements OrchestrationConfigModules {} + + /** + * Creator to enable deserialization of {@code ModuleConfigs }. + * + * @param val the value to use + * @return a new instance of {@link InnerModuleConfigs}. + */ + @com.fasterxml.jackson.annotation.JsonCreator + @Nonnull + static InnerModuleConfigs createInnerModuleConfigs(@Nonnull final ModuleConfigs val) { + return new InnerModuleConfigs(val); + } + + /** + * Helper class to create {@code List } that implements {@link + * OrchestrationConfigModules}. + */ + record ListOfModuleConfigss( + @com.fasterxml.jackson.annotation.JsonValue @Nonnull List values) + implements OrchestrationConfigModules {} + + /** + * Creator to enable deserialization of {@code List }. + * + * @param val the value to use + * @return a new instance of {@link ListOfModuleConfigss}. + */ + @com.fasterxml.jackson.annotation.JsonCreator + @Nonnull + static ListOfModuleConfigss createListOfModuleConfigss(@Nonnull final List val) { + return new ListOfModuleConfigss(val); + } +} diff --git a/core-services/prompt-registry/src/main/resources/spec/prompt-registry.yaml b/core-services/prompt-registry/src/main/resources/spec/prompt-registry.yaml index dc137966e..8bf986342 100644 --- a/core-services/prompt-registry/src/main/resources/spec/prompt-registry.yaml +++ b/core-services/prompt-registry/src/main/resources/spec/prompt-registry.yaml @@ -1283,7 +1283,7 @@ components: description: Additional parameters for the model. Default values are used for mandatory parameters. additionalProperties: true example: - max_tokens: 300 + max_completion_tokens: 300 temperature: 0.1 frequency_penalty: 0 presence_penalty: 0 @@ -1942,6 +1942,13 @@ components: $ref: '#/components/schemas/GroundingModuleConfig' translation: $ref: '#/components/schemas/TranslationModuleConfig' + ModuleConfigsList: + type: array + items: + $ref: '#/components/schemas/ModuleConfigs' + minItems: 1 + description: | + A list of module configurations. The first configuration in the list that succeeds will be used. GlobalStreamOptions: description: Options for streaming. Will be ignored if enabled is false. type: object @@ -1976,7 +1983,9 @@ components: additionalProperties: false properties: modules: - $ref: '#/components/schemas/ModuleConfigs' + oneOf: + - $ref: '#/components/schemas/ModuleConfigs' + - $ref: '#/components/schemas/ModuleConfigsList' stream: $ref: '#/components/schemas/GlobalStreamOptions' responses: From 013e6185b421663f06d73e7827c347123fb76fd4 Mon Sep 17 00:00:00 2001 From: SAP Cloud SDK Bot Date: Sun, 14 Dec 2025 01:55:32 +0000 Subject: [PATCH 12/15] Update prompt-registry based on main --- .../PromptTemplateSubstitutionRequest.java | 24 +++++++++++++++---- .../main/resources/spec/prompt-registry.yaml | 2 ++ 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/PromptTemplateSubstitutionRequest.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/PromptTemplateSubstitutionRequest.java index 14c6757e9..b1b2f5e1d 100644 --- a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/PromptTemplateSubstitutionRequest.java +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/PromptTemplateSubstitutionRequest.java @@ -45,7 +45,7 @@ protected PromptTemplateSubstitutionRequest() {} * @return The same instance of this {@link PromptTemplateSubstitutionRequest} class */ @Nonnull - public PromptTemplateSubstitutionRequest inputParams(@Nullable final Object inputParams) { + public PromptTemplateSubstitutionRequest inputParams(@Nonnull final Object inputParams) { this.inputParams = inputParams; return this; } @@ -65,7 +65,7 @@ public Object getInputParams() { * * @param inputParams The inputParams of this {@link PromptTemplateSubstitutionRequest} */ - public void setInputParams(@Nullable final Object inputParams) { + public void setInputParams(@Nonnull final Object inputParams) { this.inputParams = inputParams; } @@ -170,8 +170,22 @@ private String toIndentedString(final java.lang.Object o) { return o.toString().replace("\n", "\n "); } - /** Create a new {@link PromptTemplateSubstitutionRequest} instance. No arguments are required. */ - public static PromptTemplateSubstitutionRequest create() { - return new PromptTemplateSubstitutionRequest(); + /** + * Create a type-safe, fluent-api builder object to construct a new {@link + * PromptTemplateSubstitutionRequest} instance with all required arguments. + */ + public static Builder create() { + return (inputParams) -> new PromptTemplateSubstitutionRequest().inputParams(inputParams); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the inputParams of this {@link PromptTemplateSubstitutionRequest} instance. + * + * @param inputParams The inputParams of this {@link PromptTemplateSubstitutionRequest} + * @return The PromptTemplateSubstitutionRequest instance. + */ + PromptTemplateSubstitutionRequest inputParams(@Nonnull final Object inputParams); } } diff --git a/core-services/prompt-registry/src/main/resources/spec/prompt-registry.yaml b/core-services/prompt-registry/src/main/resources/spec/prompt-registry.yaml index 8bf986342..ac7981aef 100644 --- a/core-services/prompt-registry/src/main/resources/spec/prompt-registry.yaml +++ b/core-services/prompt-registry/src/main/resources/spec/prompt-registry.yaml @@ -867,6 +867,8 @@ components: $ref: '#/components/schemas/PromptTemplateSpec' PromptTemplateSubstitutionRequest: type: object + required: + - inputParams properties: inputParams: type: object From 9b01a7988da3a0c58c0b267432af12308ac47a81 Mon Sep 17 00:00:00 2001 From: SAP Cloud SDK Bot Date: Sun, 22 Mar 2026 02:28:45 +0000 Subject: [PATCH 13/15] Update prompt-registry based on main --- .../client/OrchestrationConfigsApi.java | 48 ++-- .../registry/client/PromptTemplatesApi.java | 9 +- .../sdk/prompt/registry/model/DPIConfig.java | 109 ++++++++- .../prompt/registry/model/FileContent.java | 221 ++++++++++++++++++ .../model/UserChatMessageContentItem.java | 44 +++- .../main/resources/spec/prompt-registry.yaml | 56 +++++ 6 files changed, 467 insertions(+), 20 deletions(-) create mode 100644 core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/FileContent.java diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/client/OrchestrationConfigsApi.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/client/OrchestrationConfigsApi.java index 80b71f022..40e1ffa21 100644 --- a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/client/OrchestrationConfigsApi.java +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/client/OrchestrationConfigsApi.java @@ -325,8 +325,9 @@ public File exportOrchestrationConfig(@Nonnull final UUID orchestrationConfigId) * * @param orchestrationConfigId (required) The value for the parameter orchestrationConfigId * @param aiResourceGroup (optional) Specify a resource group id to use - * @param resolveTemplateRef (optional, default to false) The value for the parameter - * resolveTemplateRef + * @param resolveTemplateRef (optional, default to false) DEPRECATED: Use resolveTemplateRef + * instead + * @param resolveTemplateRef2 (optional) The value for the parameter resolveTemplateRef2 * @return OrchestrationConfigGetResponse * @throws OpenApiRequestException if an error occurs while attempting to invoke the API */ @@ -334,7 +335,8 @@ public File exportOrchestrationConfig(@Nonnull final UUID orchestrationConfigId) public OrchestrationConfigGetResponse getOrchestrationConfigByUuid( @Nonnull final UUID orchestrationConfigId, @Nullable final String aiResourceGroup, - @Nullable final Boolean resolveTemplateRef) + @Nullable final Boolean resolveTemplateRef, + @Nullable final Boolean resolveTemplateRef2) throws OpenApiRequestException { final Object localVarPostBody = null; @@ -360,6 +362,8 @@ public OrchestrationConfigGetResponse getOrchestrationConfigByUuid( localVarQueryParams.putAll( apiClient.parameterToMultiValueMap(null, "resolve_template_ref", resolveTemplateRef)); + localVarQueryParams.putAll( + apiClient.parameterToMultiValueMap(null, "resolveTemplateRef", resolveTemplateRef2)); if (aiResourceGroup != null) localVarHeaderParams.add("AI-Resource-Group", apiClient.parameterToString(aiResourceGroup)); @@ -404,7 +408,7 @@ public OrchestrationConfigGetResponse getOrchestrationConfigByUuid( @Nonnull public OrchestrationConfigGetResponse getOrchestrationConfigByUuid( @Nonnull final UUID orchestrationConfigId) throws OpenApiRequestException { - return getOrchestrationConfigByUuid(orchestrationConfigId, null, null); + return getOrchestrationConfigByUuid(orchestrationConfigId, null, null, null); } /** @@ -498,9 +502,11 @@ public OrchestrationConfigPostResponse importOrchestrationConfig() * @param version (required) The value for the parameter version * @param name (required) The value for the parameter name * @param aiResourceGroup (optional) Specify a resource group id to use - * @param includeSpec (optional, default to false) The value for the parameter includeSpec - * @param resolveTemplateRef (optional, default to false) The value for the parameter - * resolveTemplateRef + * @param includeSpec (optional, default to false) DEPRECATED: Use includeSpec instead + * @param includeSpec2 (optional) The value for the parameter includeSpec2 + * @param resolveTemplateRef (optional, default to false) DEPRECATED: Use resolveTemplateRef + * instead + * @param resolveTemplateRef2 (optional) The value for the parameter resolveTemplateRef2 * @return OrchestrationConfigListResponse * @throws OpenApiRequestException if an error occurs while attempting to invoke the API */ @@ -511,7 +517,9 @@ public OrchestrationConfigListResponse listOrchestrationConfigHistory( @Nonnull final String name, @Nullable final String aiResourceGroup, @Nullable final Boolean includeSpec, - @Nullable final Boolean resolveTemplateRef) + @Nullable final Boolean includeSpec2, + @Nullable final Boolean resolveTemplateRef, + @Nullable final Boolean resolveTemplateRef2) throws OpenApiRequestException { final Object localVarPostBody = null; @@ -552,8 +560,12 @@ public OrchestrationConfigListResponse listOrchestrationConfigHistory( localVarQueryParams.putAll( apiClient.parameterToMultiValueMap(null, "include_spec", includeSpec)); + localVarQueryParams.putAll( + apiClient.parameterToMultiValueMap(null, "includeSpec", includeSpec2)); localVarQueryParams.putAll( apiClient.parameterToMultiValueMap(null, "resolve_template_ref", resolveTemplateRef)); + localVarQueryParams.putAll( + apiClient.parameterToMultiValueMap(null, "resolveTemplateRef", resolveTemplateRef2)); if (aiResourceGroup != null) localVarHeaderParams.add("AI-Resource-Group", apiClient.parameterToString(aiResourceGroup)); @@ -601,7 +613,7 @@ public OrchestrationConfigListResponse listOrchestrationConfigHistory( public OrchestrationConfigListResponse listOrchestrationConfigHistory( @Nonnull final String scenario, @Nonnull final String version, @Nonnull final String name) throws OpenApiRequestException { - return listOrchestrationConfigHistory(scenario, version, name, null, null, null); + return listOrchestrationConfigHistory(scenario, version, name, null, null, null, null, null); } /** @@ -620,9 +632,11 @@ public OrchestrationConfigListResponse listOrchestrationConfigHistory( * @param name (optional) The value for the parameter name * @param version (optional) The value for the parameter version * @param retrieve (optional, default to both) The value for the parameter retrieve - * @param includeSpec (optional, default to false) The value for the parameter includeSpec - * @param resolveTemplateRef (optional, default to false) The value for the parameter - * resolveTemplateRef + * @param includeSpec (optional, default to false) DEPRECATED: Use includeSpec instead + * @param includeSpec2 (optional) The value for the parameter includeSpec2 + * @param resolveTemplateRef (optional, default to false) DEPRECATED: Use resolveTemplateRef + * instead + * @param resolveTemplateRef2 (optional) The value for the parameter resolveTemplateRef2 * @return OrchestrationConfigListResponse * @throws OpenApiRequestException if an error occurs while attempting to invoke the API */ @@ -634,7 +648,9 @@ public OrchestrationConfigListResponse listOrchestrationConfigs( @Nullable final String version, @Nullable final String retrieve, @Nullable final Boolean includeSpec, - @Nullable final Boolean resolveTemplateRef) + @Nullable final Boolean includeSpec2, + @Nullable final Boolean resolveTemplateRef, + @Nullable final Boolean resolveTemplateRef2) throws OpenApiRequestException { final Object localVarPostBody = null; @@ -653,8 +669,12 @@ public OrchestrationConfigListResponse listOrchestrationConfigs( localVarQueryParams.putAll(apiClient.parameterToMultiValueMap(null, "retrieve", retrieve)); localVarQueryParams.putAll( apiClient.parameterToMultiValueMap(null, "include_spec", includeSpec)); + localVarQueryParams.putAll( + apiClient.parameterToMultiValueMap(null, "includeSpec", includeSpec2)); localVarQueryParams.putAll( apiClient.parameterToMultiValueMap(null, "resolve_template_ref", resolveTemplateRef)); + localVarQueryParams.putAll( + apiClient.parameterToMultiValueMap(null, "resolveTemplateRef", resolveTemplateRef2)); if (aiResourceGroup != null) localVarHeaderParams.add("AI-Resource-Group", apiClient.parameterToString(aiResourceGroup)); @@ -697,6 +717,6 @@ public OrchestrationConfigListResponse listOrchestrationConfigs( */ @Nonnull public OrchestrationConfigListResponse listOrchestrationConfigs() throws OpenApiRequestException { - return listOrchestrationConfigs(null, null, null, null, null, null, null); + return listOrchestrationConfigs(null, null, null, null, null, null, null, null, null); } } diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/client/PromptTemplatesApi.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/client/PromptTemplatesApi.java index 93d4aca31..28da867f3 100644 --- a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/client/PromptTemplatesApi.java +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/client/PromptTemplatesApi.java @@ -518,6 +518,7 @@ public PromptTemplatePostResponse importPromptTemplate() throws OpenApiRequestEx * @param name (required) The value for the parameter name * @param aiResourceGroup (optional) Specify a resource group id to use * @param aiResourceGroupScope (optional) Specify whether the resource group scope is to be used + * @param includeSpec (optional, default to false) The value for the parameter includeSpec * @return PromptTemplateListResponse * @throws OpenApiRequestException if an error occurs while attempting to invoke the API */ @@ -527,7 +528,8 @@ public PromptTemplateListResponse listPromptTemplateHistory( @Nonnull final String version, @Nonnull final String name, @Nullable final String aiResourceGroup, - @Nullable final String aiResourceGroupScope) + @Nullable final String aiResourceGroupScope, + @Nullable final Boolean includeSpec) throws OpenApiRequestException { final Object localVarPostBody = null; @@ -566,6 +568,9 @@ public PromptTemplateListResponse listPromptTemplateHistory( final MultiValueMap localVarFormParams = new LinkedMultiValueMap(); + localVarQueryParams.putAll( + apiClient.parameterToMultiValueMap(null, "includeSpec", includeSpec)); + if (aiResourceGroup != null) localVarHeaderParams.add("AI-Resource-Group", apiClient.parameterToString(aiResourceGroup)); if (aiResourceGroupScope != null) @@ -615,7 +620,7 @@ public PromptTemplateListResponse listPromptTemplateHistory( public PromptTemplateListResponse listPromptTemplateHistory( @Nonnull final String scenario, @Nonnull final String version, @Nonnull final String name) throws OpenApiRequestException { - return listPromptTemplateHistory(scenario, version, name, null, null); + return listPromptTemplateHistory(scenario, version, name, null, null, null); } /** diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/DPIConfig.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/DPIConfig.java index 0d609b103..d0ac9d3a3 100644 --- a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/DPIConfig.java +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/DPIConfig.java @@ -159,6 +159,66 @@ public static MethodEnum fromValue(@Nonnull final String value) { @JsonProperty("mask_grounding_input") private DPIConfigMaskGroundingInput maskGroundingInput; + /** Type of masking method to be used for file inputs. Required if file inputs are provided. */ + public enum MaskFileInputMethodEnum { + /** The ANONYMIZATION option of this DPIConfig */ + ANONYMIZATION("anonymization"), + + /** The SKIP option of this DPIConfig */ + SKIP("skip"), + + /** The UNKNOWN_DEFAULT_OPEN_API option of this DPIConfig */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + MaskFileInputMethodEnum(String value) { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public String getValue() { + return value; + } + + /** + * Get the String value of the enum value. + * + * @return The enum value as String + */ + @Override + @Nonnull + public String toString() { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * + * @param value The String value + * @return The enum value of type DPIConfig + */ + @JsonCreator + @Nonnull + public static MaskFileInputMethodEnum fromValue(@Nonnull final String value) { + for (MaskFileInputMethodEnum b : MaskFileInputMethodEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty("mask_file_input_method") + private MaskFileInputMethodEnum maskFileInputMethod; + @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); @@ -352,6 +412,40 @@ public void setMaskGroundingInput( this.maskGroundingInput = maskGroundingInput; } + /** + * Set the maskFileInputMethod of this {@link DPIConfig} instance and return the same instance. + * + * @param maskFileInputMethod Type of masking method to be used for file inputs. Required if file + * inputs are provided. + * @return The same instance of this {@link DPIConfig} class + */ + @Nonnull + public DPIConfig maskFileInputMethod( + @Nullable final MaskFileInputMethodEnum maskFileInputMethod) { + this.maskFileInputMethod = maskFileInputMethod; + return this; + } + + /** + * Type of masking method to be used for file inputs. Required if file inputs are provided. + * + * @return maskFileInputMethod The maskFileInputMethod of this {@link DPIConfig} instance. + */ + @Nonnull + public MaskFileInputMethodEnum getMaskFileInputMethod() { + return maskFileInputMethod; + } + + /** + * Set the maskFileInputMethod of this {@link DPIConfig} instance. + * + * @param maskFileInputMethod Type of masking method to be used for file inputs. Required if file + * inputs are provided. + */ + public void setMaskFileInputMethod(@Nullable final MaskFileInputMethodEnum maskFileInputMethod) { + this.maskFileInputMethod = maskFileInputMethod; + } + /** * Get the names of the unrecognizable properties of the {@link DPIConfig}. * @@ -395,6 +489,7 @@ public Map toMap() { if (entities != null) declaredFields.put("entities", entities); if (allowlist != null) declaredFields.put("allowlist", allowlist); if (maskGroundingInput != null) declaredFields.put("maskGroundingInput", maskGroundingInput); + if (maskFileInputMethod != null) declaredFields.put("maskFileInputMethod", maskFileInputMethod); return declaredFields; } @@ -424,13 +519,20 @@ public boolean equals(@Nullable final java.lang.Object o) { && Objects.equals(this.method, dpIConfig.method) && Objects.equals(this.entities, dpIConfig.entities) && Objects.equals(this.allowlist, dpIConfig.allowlist) - && Objects.equals(this.maskGroundingInput, dpIConfig.maskGroundingInput); + && Objects.equals(this.maskGroundingInput, dpIConfig.maskGroundingInput) + && Objects.equals(this.maskFileInputMethod, dpIConfig.maskFileInputMethod); } @Override public int hashCode() { return Objects.hash( - type, method, entities, allowlist, maskGroundingInput, cloudSdkCustomFields); + type, + method, + entities, + allowlist, + maskGroundingInput, + maskFileInputMethod, + cloudSdkCustomFields); } @Override @@ -443,6 +545,9 @@ public String toString() { sb.append(" entities: ").append(toIndentedString(entities)).append("\n"); sb.append(" allowlist: ").append(toIndentedString(allowlist)).append("\n"); sb.append(" maskGroundingInput: ").append(toIndentedString(maskGroundingInput)).append("\n"); + sb.append(" maskFileInputMethod: ") + .append(toIndentedString(maskFileInputMethod)) + .append("\n"); cloudSdkCustomFields.forEach( (k, v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/FileContent.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/FileContent.java new file mode 100644 index 000000000..bab9b78b2 --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/FileContent.java @@ -0,0 +1,221 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** FileContent */ +// CHECKSTYLE:OFF +public class FileContent +// CHECKSTYLE:ON +{ + @JsonProperty("file_data") + private String fileData; + + @JsonProperty("filename") + private String filename; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for FileContent. */ + protected FileContent() {} + + /** + * Set the fileData of this {@link FileContent} instance and return the same instance. + * + * @param fileData Base64 encoded file content or file URL + * @return The same instance of this {@link FileContent} class + */ + @Nonnull + public FileContent fileData(@Nonnull final String fileData) { + this.fileData = fileData; + return this; + } + + /** + * Base64 encoded file content or file URL + * + * @return fileData The fileData of this {@link FileContent} instance. + */ + @Nonnull + public String getFileData() { + return fileData; + } + + /** + * Set the fileData of this {@link FileContent} instance. + * + * @param fileData Base64 encoded file content or file URL + */ + public void setFileData(@Nonnull final String fileData) { + this.fileData = fileData; + } + + /** + * Set the filename of this {@link FileContent} instance and return the same instance. + * + * @param filename Name of the file + * @return The same instance of this {@link FileContent} class + */ + @Nonnull + public FileContent filename(@Nullable final String filename) { + this.filename = filename; + return this; + } + + /** + * Name of the file + * + * @return filename The filename of this {@link FileContent} instance. + */ + @Nonnull + public String getFilename() { + return filename; + } + + /** + * Set the filename of this {@link FileContent} instance. + * + * @param filename Name of the file + */ + public void setFilename(@Nullable final String filename) { + this.filename = filename; + } + + /** + * Get the names of the unrecognizable properties of the {@link FileContent}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link FileContent} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException("FileContent has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link FileContent} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (fileData != null) declaredFields.put("fileData", fileData); + if (filename != null) declaredFields.put("filename", filename); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link FileContent} instance. If the map previously + * contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final FileContent fileContent = (FileContent) o; + return Objects.equals(this.cloudSdkCustomFields, fileContent.cloudSdkCustomFields) + && Objects.equals(this.fileData, fileContent.fileData) + && Objects.equals(this.filename, fileContent.filename); + } + + @Override + public int hashCode() { + return Objects.hash(fileData, filename, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class FileContent {\n"); + sb.append(" fileData: ").append(toIndentedString(fileData)).append("\n"); + sb.append(" filename: ").append(toIndentedString(filename)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create a type-safe, fluent-api builder object to construct a new {@link FileContent} instance + * with all required arguments. + */ + public static Builder create() { + return (fileData) -> new FileContent().fileData(fileData); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the fileData of this {@link FileContent} instance. + * + * @param fileData Base64 encoded file content or file URL + * @return The FileContent instance. + */ + FileContent fileData(@Nonnull final String fileData); + } +} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/UserChatMessageContentItem.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/UserChatMessageContentItem.java index 0890aa675..b82526c28 100644 --- a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/UserChatMessageContentItem.java +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/UserChatMessageContentItem.java @@ -38,6 +38,9 @@ public enum TypeEnum { /** The IMAGE_URL option of this UserChatMessageContentItem */ IMAGE_URL("image_url"), + /** The FILE option of this UserChatMessageContentItem */ + FILE("file"), + /** The UNKNOWN_DEFAULT_OPEN_API option of this UserChatMessageContentItem */ UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); @@ -96,6 +99,9 @@ public static TypeEnum fromValue(@Nonnull final String value) { @JsonProperty("image_url") private ImageContentUrl imageUrl; + @JsonProperty("file") + private FileContent _file; + @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); @@ -196,6 +202,37 @@ public void setImageUrl(@Nullable final ImageContentUrl imageUrl) { this.imageUrl = imageUrl; } + /** + * Set the _file of this {@link UserChatMessageContentItem} instance and return the same instance. + * + * @param _file The _file of this {@link UserChatMessageContentItem} + * @return The same instance of this {@link UserChatMessageContentItem} class + */ + @Nonnull + public UserChatMessageContentItem _file(@Nullable final FileContent _file) { + this._file = _file; + return this; + } + + /** + * Get _file + * + * @return _file The _file of this {@link UserChatMessageContentItem} instance. + */ + @Nonnull + public FileContent getFile() { + return _file; + } + + /** + * Set the _file of this {@link UserChatMessageContentItem} instance. + * + * @param _file The _file of this {@link UserChatMessageContentItem} + */ + public void setFile(@Nullable final FileContent _file) { + this._file = _file; + } + /** * Get the names of the unrecognizable properties of the {@link UserChatMessageContentItem}. * @@ -239,6 +276,7 @@ public Map toMap() { if (type != null) declaredFields.put("type", type); if (text != null) declaredFields.put("text", text); if (imageUrl != null) declaredFields.put("imageUrl", imageUrl); + if (_file != null) declaredFields.put("_file", _file); return declaredFields; } @@ -267,12 +305,13 @@ public boolean equals(@Nullable final java.lang.Object o) { this.cloudSdkCustomFields, userChatMessageContentItem.cloudSdkCustomFields) && Objects.equals(this.type, userChatMessageContentItem.type) && Objects.equals(this.text, userChatMessageContentItem.text) - && Objects.equals(this.imageUrl, userChatMessageContentItem.imageUrl); + && Objects.equals(this.imageUrl, userChatMessageContentItem.imageUrl) + && Objects.equals(this._file, userChatMessageContentItem._file); } @Override public int hashCode() { - return Objects.hash(type, text, imageUrl, cloudSdkCustomFields); + return Objects.hash(type, text, imageUrl, _file, cloudSdkCustomFields); } @Override @@ -283,6 +322,7 @@ public String toString() { sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" text: ").append(toIndentedString(text)).append("\n"); sb.append(" imageUrl: ").append(toIndentedString(imageUrl)).append("\n"); + sb.append(" _file: ").append(toIndentedString(_file)).append("\n"); cloudSdkCustomFields.forEach( (k, v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); diff --git a/core-services/prompt-registry/src/main/resources/spec/prompt-registry.yaml b/core-services/prompt-registry/src/main/resources/spec/prompt-registry.yaml index ac7981aef..f12f94189 100644 --- a/core-services/prompt-registry/src/main/resources/spec/prompt-registry.yaml +++ b/core-services/prompt-registry/src/main/resources/spec/prompt-registry.yaml @@ -107,6 +107,11 @@ paths: required: true schema: type: string + - name: includeSpec + in: query + schema: + type: boolean + default: false responses: '200': description: Successful response @@ -381,14 +386,26 @@ paths: - declarative - name: include_spec in: query + deprecated: true + description: 'DEPRECATED: Use includeSpec instead' schema: type: boolean default: false + - name: includeSpec + in: query + schema: + type: boolean - name: resolve_template_ref in: query + deprecated: true + description: 'DEPRECATED: Use resolveTemplateRef instead' schema: type: boolean default: false + - name: resolveTemplateRef + in: query + schema: + type: boolean responses: '200': description: Successful response @@ -428,14 +445,26 @@ paths: type: string - name: include_spec in: query + deprecated: true + description: 'DEPRECATED: Use includeSpec instead' schema: type: boolean default: false + - name: includeSpec + in: query + schema: + type: boolean - name: resolve_template_ref in: query + deprecated: true + description: 'DEPRECATED: Use resolveTemplateRef instead' schema: type: boolean default: false + - name: resolveTemplateRef + in: query + schema: + type: boolean responses: '200': description: Successful response @@ -466,9 +495,15 @@ paths: format: uuid - name: resolve_template_ref in: query + deprecated: true + description: 'DEPRECATED: Use resolveTemplateRef instead' schema: type: boolean default: false + - name: resolveTemplateRef + in: query + schema: + type: boolean responses: '200': description: Successful response @@ -1047,6 +1082,18 @@ components: detail: type: string default: auto + FileContent: + type: object + required: + - file_data + additionalProperties: false + properties: + file_data: + type: string + description: Base64 encoded file content or file URL + filename: + type: string + description: Name of the file UserChatMessageContentItem: type: object additionalProperties: false @@ -1056,10 +1103,13 @@ components: enum: - text - image_url + - file text: type: string image_url: $ref: '#/components/schemas/ImageContentUrl' + file: + $ref: '#/components/schemas/FileContent' required: - type UserChatMessageContent: @@ -1625,6 +1675,12 @@ components: type: boolean default: false description: controls whether the input to the grounding module will be masked with the configuration supplied in the masking module + mask_file_input_method: + description: Type of masking method to be used for file inputs. Required if file inputs are provided. + type: string + enum: + - anonymization + - skip MaskingProviderConfig: oneOf: - $ref: '#/components/schemas/DPIConfig' From 87086db90458e5468334b845d3b3e4d46c86fe89 Mon Sep 17 00:00:00 2001 From: SAP Cloud SDK Bot Date: Sun, 5 Apr 2026 02:39:30 +0000 Subject: [PATCH 14/15] Update prompt-registry based on main --- .../sdk/prompt/registry/client/PromptTemplatesApi.java | 9 ++------- .../src/main/resources/spec/prompt-registry.yaml | 5 ----- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/client/PromptTemplatesApi.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/client/PromptTemplatesApi.java index 28da867f3..93d4aca31 100644 --- a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/client/PromptTemplatesApi.java +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/client/PromptTemplatesApi.java @@ -518,7 +518,6 @@ public PromptTemplatePostResponse importPromptTemplate() throws OpenApiRequestEx * @param name (required) The value for the parameter name * @param aiResourceGroup (optional) Specify a resource group id to use * @param aiResourceGroupScope (optional) Specify whether the resource group scope is to be used - * @param includeSpec (optional, default to false) The value for the parameter includeSpec * @return PromptTemplateListResponse * @throws OpenApiRequestException if an error occurs while attempting to invoke the API */ @@ -528,8 +527,7 @@ public PromptTemplateListResponse listPromptTemplateHistory( @Nonnull final String version, @Nonnull final String name, @Nullable final String aiResourceGroup, - @Nullable final String aiResourceGroupScope, - @Nullable final Boolean includeSpec) + @Nullable final String aiResourceGroupScope) throws OpenApiRequestException { final Object localVarPostBody = null; @@ -568,9 +566,6 @@ public PromptTemplateListResponse listPromptTemplateHistory( final MultiValueMap localVarFormParams = new LinkedMultiValueMap(); - localVarQueryParams.putAll( - apiClient.parameterToMultiValueMap(null, "includeSpec", includeSpec)); - if (aiResourceGroup != null) localVarHeaderParams.add("AI-Resource-Group", apiClient.parameterToString(aiResourceGroup)); if (aiResourceGroupScope != null) @@ -620,7 +615,7 @@ public PromptTemplateListResponse listPromptTemplateHistory( public PromptTemplateListResponse listPromptTemplateHistory( @Nonnull final String scenario, @Nonnull final String version, @Nonnull final String name) throws OpenApiRequestException { - return listPromptTemplateHistory(scenario, version, name, null, null, null); + return listPromptTemplateHistory(scenario, version, name, null, null); } /** diff --git a/core-services/prompt-registry/src/main/resources/spec/prompt-registry.yaml b/core-services/prompt-registry/src/main/resources/spec/prompt-registry.yaml index f12f94189..21a221bbd 100644 --- a/core-services/prompt-registry/src/main/resources/spec/prompt-registry.yaml +++ b/core-services/prompt-registry/src/main/resources/spec/prompt-registry.yaml @@ -107,11 +107,6 @@ paths: required: true schema: type: string - - name: includeSpec - in: query - schema: - type: boolean - default: false responses: '200': description: Successful response From a3de68acaf5a786d6845ca6f077c75d1a6c67b61 Mon Sep 17 00:00:00 2001 From: SAP Cloud SDK Bot Date: Sun, 14 Jun 2026 04:14:09 +0000 Subject: [PATCH 15/15] Update prompt-registry based on main --- .../prompt/registry/model/CacheControl.java | 345 ++++++++++++++++++ .../registry/model/ChatMessageContent.java | 16 +- .../registry/model/LLMModelDetails.java | 6 +- .../MaskingModuleConfigMaskingProviders.java | 14 +- .../model/PromptTemplatingModuleConfig.java | 17 +- .../PromptTemplatingModuleConfigPrompt.java | 3 +- .../model/SchemasChatCompletionTool.java | 328 +++++++++++++++++ .../registry/model/SchemasTextContent.java | 325 +++++++++++++++++ .../sdk/prompt/registry/model/Template.java | 10 +- .../model/UserChatMessageContentItem.java | 42 ++- .../main/resources/spec/prompt-registry.yaml | 63 +++- 11 files changed, 1124 insertions(+), 45 deletions(-) create mode 100644 core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/CacheControl.java create mode 100644 core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/SchemasChatCompletionTool.java create mode 100644 core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/SchemasTextContent.java diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/CacheControl.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/CacheControl.java new file mode 100644 index 000000000..bba3c551d --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/CacheControl.java @@ -0,0 +1,345 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** + * Cache control directive for Anthropic prompt caching. Only applicable to Anthropic Claude models. + * When set, marks the content block as a cache breakpoint. + */ +// CHECKSTYLE:OFF +public class CacheControl +// CHECKSTYLE:ON +{ + /** Gets or Sets type */ + public enum TypeEnum { + /** The EPHEMERAL option of this CacheControl */ + EPHEMERAL("ephemeral"), + + /** The UNKNOWN_DEFAULT_OPEN_API option of this CacheControl */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public String getValue() { + return value; + } + + /** + * Get the String value of the enum value. + * + * @return The enum value as String + */ + @Override + @Nonnull + public String toString() { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * + * @param value The String value + * @return The enum value of type CacheControl + */ + @JsonCreator + @Nonnull + public static TypeEnum fromValue(@Nonnull final String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty("type") + private TypeEnum type; + + /** + * Time-to-live for the cache entry. Default is \"5m\" (5 minutes). \"1h\" (1 + * hour) is supported on select models (e.g. Claude Opus 4.5, Haiku 4.5, Sonnet 4.5). + */ + public enum TtlEnum { + /** The _5M option of this CacheControl */ + _5M("5m"), + + /** The _1H option of this CacheControl */ + _1H("1h"), + + /** The UNKNOWN_DEFAULT_OPEN_API option of this CacheControl */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + TtlEnum(String value) { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public String getValue() { + return value; + } + + /** + * Get the String value of the enum value. + * + * @return The enum value as String + */ + @Override + @Nonnull + public String toString() { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * + * @param value The String value + * @return The enum value of type CacheControl + */ + @JsonCreator + @Nonnull + public static TtlEnum fromValue(@Nonnull final String value) { + for (TtlEnum b : TtlEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty("ttl") + private TtlEnum ttl; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for CacheControl. */ + protected CacheControl() {} + + /** + * Set the type of this {@link CacheControl} instance and return the same instance. + * + * @param type The type of this {@link CacheControl} + * @return The same instance of this {@link CacheControl} class + */ + @Nonnull + public CacheControl type(@Nonnull final TypeEnum type) { + this.type = type; + return this; + } + + /** + * Get type + * + * @return type The type of this {@link CacheControl} instance. + */ + @Nonnull + public TypeEnum getType() { + return type; + } + + /** + * Set the type of this {@link CacheControl} instance. + * + * @param type The type of this {@link CacheControl} + */ + public void setType(@Nonnull final TypeEnum type) { + this.type = type; + } + + /** + * Set the ttl of this {@link CacheControl} instance and return the same instance. + * + * @param ttl Time-to-live for the cache entry. Default is \"5m\" (5 minutes). + * \"1h\" (1 hour) is supported on select models (e.g. Claude Opus 4.5, Haiku 4.5, + * Sonnet 4.5). + * @return The same instance of this {@link CacheControl} class + */ + @Nonnull + public CacheControl ttl(@Nullable final TtlEnum ttl) { + this.ttl = ttl; + return this; + } + + /** + * Time-to-live for the cache entry. Default is \"5m\" (5 minutes). \"1h\" (1 + * hour) is supported on select models (e.g. Claude Opus 4.5, Haiku 4.5, Sonnet 4.5). + * + * @return ttl The ttl of this {@link CacheControl} instance. + */ + @Nonnull + public TtlEnum getTtl() { + return ttl; + } + + /** + * Set the ttl of this {@link CacheControl} instance. + * + * @param ttl Time-to-live for the cache entry. Default is \"5m\" (5 minutes). + * \"1h\" (1 hour) is supported on select models (e.g. Claude Opus 4.5, Haiku 4.5, + * Sonnet 4.5). + */ + public void setTtl(@Nullable final TtlEnum ttl) { + this.ttl = ttl; + } + + /** + * Get the names of the unrecognizable properties of the {@link CacheControl}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link CacheControl} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException("CacheControl has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link CacheControl} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (type != null) declaredFields.put("type", type); + if (ttl != null) declaredFields.put("ttl", ttl); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link CacheControl} instance. If the map previously + * contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final CacheControl cacheControl = (CacheControl) o; + return Objects.equals(this.cloudSdkCustomFields, cacheControl.cloudSdkCustomFields) + && Objects.equals(this.type, cacheControl.type) + && Objects.equals(this.ttl, cacheControl.ttl); + } + + @Override + public int hashCode() { + return Objects.hash(type, ttl, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class CacheControl {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" ttl: ").append(toIndentedString(ttl)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create a type-safe, fluent-api builder object to construct a new {@link CacheControl} instance + * with all required arguments. + */ + public static Builder create() { + return (type) -> new CacheControl().type(type); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the type of this {@link CacheControl} instance. + * + * @param type The type of this {@link CacheControl} + * @return The CacheControl instance. + */ + CacheControl type(@Nonnull final TypeEnum type); + } +} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/ChatMessageContent.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/ChatMessageContent.java index a83951aa3..a447eccf0 100644 --- a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/ChatMessageContent.java +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/ChatMessageContent.java @@ -17,22 +17,24 @@ /** ChatMessageContent */ public interface ChatMessageContent { /** - * Helper class to create {@code List } that implements {@link ChatMessageContent}. + * Helper class to create {@code List } that implements {@link + * ChatMessageContent}. */ - record ListOfTextContents( - @com.fasterxml.jackson.annotation.JsonValue @Nonnull List values) + record ListOfSchemasTextContents( + @com.fasterxml.jackson.annotation.JsonValue @Nonnull List values) implements ChatMessageContent {} /** - * Creator to enable deserialization of {@code List }. + * Creator to enable deserialization of {@code List }. * * @param val the value to use - * @return a new instance of {@link ListOfTextContents}. + * @return a new instance of {@link ListOfSchemasTextContents}. */ @com.fasterxml.jackson.annotation.JsonCreator @Nonnull - static ListOfTextContents createListOfTextContents(@Nonnull final List val) { - return new ListOfTextContents(val); + static ListOfSchemasTextContents createListOfSchemasTextContents( + @Nonnull final List val) { + return new ListOfSchemasTextContents(val); } /** Helper class to create {@code String } that implements {@link ChatMessageContent}. */ diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/LLMModelDetails.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/LLMModelDetails.java index 4b0cd3f18..507b8d16a 100644 --- a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/LLMModelDetails.java +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/LLMModelDetails.java @@ -169,7 +169,7 @@ public void setParams(@Nullable final Map params) { * Set the timeout of this {@link LLMModelDetails} instance and return the same instance. * * @param timeout Timeout for the LLM request in seconds. This parameter is currently ignored for - * Vertex AI models. Minimum: 1 Maximum: 600 + * Vertex AI models. Minimum: 1 Maximum: 1200 * @return The same instance of this {@link LLMModelDetails} class */ @Nonnull @@ -180,7 +180,7 @@ public LLMModelDetails timeout(@Nullable final Integer timeout) { /** * Timeout for the LLM request in seconds. This parameter is currently ignored for Vertex AI - * models. minimum: 1 maximum: 600 + * models. minimum: 1 maximum: 1200 * * @return timeout The timeout of this {@link LLMModelDetails} instance. */ @@ -193,7 +193,7 @@ public Integer getTimeout() { * Set the timeout of this {@link LLMModelDetails} instance. * * @param timeout Timeout for the LLM request in seconds. This parameter is currently ignored for - * Vertex AI models. Minimum: 1 Maximum: 600 + * Vertex AI models. Minimum: 1 Maximum: 1200 */ public void setTimeout(@Nullable final Integer timeout) { this.timeout = timeout; diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/MaskingModuleConfigMaskingProviders.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/MaskingModuleConfigMaskingProviders.java index 7e16a58ac..203140281 100644 --- a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/MaskingModuleConfigMaskingProviders.java +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/MaskingModuleConfigMaskingProviders.java @@ -44,8 +44,8 @@ protected MaskingModuleConfigMaskingProviders() {} * Set the maskingProviders of this {@link MaskingModuleConfigMaskingProviders} instance and * return the same instance. * - * @param maskingProviders List of masking service providers. **DEPRECATED**: will be removed Sept - * 15, 2026. Use `providers` property instead. + * @param maskingProviders List of masking service providers. **DEPRECATED**: will be removed + * March 20, 2027. Use `providers` property instead. * @return The same instance of this {@link MaskingModuleConfigMaskingProviders} class */ @Nonnull @@ -72,7 +72,7 @@ public MaskingModuleConfigMaskingProviders addMaskingProvidersItem( } /** - * List of masking service providers. **DEPRECATED**: will be removed Sept 15, 2026. Use + * List of masking service providers. **DEPRECATED**: will be removed March 20, 2027. Use * `providers` property instead. * * @return maskingProviders The maskingProviders of this {@link @@ -88,8 +88,8 @@ public List getMaskingProviders() { /** * Set the maskingProviders of this {@link MaskingModuleConfigMaskingProviders} instance. * - * @param maskingProviders List of masking service providers. **DEPRECATED**: will be removed Sept - * 15, 2026. Use `providers` property instead. + * @param maskingProviders List of masking service providers. **DEPRECATED**: will be removed + * March 20, 2027. Use `providers` property instead. */ public void setMaskingProviders(@Nonnull final List maskingProviders) { this.maskingProviders = maskingProviders; @@ -212,7 +212,7 @@ public interface Builder { * Set the maskingProviders of this {@link MaskingModuleConfigMaskingProviders} instance. * * @param maskingProviders List of masking service providers. **DEPRECATED**: will be removed - * Sept 15, 2026. Use `providers` property instead. + * March 20, 2027. Use `providers` property instead. * @return The MaskingModuleConfigMaskingProviders instance. */ MaskingModuleConfigMaskingProviders maskingProviders( @@ -222,7 +222,7 @@ MaskingModuleConfigMaskingProviders maskingProviders( * Set the maskingProviders of this {@link MaskingModuleConfigMaskingProviders} instance. * * @param maskingProviders List of masking service providers. **DEPRECATED**: will be removed - * Sept 15, 2026. Use `providers` property instead. + * March 20, 2027. Use `providers` property instead. * @return The MaskingModuleConfigMaskingProviders instance. */ default MaskingModuleConfigMaskingProviders maskingProviders( diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/PromptTemplatingModuleConfig.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/PromptTemplatingModuleConfig.java index b68654454..38139cbfe 100644 --- a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/PromptTemplatingModuleConfig.java +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/PromptTemplatingModuleConfig.java @@ -49,7 +49,7 @@ protected PromptTemplatingModuleConfig() {} */ @Nonnull public PromptTemplatingModuleConfig prompt( - @Nonnull final PromptTemplatingModuleConfigPrompt prompt) { + @Nullable final PromptTemplatingModuleConfigPrompt prompt) { this.prompt = prompt; return this; } @@ -69,7 +69,7 @@ public PromptTemplatingModuleConfigPrompt getPrompt() { * * @param prompt The prompt of this {@link PromptTemplatingModuleConfig} */ - public void setPrompt(@Nonnull final PromptTemplatingModuleConfigPrompt prompt) { + public void setPrompt(@Nullable final PromptTemplatingModuleConfigPrompt prompt) { this.prompt = prompt; } @@ -213,22 +213,11 @@ private String toIndentedString(final java.lang.Object o) { * PromptTemplatingModuleConfig} instance with all required arguments. */ public static Builder create() { - return (prompt) -> (model) -> new PromptTemplatingModuleConfig().prompt(prompt).model(model); + return (model) -> new PromptTemplatingModuleConfig().model(model); } /** Builder helper class. */ public interface Builder { - /** - * Set the prompt of this {@link PromptTemplatingModuleConfig} instance. - * - * @param prompt The prompt of this {@link PromptTemplatingModuleConfig} - * @return The PromptTemplatingModuleConfig builder. - */ - Builder1 prompt(@Nonnull final PromptTemplatingModuleConfigPrompt prompt); - } - - /** Builder helper class. */ - public interface Builder1 { /** * Set the model of this {@link PromptTemplatingModuleConfig} instance. * diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/PromptTemplatingModuleConfigPrompt.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/PromptTemplatingModuleConfigPrompt.java index d34042e67..d4286e011 100644 --- a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/PromptTemplatingModuleConfigPrompt.java +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/PromptTemplatingModuleConfigPrompt.java @@ -16,7 +16,8 @@ /** * The prompt template to be used. Can be either a user defined template or a reference to a - * template in the prompt registry. + * template in the prompt registry. If omitted, messages_history must be provided in the request + * body. */ @JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION) @JsonSubTypes({ diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/SchemasChatCompletionTool.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/SchemasChatCompletionTool.java new file mode 100644 index 000000000..55272f705 --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/SchemasChatCompletionTool.java @@ -0,0 +1,328 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** SchemasChatCompletionTool */ +// CHECKSTYLE:OFF +public class SchemasChatCompletionTool +// CHECKSTYLE:ON +{ + /** The type of the tool. Currently, only `function` is supported. */ + public enum TypeEnum { + /** The FUNCTION option of this SchemasChatCompletionTool */ + FUNCTION("function"), + + /** The UNKNOWN_DEFAULT_OPEN_API option of this SchemasChatCompletionTool */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public String getValue() { + return value; + } + + /** + * Get the String value of the enum value. + * + * @return The enum value as String + */ + @Override + @Nonnull + public String toString() { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * + * @param value The String value + * @return The enum value of type SchemasChatCompletionTool + */ + @JsonCreator + @Nonnull + public static TypeEnum fromValue(@Nonnull final String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty("type") + private TypeEnum type; + + @JsonProperty("function") + private FunctionObject function; + + @JsonProperty("cache_control") + private CacheControl cacheControl; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for SchemasChatCompletionTool. */ + protected SchemasChatCompletionTool() {} + + /** + * Set the type of this {@link SchemasChatCompletionTool} instance and return the same instance. + * + * @param type The type of the tool. Currently, only `function` is supported. + * @return The same instance of this {@link SchemasChatCompletionTool} class + */ + @Nonnull + public SchemasChatCompletionTool type(@Nonnull final TypeEnum type) { + this.type = type; + return this; + } + + /** + * The type of the tool. Currently, only `function` is supported. + * + * @return type The type of this {@link SchemasChatCompletionTool} instance. + */ + @Nonnull + public TypeEnum getType() { + return type; + } + + /** + * Set the type of this {@link SchemasChatCompletionTool} instance. + * + * @param type The type of the tool. Currently, only `function` is supported. + */ + public void setType(@Nonnull final TypeEnum type) { + this.type = type; + } + + /** + * Set the function of this {@link SchemasChatCompletionTool} instance and return the same + * instance. + * + * @param function The function of this {@link SchemasChatCompletionTool} + * @return The same instance of this {@link SchemasChatCompletionTool} class + */ + @Nonnull + public SchemasChatCompletionTool function(@Nonnull final FunctionObject function) { + this.function = function; + return this; + } + + /** + * Get function + * + * @return function The function of this {@link SchemasChatCompletionTool} instance. + */ + @Nonnull + public FunctionObject getFunction() { + return function; + } + + /** + * Set the function of this {@link SchemasChatCompletionTool} instance. + * + * @param function The function of this {@link SchemasChatCompletionTool} + */ + public void setFunction(@Nonnull final FunctionObject function) { + this.function = function; + } + + /** + * Set the cacheControl of this {@link SchemasChatCompletionTool} instance and return the same + * instance. + * + * @param cacheControl The cacheControl of this {@link SchemasChatCompletionTool} + * @return The same instance of this {@link SchemasChatCompletionTool} class + */ + @Nonnull + public SchemasChatCompletionTool cacheControl(@Nullable final CacheControl cacheControl) { + this.cacheControl = cacheControl; + return this; + } + + /** + * Get cacheControl + * + * @return cacheControl The cacheControl of this {@link SchemasChatCompletionTool} instance. + */ + @Nonnull + public CacheControl getCacheControl() { + return cacheControl; + } + + /** + * Set the cacheControl of this {@link SchemasChatCompletionTool} instance. + * + * @param cacheControl The cacheControl of this {@link SchemasChatCompletionTool} + */ + public void setCacheControl(@Nullable final CacheControl cacheControl) { + this.cacheControl = cacheControl; + } + + /** + * Get the names of the unrecognizable properties of the {@link SchemasChatCompletionTool}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link SchemasChatCompletionTool} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException( + "SchemasChatCompletionTool has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link SchemasChatCompletionTool} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (type != null) declaredFields.put("type", type); + if (function != null) declaredFields.put("function", function); + if (cacheControl != null) declaredFields.put("cacheControl", cacheControl); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link SchemasChatCompletionTool} instance. If the map + * previously contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final SchemasChatCompletionTool schemasChatCompletionTool = (SchemasChatCompletionTool) o; + return Objects.equals(this.cloudSdkCustomFields, schemasChatCompletionTool.cloudSdkCustomFields) + && Objects.equals(this.type, schemasChatCompletionTool.type) + && Objects.equals(this.function, schemasChatCompletionTool.function) + && Objects.equals(this.cacheControl, schemasChatCompletionTool.cacheControl); + } + + @Override + public int hashCode() { + return Objects.hash(type, function, cacheControl, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class SchemasChatCompletionTool {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" function: ").append(toIndentedString(function)).append("\n"); + sb.append(" cacheControl: ").append(toIndentedString(cacheControl)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create a type-safe, fluent-api builder object to construct a new {@link + * SchemasChatCompletionTool} instance with all required arguments. + */ + public static Builder create() { + return (type) -> (function) -> new SchemasChatCompletionTool().type(type).function(function); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the type of this {@link SchemasChatCompletionTool} instance. + * + * @param type The type of the tool. Currently, only `function` is supported. + * @return The SchemasChatCompletionTool builder. + */ + Builder1 type(@Nonnull final TypeEnum type); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the function of this {@link SchemasChatCompletionTool} instance. + * + * @param function The function of this {@link SchemasChatCompletionTool} + * @return The SchemasChatCompletionTool instance. + */ + SchemasChatCompletionTool function(@Nonnull final FunctionObject function); + } +} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/SchemasTextContent.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/SchemasTextContent.java new file mode 100644 index 000000000..38eafc542 --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/SchemasTextContent.java @@ -0,0 +1,325 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** SchemasTextContent */ +// CHECKSTYLE:OFF +public class SchemasTextContent +// CHECKSTYLE:ON +{ + /** Gets or Sets type */ + public enum TypeEnum { + /** The TEXT option of this SchemasTextContent */ + TEXT("text"), + + /** The UNKNOWN_DEFAULT_OPEN_API option of this SchemasTextContent */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public String getValue() { + return value; + } + + /** + * Get the String value of the enum value. + * + * @return The enum value as String + */ + @Override + @Nonnull + public String toString() { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * + * @param value The String value + * @return The enum value of type SchemasTextContent + */ + @JsonCreator + @Nonnull + public static TypeEnum fromValue(@Nonnull final String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty("type") + private TypeEnum type; + + @JsonProperty("text") + private String text; + + @JsonProperty("cache_control") + private CacheControl cacheControl; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for SchemasTextContent. */ + protected SchemasTextContent() {} + + /** + * Set the type of this {@link SchemasTextContent} instance and return the same instance. + * + * @param type The type of this {@link SchemasTextContent} + * @return The same instance of this {@link SchemasTextContent} class + */ + @Nonnull + public SchemasTextContent type(@Nonnull final TypeEnum type) { + this.type = type; + return this; + } + + /** + * Get type + * + * @return type The type of this {@link SchemasTextContent} instance. + */ + @Nonnull + public TypeEnum getType() { + return type; + } + + /** + * Set the type of this {@link SchemasTextContent} instance. + * + * @param type The type of this {@link SchemasTextContent} + */ + public void setType(@Nonnull final TypeEnum type) { + this.type = type; + } + + /** + * Set the text of this {@link SchemasTextContent} instance and return the same instance. + * + * @param text The text of this {@link SchemasTextContent} + * @return The same instance of this {@link SchemasTextContent} class + */ + @Nonnull + public SchemasTextContent text(@Nonnull final String text) { + this.text = text; + return this; + } + + /** + * Get text + * + * @return text The text of this {@link SchemasTextContent} instance. + */ + @Nonnull + public String getText() { + return text; + } + + /** + * Set the text of this {@link SchemasTextContent} instance. + * + * @param text The text of this {@link SchemasTextContent} + */ + public void setText(@Nonnull final String text) { + this.text = text; + } + + /** + * Set the cacheControl of this {@link SchemasTextContent} instance and return the same instance. + * + * @param cacheControl The cacheControl of this {@link SchemasTextContent} + * @return The same instance of this {@link SchemasTextContent} class + */ + @Nonnull + public SchemasTextContent cacheControl(@Nullable final CacheControl cacheControl) { + this.cacheControl = cacheControl; + return this; + } + + /** + * Get cacheControl + * + * @return cacheControl The cacheControl of this {@link SchemasTextContent} instance. + */ + @Nonnull + public CacheControl getCacheControl() { + return cacheControl; + } + + /** + * Set the cacheControl of this {@link SchemasTextContent} instance. + * + * @param cacheControl The cacheControl of this {@link SchemasTextContent} + */ + public void setCacheControl(@Nullable final CacheControl cacheControl) { + this.cacheControl = cacheControl; + } + + /** + * Get the names of the unrecognizable properties of the {@link SchemasTextContent}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link SchemasTextContent} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException("SchemasTextContent has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link SchemasTextContent} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (type != null) declaredFields.put("type", type); + if (text != null) declaredFields.put("text", text); + if (cacheControl != null) declaredFields.put("cacheControl", cacheControl); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link SchemasTextContent} instance. If the map + * previously contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final SchemasTextContent schemasTextContent = (SchemasTextContent) o; + return Objects.equals(this.cloudSdkCustomFields, schemasTextContent.cloudSdkCustomFields) + && Objects.equals(this.type, schemasTextContent.type) + && Objects.equals(this.text, schemasTextContent.text) + && Objects.equals(this.cacheControl, schemasTextContent.cacheControl); + } + + @Override + public int hashCode() { + return Objects.hash(type, text, cacheControl, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class SchemasTextContent {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append(" cacheControl: ").append(toIndentedString(cacheControl)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create a type-safe, fluent-api builder object to construct a new {@link SchemasTextContent} + * instance with all required arguments. + */ + public static Builder create() { + return (type) -> (text) -> new SchemasTextContent().type(type).text(text); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the type of this {@link SchemasTextContent} instance. + * + * @param type The type of this {@link SchemasTextContent} + * @return The SchemasTextContent builder. + */ + Builder1 type(@Nonnull final TypeEnum type); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the text of this {@link SchemasTextContent} instance. + * + * @param text The text of this {@link SchemasTextContent} + * @return The SchemasTextContent instance. + */ + SchemasTextContent text(@Nonnull final String text); + } +} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/Template.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/Template.java index f3bdc1e01..67dc42610 100644 --- a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/Template.java +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/Template.java @@ -42,7 +42,7 @@ public class Template implements PromptTemplatingModuleConfigPrompt private TemplateResponseFormat responseFormat; @JsonProperty("tools") - private List tools = new ArrayList<>(); + private List tools = new ArrayList<>(); @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); @@ -189,7 +189,7 @@ public void setResponseFormat(@Nullable final TemplateResponseFormat responseFor * @return The same instance of this {@link Template} class */ @Nonnull - public Template tools(@Nullable final List tools) { + public Template tools(@Nullable final List tools) { this.tools = tools; return this; } @@ -201,7 +201,7 @@ public Template tools(@Nullable final List tools) { * @return The same instance of type {@link Template} */ @Nonnull - public Template addToolsItem(@Nonnull final ChatCompletionTool toolsItem) { + public Template addToolsItem(@Nonnull final SchemasChatCompletionTool toolsItem) { if (this.tools == null) { this.tools = new ArrayList<>(); } @@ -216,7 +216,7 @@ public Template addToolsItem(@Nonnull final ChatCompletionTool toolsItem) { * @return tools The tools of this {@link Template} instance. */ @Nonnull - public List getTools() { + public List getTools() { return tools; } @@ -226,7 +226,7 @@ public List getTools() { * @param tools A list of tools the model may call. Used to provide a list of functions the model * may generate JSON inputs for. This is the same as the OpenAI definition. */ - public void setTools(@Nullable final List tools) { + public void setTools(@Nullable final List tools) { this.tools = tools; } diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/UserChatMessageContentItem.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/UserChatMessageContentItem.java index b82526c28..3d6af62f7 100644 --- a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/UserChatMessageContentItem.java +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/UserChatMessageContentItem.java @@ -102,6 +102,9 @@ public static TypeEnum fromValue(@Nonnull final String value) { @JsonProperty("file") private FileContent _file; + @JsonProperty("cache_control") + private CacheControl cacheControl; + @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); @@ -233,6 +236,38 @@ public void setFile(@Nullable final FileContent _file) { this._file = _file; } + /** + * Set the cacheControl of this {@link UserChatMessageContentItem} instance and return the same + * instance. + * + * @param cacheControl The cacheControl of this {@link UserChatMessageContentItem} + * @return The same instance of this {@link UserChatMessageContentItem} class + */ + @Nonnull + public UserChatMessageContentItem cacheControl(@Nullable final CacheControl cacheControl) { + this.cacheControl = cacheControl; + return this; + } + + /** + * Get cacheControl + * + * @return cacheControl The cacheControl of this {@link UserChatMessageContentItem} instance. + */ + @Nonnull + public CacheControl getCacheControl() { + return cacheControl; + } + + /** + * Set the cacheControl of this {@link UserChatMessageContentItem} instance. + * + * @param cacheControl The cacheControl of this {@link UserChatMessageContentItem} + */ + public void setCacheControl(@Nullable final CacheControl cacheControl) { + this.cacheControl = cacheControl; + } + /** * Get the names of the unrecognizable properties of the {@link UserChatMessageContentItem}. * @@ -277,6 +312,7 @@ public Map toMap() { if (text != null) declaredFields.put("text", text); if (imageUrl != null) declaredFields.put("imageUrl", imageUrl); if (_file != null) declaredFields.put("_file", _file); + if (cacheControl != null) declaredFields.put("cacheControl", cacheControl); return declaredFields; } @@ -306,12 +342,13 @@ public boolean equals(@Nullable final java.lang.Object o) { && Objects.equals(this.type, userChatMessageContentItem.type) && Objects.equals(this.text, userChatMessageContentItem.text) && Objects.equals(this.imageUrl, userChatMessageContentItem.imageUrl) - && Objects.equals(this._file, userChatMessageContentItem._file); + && Objects.equals(this._file, userChatMessageContentItem._file) + && Objects.equals(this.cacheControl, userChatMessageContentItem.cacheControl); } @Override public int hashCode() { - return Objects.hash(type, text, imageUrl, _file, cloudSdkCustomFields); + return Objects.hash(type, text, imageUrl, _file, cacheControl, cloudSdkCustomFields); } @Override @@ -323,6 +360,7 @@ public String toString() { sb.append(" text: ").append(toIndentedString(text)).append("\n"); sb.append(" imageUrl: ").append(toIndentedString(imageUrl)).append("\n"); sb.append(" _file: ").append(toIndentedString(_file)).append("\n"); + sb.append(" cacheControl: ").append(toIndentedString(cacheControl)).append("\n"); cloudSdkCustomFields.forEach( (k, v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); diff --git a/core-services/prompt-registry/src/main/resources/spec/prompt-registry.yaml b/core-services/prompt-registry/src/main/resources/spec/prompt-registry.yaml index 21a221bbd..ed147d504 100644 --- a/core-services/prompt-registry/src/main/resources/spec/prompt-registry.yaml +++ b/core-services/prompt-registry/src/main/resources/spec/prompt-registry.yaml @@ -1046,12 +1046,46 @@ components: type: string spec: $ref: '#/components/schemas/OrchestrationConfig' + CacheControl: + type: object + description: | + Cache control directive for Anthropic prompt caching. Only applicable to Anthropic Claude models. When set, marks the content block as a cache breakpoint. + additionalProperties: false + required: + - type + properties: + type: + type: string + enum: + - ephemeral + ttl: + type: string + description: | + Time-to-live for the cache entry. Default is "5m" (5 minutes). "1h" (1 hour) is supported on select models (e.g. Claude Opus 4.5, Haiku 4.5, Sonnet 4.5). + enum: + - 5m + - 1h + schemas-TextContent: + type: object + required: + - type + - text + additionalProperties: false + properties: + type: + type: string + enum: + - text + text: + type: string + cache_control: + $ref: '#/components/schemas/CacheControl' ChatMessageContent: oneOf: - type: string - type: array items: - $ref: '#/components/schemas/TextContent' + $ref: '#/components/schemas/schemas-TextContent' minItems: 1 SystemChatMessage: type: object @@ -1105,6 +1139,8 @@ components: $ref: '#/components/schemas/ImageContentUrl' file: $ref: '#/components/schemas/FileContent' + cache_control: + $ref: '#/components/schemas/CacheControl' required: - type UserChatMessageContent: @@ -1218,6 +1254,22 @@ components: minItems: 1 items: $ref: '#/components/schemas/ChatMessage' + schemas-ChatCompletionTool: + type: object + additionalProperties: false + properties: + type: + type: string + enum: + - function + description: The type of the tool. Currently, only `function` is supported. + function: + $ref: '#/components/schemas/FunctionObject' + cache_control: + $ref: '#/components/schemas/CacheControl' + required: + - type + - function Template: type: object required: @@ -1245,7 +1297,7 @@ components: description: | A list of tools the model may call. Used to provide a list of functions the model may generate JSON inputs for. This is the same as the OpenAI definition. items: - $ref: '#/components/schemas/ChatCompletionTool' + $ref: '#/components/schemas/schemas-ChatCompletionTool' example: template: - role: user @@ -1342,7 +1394,7 @@ components: type: integer default: 600 minimum: 1 - maximum: 600 + maximum: 1200 max_retries: description: Maximum number of retries for the LLM request. This parameter is currently ignored for Vertex AI models. type: integer @@ -1352,13 +1404,12 @@ components: PromptTemplatingModuleConfig: type: object required: - - prompt - model additionalProperties: false properties: prompt: description: | - The prompt template to be used. Can be either a user defined template or a reference to a template in the prompt registry. + The prompt template to be used. Can be either a user defined template or a reference to a template in the prompt registry. If omitted, messages_history must be provided in the request body. oneOf: - $ref: '#/components/schemas/Template' - $ref: '#/components/schemas/TemplateRef' @@ -1698,7 +1749,7 @@ components: properties: masking_providers: deprecated: true - description: 'List of masking service providers. **DEPRECATED**: will be removed Sept 15, 2026. Use `providers` property instead.' + description: 'List of masking service providers. **DEPRECATED**: will be removed March 20, 2027. Use `providers` property instead.' type: array minItems: 1 items: