diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/AssistantChatMessage.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/AssistantChatMessage.java index 071584883..cc7047da1 100644 --- a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/AssistantChatMessage.java +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/AssistantChatMessage.java @@ -98,6 +98,9 @@ public static RoleEnum fromValue(@Nonnull final String value) { @JsonProperty("tool_calls") private List toolCalls = new ArrayList<>(); + @JsonProperty("reasoning_content") + private List reasoningContent = new ArrayList<>(); + @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); @@ -243,6 +246,55 @@ public void setToolCalls(@Nullable final List toolCalls) { this.toolCalls = toolCalls; } + /** + * Set the reasoningContent of this {@link AssistantChatMessage} instance and return the same + * instance. + * + * @param reasoningContent Reasoning or thinking content from the model's previous turn. + * @return The same instance of this {@link AssistantChatMessage} class + */ + @Nonnull + public AssistantChatMessage reasoningContent( + @Nullable final List reasoningContent) { + this.reasoningContent = reasoningContent; + return this; + } + + /** + * Add one reasoningContent instance to this {@link AssistantChatMessage}. + * + * @param reasoningContentItem The reasoningContent that should be added + * @return The same instance of type {@link AssistantChatMessage} + */ + @Nonnull + public AssistantChatMessage addReasoningContentItem( + @Nonnull final ReasoningBlock reasoningContentItem) { + if (this.reasoningContent == null) { + this.reasoningContent = new ArrayList<>(); + } + this.reasoningContent.add(reasoningContentItem); + return this; + } + + /** + * Reasoning or thinking content from the model's previous turn. + * + * @return reasoningContent The reasoningContent of this {@link AssistantChatMessage} instance. + */ + @Nonnull + public List getReasoningContent() { + return reasoningContent; + } + + /** + * Set the reasoningContent of this {@link AssistantChatMessage} instance. + * + * @param reasoningContent Reasoning or thinking content from the model's previous turn. + */ + public void setReasoningContent(@Nullable final List reasoningContent) { + this.reasoningContent = reasoningContent; + } + /** * Get the names of the unrecognizable properties of the {@link AssistantChatMessage}. * @@ -286,6 +338,7 @@ public Map toMap() { if (content != null) declaredFields.put("content", content); if (refusal != null) declaredFields.put("refusal", refusal); if (toolCalls != null) declaredFields.put("toolCalls", toolCalls); + if (reasoningContent != null) declaredFields.put("reasoningContent", reasoningContent); return declaredFields; } @@ -314,12 +367,13 @@ public boolean equals(@Nullable final java.lang.Object o) { && Objects.equals(this.role, assistantChatMessage.role) && Objects.equals(this.content, assistantChatMessage.content) && Objects.equals(this.refusal, assistantChatMessage.refusal) - && Objects.equals(this.toolCalls, assistantChatMessage.toolCalls); + && Objects.equals(this.toolCalls, assistantChatMessage.toolCalls) + && Objects.equals(this.reasoningContent, assistantChatMessage.reasoningContent); } @Override public int hashCode() { - return Objects.hash(role, content, refusal, toolCalls, cloudSdkCustomFields); + return Objects.hash(role, content, refusal, toolCalls, reasoningContent, cloudSdkCustomFields); } @Override @@ -331,6 +385,7 @@ public String toString() { sb.append(" content: ").append(toIndentedString(content)).append("\n"); sb.append(" refusal: ").append(toIndentedString(refusal)).append("\n"); sb.append(" toolCalls: ").append(toIndentedString(toolCalls)).append("\n"); + sb.append(" reasoningContent: ").append(toIndentedString(reasoningContent)).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/OrchestrationConfigGetResponse.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/OrchestrationConfigGetResponse.java index 3c46129fd..d1bee5566 100644 --- a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/OrchestrationConfigGetResponse.java +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/OrchestrationConfigGetResponse.java @@ -54,7 +54,7 @@ public class OrchestrationConfigGetResponse private String resourceGroupId; @JsonProperty("spec") - private OrchestrationConfig spec; + private PromptRegistryOrchestrationConfig spec; @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); @@ -330,7 +330,8 @@ public void setResourceGroupId(@Nullable final String resourceGroupId) { * @return The same instance of this {@link OrchestrationConfigGetResponse} class */ @Nonnull - public OrchestrationConfigGetResponse spec(@Nullable final OrchestrationConfig spec) { + public OrchestrationConfigGetResponse spec( + @Nullable final PromptRegistryOrchestrationConfig spec) { this.spec = spec; return this; } @@ -341,7 +342,7 @@ public OrchestrationConfigGetResponse spec(@Nullable final OrchestrationConfig s * @return spec The spec of this {@link OrchestrationConfigGetResponse} instance. */ @Nonnull - public OrchestrationConfig getSpec() { + public PromptRegistryOrchestrationConfig getSpec() { return spec; } @@ -350,7 +351,7 @@ public OrchestrationConfig getSpec() { * * @param spec The spec of this {@link OrchestrationConfigGetResponse} */ - public void setSpec(@Nullable final OrchestrationConfig spec) { + public void setSpec(@Nullable final PromptRegistryOrchestrationConfig spec) { this.spec = spec; } diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/OrchestrationConfigPostRequest.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/OrchestrationConfigPostRequest.java index 2e6688b7e..c06896fab 100644 --- a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/OrchestrationConfigPostRequest.java +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/OrchestrationConfigPostRequest.java @@ -38,7 +38,7 @@ public class OrchestrationConfigPostRequest private String scenario; @JsonProperty("spec") - private OrchestrationConfig spec; + private PromptRegistryOrchestrationConfig spec; @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); @@ -150,7 +150,8 @@ public void setScenario(@Nonnull final String scenario) { * @return The same instance of this {@link OrchestrationConfigPostRequest} class */ @Nonnull - public OrchestrationConfigPostRequest spec(@Nonnull final OrchestrationConfig spec) { + public OrchestrationConfigPostRequest spec( + @Nonnull final PromptRegistryOrchestrationConfig spec) { this.spec = spec; return this; } @@ -161,7 +162,7 @@ public OrchestrationConfigPostRequest spec(@Nonnull final OrchestrationConfig sp * @return spec The spec of this {@link OrchestrationConfigPostRequest} instance. */ @Nonnull - public OrchestrationConfig getSpec() { + public PromptRegistryOrchestrationConfig getSpec() { return spec; } @@ -170,7 +171,7 @@ public OrchestrationConfig getSpec() { * * @param spec The spec of this {@link OrchestrationConfigPostRequest} */ - public void setSpec(@Nonnull final OrchestrationConfig spec) { + public void setSpec(@Nonnull final PromptRegistryOrchestrationConfig spec) { this.spec = spec; } @@ -340,6 +341,6 @@ public interface Builder3 { * @param spec The spec of this {@link OrchestrationConfigPostRequest} * @return The OrchestrationConfigPostRequest instance. */ - OrchestrationConfigPostRequest spec(@Nonnull final OrchestrationConfig spec); + OrchestrationConfigPostRequest spec(@Nonnull final PromptRegistryOrchestrationConfig spec); } } diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/OrchestrationConfigResource.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/OrchestrationConfigResource.java index e84b996db..16addc945 100644 --- a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/OrchestrationConfigResource.java +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/OrchestrationConfigResource.java @@ -54,7 +54,7 @@ public class OrchestrationConfigResource private String resourceGroupId; @JsonProperty("spec") - private OrchestrationConfig spec; + private PromptRegistryOrchestrationConfig spec; @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); @@ -325,7 +325,7 @@ public void setResourceGroupId(@Nullable final String resourceGroupId) { * @return The same instance of this {@link OrchestrationConfigResource} class */ @Nonnull - public OrchestrationConfigResource spec(@Nullable final OrchestrationConfig spec) { + public OrchestrationConfigResource spec(@Nullable final PromptRegistryOrchestrationConfig spec) { this.spec = spec; return this; } @@ -336,7 +336,7 @@ public OrchestrationConfigResource spec(@Nullable final OrchestrationConfig spec * @return spec The spec of this {@link OrchestrationConfigResource} instance. */ @Nonnull - public OrchestrationConfig getSpec() { + public PromptRegistryOrchestrationConfig getSpec() { return spec; } @@ -345,7 +345,7 @@ public OrchestrationConfig getSpec() { * * @param spec The spec of this {@link OrchestrationConfigResource} */ - public void setSpec(@Nullable final OrchestrationConfig spec) { + public void setSpec(@Nullable final PromptRegistryOrchestrationConfig spec) { this.spec = spec; } diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/PartialModuleConfigs.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/PartialModuleConfigs.java new file mode 100644 index 000000000..ccd48d0d0 --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/PartialModuleConfigs.java @@ -0,0 +1,327 @@ +/* + * 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; + +/** + * Partial module configuration for use with config_ref overrides. All fields are optional so that + * only the modules that should be overridden need to be specified. The remaining configuration is + * taken from the referenced orchestration config. + */ +// CHECKSTYLE:OFF +public class PartialModuleConfigs +// CHECKSTYLE:ON +{ + @JsonProperty("prompt_templating") + private PartialPromptTemplatingModuleConfig promptTemplating; + + @JsonProperty("filtering") + private FilteringModuleConfig filtering; + + @JsonProperty("masking") + private MaskingModuleConfig masking; + + @JsonProperty("grounding") + private GroundingModuleConfig grounding; + + @JsonProperty("translation") + private TranslationModuleConfig translation; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for PartialModuleConfigs. */ + protected PartialModuleConfigs() {} + + /** + * Set the promptTemplating of this {@link PartialModuleConfigs} instance and return the same + * instance. + * + * @param promptTemplating The promptTemplating of this {@link PartialModuleConfigs} + * @return The same instance of this {@link PartialModuleConfigs} class + */ + @Nonnull + public PartialModuleConfigs promptTemplating( + @Nullable final PartialPromptTemplatingModuleConfig promptTemplating) { + this.promptTemplating = promptTemplating; + return this; + } + + /** + * Get promptTemplating + * + * @return promptTemplating The promptTemplating of this {@link PartialModuleConfigs} instance. + */ + @Nonnull + public PartialPromptTemplatingModuleConfig getPromptTemplating() { + return promptTemplating; + } + + /** + * Set the promptTemplating of this {@link PartialModuleConfigs} instance. + * + * @param promptTemplating The promptTemplating of this {@link PartialModuleConfigs} + */ + public void setPromptTemplating( + @Nullable final PartialPromptTemplatingModuleConfig promptTemplating) { + this.promptTemplating = promptTemplating; + } + + /** + * Set the filtering of this {@link PartialModuleConfigs} instance and return the same instance. + * + * @param filtering The filtering of this {@link PartialModuleConfigs} + * @return The same instance of this {@link PartialModuleConfigs} class + */ + @Nonnull + public PartialModuleConfigs filtering(@Nullable final FilteringModuleConfig filtering) { + this.filtering = filtering; + return this; + } + + /** + * Get filtering + * + * @return filtering The filtering of this {@link PartialModuleConfigs} instance. + */ + @Nonnull + public FilteringModuleConfig getFiltering() { + return filtering; + } + + /** + * Set the filtering of this {@link PartialModuleConfigs} instance. + * + * @param filtering The filtering of this {@link PartialModuleConfigs} + */ + public void setFiltering(@Nullable final FilteringModuleConfig filtering) { + this.filtering = filtering; + } + + /** + * Set the masking of this {@link PartialModuleConfigs} instance and return the same instance. + * + * @param masking The masking of this {@link PartialModuleConfigs} + * @return The same instance of this {@link PartialModuleConfigs} class + */ + @Nonnull + public PartialModuleConfigs masking(@Nullable final MaskingModuleConfig masking) { + this.masking = masking; + return this; + } + + /** + * Get masking + * + * @return masking The masking of this {@link PartialModuleConfigs} instance. + */ + @Nonnull + public MaskingModuleConfig getMasking() { + return masking; + } + + /** + * Set the masking of this {@link PartialModuleConfigs} instance. + * + * @param masking The masking of this {@link PartialModuleConfigs} + */ + public void setMasking(@Nullable final MaskingModuleConfig masking) { + this.masking = masking; + } + + /** + * Set the grounding of this {@link PartialModuleConfigs} instance and return the same instance. + * + * @param grounding The grounding of this {@link PartialModuleConfigs} + * @return The same instance of this {@link PartialModuleConfigs} class + */ + @Nonnull + public PartialModuleConfigs grounding(@Nullable final GroundingModuleConfig grounding) { + this.grounding = grounding; + return this; + } + + /** + * Get grounding + * + * @return grounding The grounding of this {@link PartialModuleConfigs} instance. + */ + @Nonnull + public GroundingModuleConfig getGrounding() { + return grounding; + } + + /** + * Set the grounding of this {@link PartialModuleConfigs} instance. + * + * @param grounding The grounding of this {@link PartialModuleConfigs} + */ + public void setGrounding(@Nullable final GroundingModuleConfig grounding) { + this.grounding = grounding; + } + + /** + * Set the translation of this {@link PartialModuleConfigs} instance and return the same instance. + * + * @param translation The translation of this {@link PartialModuleConfigs} + * @return The same instance of this {@link PartialModuleConfigs} class + */ + @Nonnull + public PartialModuleConfigs translation(@Nullable final TranslationModuleConfig translation) { + this.translation = translation; + return this; + } + + /** + * Get translation + * + * @return translation The translation of this {@link PartialModuleConfigs} instance. + */ + @Nonnull + public TranslationModuleConfig getTranslation() { + return translation; + } + + /** + * Set the translation of this {@link PartialModuleConfigs} instance. + * + * @param translation The translation of this {@link PartialModuleConfigs} + */ + public void setTranslation(@Nullable final TranslationModuleConfig translation) { + this.translation = translation; + } + + /** + * Get the names of the unrecognizable properties of the {@link PartialModuleConfigs}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link PartialModuleConfigs} 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( + "PartialModuleConfigs has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link PartialModuleConfigs} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (promptTemplating != null) declaredFields.put("promptTemplating", promptTemplating); + if (filtering != null) declaredFields.put("filtering", filtering); + if (masking != null) declaredFields.put("masking", masking); + if (grounding != null) declaredFields.put("grounding", grounding); + if (translation != null) declaredFields.put("translation", translation); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link PartialModuleConfigs} 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 PartialModuleConfigs partialModuleConfigs = (PartialModuleConfigs) o; + return Objects.equals(this.cloudSdkCustomFields, partialModuleConfigs.cloudSdkCustomFields) + && Objects.equals(this.promptTemplating, partialModuleConfigs.promptTemplating) + && Objects.equals(this.filtering, partialModuleConfigs.filtering) + && Objects.equals(this.masking, partialModuleConfigs.masking) + && Objects.equals(this.grounding, partialModuleConfigs.grounding) + && Objects.equals(this.translation, partialModuleConfigs.translation); + } + + @Override + public int hashCode() { + return Objects.hash( + promptTemplating, filtering, masking, grounding, translation, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class PartialModuleConfigs {\n"); + sb.append(" promptTemplating: ").append(toIndentedString(promptTemplating)).append("\n"); + sb.append(" filtering: ").append(toIndentedString(filtering)).append("\n"); + sb.append(" masking: ").append(toIndentedString(masking)).append("\n"); + sb.append(" grounding: ").append(toIndentedString(grounding)).append("\n"); + sb.append(" translation: ").append(toIndentedString(translation)).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 new {@link PartialModuleConfigs} instance. No arguments are required. */ + public static PartialModuleConfigs create() { + return new PartialModuleConfigs(); + } +} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/PartialPromptTemplatingModuleConfig.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/PartialPromptTemplatingModuleConfig.java new file mode 100644 index 000000000..2ca6a06d3 --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/PartialPromptTemplatingModuleConfig.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; + +/** + * Partial prompt templating configuration for use with config_ref overrides. model is optional so + * that only the prompt can be overridden without repeating the model config. + */ +// CHECKSTYLE:OFF +public class PartialPromptTemplatingModuleConfig +// CHECKSTYLE:ON +{ + @JsonProperty("prompt") + private PartialPromptTemplatingModuleConfigPrompt prompt; + + @JsonProperty("model") + private LLMModelDetails model; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for PartialPromptTemplatingModuleConfig. */ + protected PartialPromptTemplatingModuleConfig() {} + + /** + * Set the prompt of this {@link PartialPromptTemplatingModuleConfig} instance and return the same + * instance. + * + * @param prompt The prompt of this {@link PartialPromptTemplatingModuleConfig} + * @return The same instance of this {@link PartialPromptTemplatingModuleConfig} class + */ + @Nonnull + public PartialPromptTemplatingModuleConfig prompt( + @Nullable final PartialPromptTemplatingModuleConfigPrompt prompt) { + this.prompt = prompt; + return this; + } + + /** + * Get prompt + * + * @return prompt The prompt of this {@link PartialPromptTemplatingModuleConfig} instance. + */ + @Nonnull + public PartialPromptTemplatingModuleConfigPrompt getPrompt() { + return prompt; + } + + /** + * Set the prompt of this {@link PartialPromptTemplatingModuleConfig} instance. + * + * @param prompt The prompt of this {@link PartialPromptTemplatingModuleConfig} + */ + public void setPrompt(@Nullable final PartialPromptTemplatingModuleConfigPrompt prompt) { + this.prompt = prompt; + } + + /** + * Set the model of this {@link PartialPromptTemplatingModuleConfig} instance and return the same + * instance. + * + * @param model The model of this {@link PartialPromptTemplatingModuleConfig} + * @return The same instance of this {@link PartialPromptTemplatingModuleConfig} class + */ + @Nonnull + public PartialPromptTemplatingModuleConfig model(@Nullable final LLMModelDetails model) { + this.model = model; + return this; + } + + /** + * Get model + * + * @return model The model of this {@link PartialPromptTemplatingModuleConfig} instance. + */ + @Nonnull + public LLMModelDetails getModel() { + return model; + } + + /** + * Set the model of this {@link PartialPromptTemplatingModuleConfig} instance. + * + * @param model The model of this {@link PartialPromptTemplatingModuleConfig} + */ + public void setModel(@Nullable final LLMModelDetails model) { + this.model = model; + } + + /** + * Get the names of the unrecognizable properties of the {@link + * PartialPromptTemplatingModuleConfig}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link PartialPromptTemplatingModuleConfig} + * 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( + "PartialPromptTemplatingModuleConfig has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link PartialPromptTemplatingModuleConfig} instance + * including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (prompt != null) declaredFields.put("prompt", prompt); + if (model != null) declaredFields.put("model", model); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link PartialPromptTemplatingModuleConfig} 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 PartialPromptTemplatingModuleConfig partialPromptTemplatingModuleConfig = + (PartialPromptTemplatingModuleConfig) o; + return Objects.equals( + this.cloudSdkCustomFields, partialPromptTemplatingModuleConfig.cloudSdkCustomFields) + && Objects.equals(this.prompt, partialPromptTemplatingModuleConfig.prompt) + && Objects.equals(this.model, partialPromptTemplatingModuleConfig.model); + } + + @Override + public int hashCode() { + return Objects.hash(prompt, model, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class PartialPromptTemplatingModuleConfig {\n"); + sb.append(" prompt: ").append(toIndentedString(prompt)).append("\n"); + sb.append(" model: ").append(toIndentedString(model)).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 new {@link PartialPromptTemplatingModuleConfig} instance. No arguments are required. + */ + public static PartialPromptTemplatingModuleConfig create() { + return new PartialPromptTemplatingModuleConfig(); + } +} 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/PartialPromptTemplatingModuleConfigPrompt.java similarity index 92% rename from core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/PromptTemplatingModuleConfigPrompt.java rename to core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/PartialPromptTemplatingModuleConfigPrompt.java index d4286e011..eb7f68b90 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/PartialPromptTemplatingModuleConfigPrompt.java @@ -24,4 +24,4 @@ @JsonSubTypes.Type(value = Template.class), @JsonSubTypes.Type(value = TemplateRef.class), }) -public interface PromptTemplatingModuleConfigPrompt {} +public interface PartialPromptTemplatingModuleConfigPrompt {} 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/PromptRegistryOrchestrationConfig.java similarity index 58% rename from core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/OrchestrationConfig.java rename to core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/PromptRegistryOrchestrationConfig.java index ba8c0b894..ce2935ea4 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/PromptRegistryOrchestrationConfig.java @@ -23,13 +23,13 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; -/** OrchestrationConfig */ +/** PromptRegistryOrchestrationConfig */ // CHECKSTYLE:OFF -public class OrchestrationConfig +public class PromptRegistryOrchestrationConfig // CHECKSTYLE:ON { @JsonProperty("modules") - private OrchestrationConfigModules modules; + private PromptRegistryOrchestrationConfigModules modules; @JsonProperty("stream") private GlobalStreamOptions stream; @@ -37,17 +37,19 @@ public class OrchestrationConfig @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - /** Default constructor for OrchestrationConfig. */ - protected OrchestrationConfig() {} + /** Default constructor for PromptRegistryOrchestrationConfig. */ + protected PromptRegistryOrchestrationConfig() {} /** - * Set the modules of this {@link OrchestrationConfig} instance and return the same instance. + * Set the modules of this {@link PromptRegistryOrchestrationConfig} instance and return the same + * instance. * - * @param modules The modules of this {@link OrchestrationConfig} - * @return The same instance of this {@link OrchestrationConfig} class + * @param modules The modules of this {@link PromptRegistryOrchestrationConfig} + * @return The same instance of this {@link PromptRegistryOrchestrationConfig} class */ @Nonnull - public OrchestrationConfig modules(@Nonnull final OrchestrationConfigModules modules) { + public PromptRegistryOrchestrationConfig modules( + @Nullable final PromptRegistryOrchestrationConfigModules modules) { this.modules = modules; return this; } @@ -55,30 +57,31 @@ public OrchestrationConfig modules(@Nonnull final OrchestrationConfigModules mod /** * Get modules * - * @return modules The modules of this {@link OrchestrationConfig} instance. + * @return modules The modules of this {@link PromptRegistryOrchestrationConfig} instance. */ @Nonnull - public OrchestrationConfigModules getModules() { + public PromptRegistryOrchestrationConfigModules getModules() { return modules; } /** - * Set the modules of this {@link OrchestrationConfig} instance. + * Set the modules of this {@link PromptRegistryOrchestrationConfig} instance. * - * @param modules The modules of this {@link OrchestrationConfig} + * @param modules The modules of this {@link PromptRegistryOrchestrationConfig} */ - public void setModules(@Nonnull final OrchestrationConfigModules modules) { + public void setModules(@Nullable final PromptRegistryOrchestrationConfigModules modules) { this.modules = modules; } /** - * Set the stream of this {@link OrchestrationConfig} instance and return the same instance. + * Set the stream of this {@link PromptRegistryOrchestrationConfig} instance and return the same + * instance. * - * @param stream The stream of this {@link OrchestrationConfig} - * @return The same instance of this {@link OrchestrationConfig} class + * @param stream The stream of this {@link PromptRegistryOrchestrationConfig} + * @return The same instance of this {@link PromptRegistryOrchestrationConfig} class */ @Nonnull - public OrchestrationConfig stream(@Nullable final GlobalStreamOptions stream) { + public PromptRegistryOrchestrationConfig stream(@Nullable final GlobalStreamOptions stream) { this.stream = stream; return this; } @@ -86,7 +89,7 @@ public OrchestrationConfig stream(@Nullable final GlobalStreamOptions stream) { /** * Get stream * - * @return stream The stream of this {@link OrchestrationConfig} instance. + * @return stream The stream of this {@link PromptRegistryOrchestrationConfig} instance. */ @Nonnull public GlobalStreamOptions getStream() { @@ -94,16 +97,17 @@ public GlobalStreamOptions getStream() { } /** - * Set the stream of this {@link OrchestrationConfig} instance. + * Set the stream of this {@link PromptRegistryOrchestrationConfig} instance. * - * @param stream The stream of this {@link OrchestrationConfig} + * @param stream The stream of this {@link PromptRegistryOrchestrationConfig} */ public void setStream(@Nullable final GlobalStreamOptions stream) { this.stream = stream; } /** - * Get the names of the unrecognizable properties of the {@link OrchestrationConfig}. + * Get the names of the unrecognizable properties of the {@link + * PromptRegistryOrchestrationConfig}. * * @return The set of properties names */ @@ -114,7 +118,8 @@ public Set getCustomFieldNames() { } /** - * Get the value of an unrecognizable property of this {@link OrchestrationConfig} instance. + * Get the value of an unrecognizable property of this {@link PromptRegistryOrchestrationConfig} + * instance. * * @deprecated Use {@link #toMap()} instead. * @param name The name of the property @@ -126,14 +131,14 @@ public Set getCustomFieldNames() { public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { if (!cloudSdkCustomFields.containsKey(name)) { throw new NoSuchElementException( - "OrchestrationConfig has no field with name '" + name + "'."); + "PromptRegistryOrchestrationConfig has no field with name '" + name + "'."); } return cloudSdkCustomFields.get(name); } /** - * Get the value of all properties of this {@link OrchestrationConfig} instance including - * unrecognized properties. + * Get the value of all properties of this {@link PromptRegistryOrchestrationConfig} instance + * including unrecognized properties. * * @return The map of all properties */ @@ -147,8 +152,9 @@ public Map toMap() { } /** - * Set an unrecognizable property of this {@link OrchestrationConfig} instance. If the map - * previously contained a mapping for the key, the old value is replaced by the specified value. + * Set an unrecognizable property of this {@link PromptRegistryOrchestrationConfig} 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 @@ -166,10 +172,12 @@ public boolean equals(@Nullable final java.lang.Object o) { if (o == null || getClass() != o.getClass()) { return false; } - final OrchestrationConfig orchestrationConfig = (OrchestrationConfig) o; - return Objects.equals(this.cloudSdkCustomFields, orchestrationConfig.cloudSdkCustomFields) - && Objects.equals(this.modules, orchestrationConfig.modules) - && Objects.equals(this.stream, orchestrationConfig.stream); + final PromptRegistryOrchestrationConfig promptRegistryOrchestrationConfig = + (PromptRegistryOrchestrationConfig) o; + return Objects.equals( + this.cloudSdkCustomFields, promptRegistryOrchestrationConfig.cloudSdkCustomFields) + && Objects.equals(this.modules, promptRegistryOrchestrationConfig.modules) + && Objects.equals(this.stream, promptRegistryOrchestrationConfig.stream); } @Override @@ -181,7 +189,7 @@ public int hashCode() { @Nonnull public String toString() { final StringBuilder sb = new StringBuilder(); - sb.append("class OrchestrationConfig {\n"); + sb.append("class PromptRegistryOrchestrationConfig {\n"); sb.append(" modules: ").append(toIndentedString(modules)).append("\n"); sb.append(" stream: ").append(toIndentedString(stream)).append("\n"); cloudSdkCustomFields.forEach( @@ -201,22 +209,8 @@ private String toIndentedString(final java.lang.Object o) { return o.toString().replace("\n", "\n "); } - /** - * Create a type-safe, fluent-api builder object to construct a new {@link OrchestrationConfig} - * instance with all required arguments. - */ - public static Builder create() { - return (modules) -> new OrchestrationConfig().modules(modules); - } - - /** Builder helper class. */ - public interface Builder { - /** - * Set the modules of this {@link OrchestrationConfig} instance. - * - * @param modules The modules of this {@link OrchestrationConfig} - * @return The OrchestrationConfig instance. - */ - OrchestrationConfig modules(@Nonnull final OrchestrationConfigModules modules); + /** Create a new {@link PromptRegistryOrchestrationConfig} instance. No arguments are required. */ + public static PromptRegistryOrchestrationConfig create() { + return new PromptRegistryOrchestrationConfig(); } } 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/PromptRegistryOrchestrationConfigModules.java similarity index 57% rename from core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/OrchestrationConfigModules.java rename to core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/PromptRegistryOrchestrationConfigModules.java index 02d0bdb01..a232ea22a 100644 --- 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/PromptRegistryOrchestrationConfigModules.java @@ -14,35 +14,36 @@ import java.util.List; import javax.annotation.Nonnull; -/** OrchestrationConfigModules */ -public interface OrchestrationConfigModules { +/** PromptRegistryOrchestrationConfigModules */ +public interface PromptRegistryOrchestrationConfigModules { /** - * Helper class to create {@code ModuleConfigs } that implements {@link - * OrchestrationConfigModules}. + * Helper class to create {@code PartialModuleConfigs } that implements {@link + * PromptRegistryOrchestrationConfigModules}. */ - record InnerModuleConfigs( - @com.fasterxml.jackson.annotation.JsonValue @Nonnull ModuleConfigs value) - implements OrchestrationConfigModules {} + record InnerPartialModuleConfigs( + @com.fasterxml.jackson.annotation.JsonValue @Nonnull PartialModuleConfigs value) + implements PromptRegistryOrchestrationConfigModules {} /** - * Creator to enable deserialization of {@code ModuleConfigs }. + * Creator to enable deserialization of {@code PartialModuleConfigs }. * * @param val the value to use - * @return a new instance of {@link InnerModuleConfigs}. + * @return a new instance of {@link InnerPartialModuleConfigs}. */ @com.fasterxml.jackson.annotation.JsonCreator @Nonnull - static InnerModuleConfigs createInnerModuleConfigs(@Nonnull final ModuleConfigs val) { - return new InnerModuleConfigs(val); + static InnerPartialModuleConfigs createInnerPartialModuleConfigs( + @Nonnull final PartialModuleConfigs val) { + return new InnerPartialModuleConfigs(val); } /** * Helper class to create {@code List } that implements {@link - * OrchestrationConfigModules}. + * PromptRegistryOrchestrationConfigModules}. */ record ListOfModuleConfigss( @com.fasterxml.jackson.annotation.JsonValue @Nonnull List values) - implements OrchestrationConfigModules {} + implements PromptRegistryOrchestrationConfigModules {} /** * Creator to enable deserialization of {@code List }. 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 38139cbfe..badfa1166 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 @@ -29,7 +29,7 @@ public class PromptTemplatingModuleConfig // CHECKSTYLE:ON { @JsonProperty("prompt") - private PromptTemplatingModuleConfigPrompt prompt; + private PartialPromptTemplatingModuleConfigPrompt prompt; @JsonProperty("model") private LLMModelDetails model; @@ -49,7 +49,7 @@ protected PromptTemplatingModuleConfig() {} */ @Nonnull public PromptTemplatingModuleConfig prompt( - @Nullable final PromptTemplatingModuleConfigPrompt prompt) { + @Nullable final PartialPromptTemplatingModuleConfigPrompt prompt) { this.prompt = prompt; return this; } @@ -60,7 +60,7 @@ public PromptTemplatingModuleConfig prompt( * @return prompt The prompt of this {@link PromptTemplatingModuleConfig} instance. */ @Nonnull - public PromptTemplatingModuleConfigPrompt getPrompt() { + public PartialPromptTemplatingModuleConfigPrompt getPrompt() { return prompt; } @@ -69,7 +69,7 @@ public PromptTemplatingModuleConfigPrompt getPrompt() { * * @param prompt The prompt of this {@link PromptTemplatingModuleConfig} */ - public void setPrompt(@Nullable final PromptTemplatingModuleConfigPrompt prompt) { + public void setPrompt(@Nullable final PartialPromptTemplatingModuleConfigPrompt prompt) { this.prompt = prompt; } diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/ReasoningBlock.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/ReasoningBlock.java new file mode 100644 index 000000000..af9478ab2 --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/ReasoningBlock.java @@ -0,0 +1,207 @@ +/* + * 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; + +/** ReasoningBlock */ +// CHECKSTYLE:OFF +public class ReasoningBlock +// CHECKSTYLE:ON +{ + @JsonProperty("content") + private String content = ""; + + @JsonProperty("signature") + private String signature = ""; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for ReasoningBlock. */ + protected ReasoningBlock() {} + + /** + * Set the content of this {@link ReasoningBlock} instance and return the same instance. + * + * @param content The content of this {@link ReasoningBlock} + * @return The same instance of this {@link ReasoningBlock} class + */ + @Nonnull + public ReasoningBlock content(@Nullable final String content) { + this.content = content; + return this; + } + + /** + * Get content + * + * @return content The content of this {@link ReasoningBlock} instance. + */ + @Nonnull + public String getContent() { + return content; + } + + /** + * Set the content of this {@link ReasoningBlock} instance. + * + * @param content The content of this {@link ReasoningBlock} + */ + public void setContent(@Nullable final String content) { + this.content = content; + } + + /** + * Set the signature of this {@link ReasoningBlock} instance and return the same instance. + * + * @param signature The signature of this {@link ReasoningBlock} + * @return The same instance of this {@link ReasoningBlock} class + */ + @Nonnull + public ReasoningBlock signature(@Nullable final String signature) { + this.signature = signature; + return this; + } + + /** + * Get signature + * + * @return signature The signature of this {@link ReasoningBlock} instance. + */ + @Nonnull + public String getSignature() { + return signature; + } + + /** + * Set the signature of this {@link ReasoningBlock} instance. + * + * @param signature The signature of this {@link ReasoningBlock} + */ + public void setSignature(@Nullable final String signature) { + this.signature = signature; + } + + /** + * Get the names of the unrecognizable properties of the {@link ReasoningBlock}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link ReasoningBlock} 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("ReasoningBlock has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link ReasoningBlock} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (content != null) declaredFields.put("content", content); + if (signature != null) declaredFields.put("signature", signature); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link ReasoningBlock} 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 ReasoningBlock reasoningBlock = (ReasoningBlock) o; + return Objects.equals(this.cloudSdkCustomFields, reasoningBlock.cloudSdkCustomFields) + && Objects.equals(this.content, reasoningBlock.content) + && Objects.equals(this.signature, reasoningBlock.signature); + } + + @Override + public int hashCode() { + return Objects.hash(content, signature, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class ReasoningBlock {\n"); + sb.append(" content: ").append(toIndentedString(content)).append("\n"); + sb.append(" signature: ").append(toIndentedString(signature)).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 new {@link ReasoningBlock} instance. No arguments are required. */ + public static ReasoningBlock create() { + return new ReasoningBlock(); + } +} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/RuntimeOrchestrationConfigFile.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/RuntimeOrchestrationConfigFile.java index b09fdd764..013176658 100644 --- a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/RuntimeOrchestrationConfigFile.java +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/RuntimeOrchestrationConfigFile.java @@ -38,7 +38,7 @@ public class RuntimeOrchestrationConfigFile private RuntimePromptTemplateFileMetadata metadata; @JsonProperty("spec") - private OrchestrationConfig spec; + private PromptRegistryOrchestrationConfig spec; @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); @@ -151,7 +151,8 @@ public void setMetadata(@Nullable final RuntimePromptTemplateFileMetadata metada * @return The same instance of this {@link RuntimeOrchestrationConfigFile} class */ @Nonnull - public RuntimeOrchestrationConfigFile spec(@Nullable final OrchestrationConfig spec) { + public RuntimeOrchestrationConfigFile spec( + @Nullable final PromptRegistryOrchestrationConfig spec) { this.spec = spec; return this; } @@ -162,7 +163,7 @@ public RuntimeOrchestrationConfigFile spec(@Nullable final OrchestrationConfig s * @return spec The spec of this {@link RuntimeOrchestrationConfigFile} instance. */ @Nonnull - public OrchestrationConfig getSpec() { + public PromptRegistryOrchestrationConfig getSpec() { return spec; } @@ -171,7 +172,7 @@ public OrchestrationConfig getSpec() { * * @param spec The spec of this {@link RuntimeOrchestrationConfigFile} */ - public void setSpec(@Nullable final OrchestrationConfig spec) { + public void setSpec(@Nullable final PromptRegistryOrchestrationConfig spec) { this.spec = spec; } 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 67dc42610..9ea4fd0c6 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 @@ -29,7 +29,7 @@ /** Template */ // CHECKSTYLE:OFF -public class Template implements PromptTemplatingModuleConfigPrompt +public class Template implements PartialPromptTemplatingModuleConfigPrompt // CHECKSTYLE:ON { @JsonProperty("template") diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/TemplateRef.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/TemplateRef.java index 931805dd6..6b63eec1b 100644 --- a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/TemplateRef.java +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/TemplateRef.java @@ -25,7 +25,7 @@ /** TemplateRef */ // CHECKSTYLE:OFF -public class TemplateRef implements PromptTemplatingModuleConfigPrompt +public class TemplateRef implements PartialPromptTemplatingModuleConfigPrompt // CHECKSTYLE:ON { @JsonProperty("template_ref") 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 ed147d504..d92aa0fac 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 @@ -943,7 +943,7 @@ components: resource_group_id: type: string spec: - $ref: '#/components/schemas/OrchestrationConfig' + $ref: '#/components/schemas/PromptRegistryOrchestrationConfig' OrchestrationConfigListResponse: type: object required: @@ -956,6 +956,16 @@ components: type: array items: $ref: '#/components/schemas/OrchestrationConfigGetResponse' + PromptRegistryOrchestrationConfig: + type: object + additionalProperties: false + properties: + modules: + oneOf: + - $ref: '#/components/schemas/PartialModuleConfigs' + - $ref: '#/components/schemas/ModuleConfigsList' + stream: + $ref: '#/components/schemas/GlobalStreamOptions' OrchestrationConfigPostRequest: type: object required: @@ -977,7 +987,7 @@ components: maxLength: 120 pattern: ^[a-zA-Z0-9_-]+$ spec: - $ref: '#/components/schemas/OrchestrationConfig' + $ref: '#/components/schemas/PromptRegistryOrchestrationConfig' OrchestrationConfigPostResponse: type: object required: @@ -1020,7 +1030,7 @@ components: resource_group_id: type: string spec: - $ref: '#/components/schemas/OrchestrationConfig' + $ref: '#/components/schemas/PromptRegistryOrchestrationConfig' OrchestrationConfigDeleteResponse: type: object required: @@ -1045,7 +1055,7 @@ components: scenario: type: string spec: - $ref: '#/components/schemas/OrchestrationConfig' + $ref: '#/components/schemas/PromptRegistryOrchestrationConfig' CacheControl: type: object description: | @@ -1196,6 +1206,16 @@ components: description: The tool calls generated by the model, such as function calls. items: $ref: '#/components/schemas/MessageToolCall' + ReasoningBlock: + type: object + additionalProperties: false + properties: + content: + type: string + default: '' + signature: + type: string + default: '' AssistantChatMessage: type: object additionalProperties: false @@ -1210,6 +1230,12 @@ components: type: string tool_calls: $ref: '#/components/schemas/MessageToolCalls' + reasoning_content: + type: array + items: + $ref: '#/components/schemas/ReasoningBlock' + description: | + Reasoning or thinking content from the model's previous turn. required: - role ToolChatMessage: @@ -1401,10 +1427,10 @@ components: default: 2 minimum: 0 maximum: 5 - PromptTemplatingModuleConfig: + PartialPromptTemplatingModuleConfig: + description: | + Partial prompt templating configuration for use with config_ref overrides. model is optional so that only the prompt can be overridden without repeating the model config. type: object - required: - - model additionalProperties: false properties: prompt: @@ -2030,6 +2056,36 @@ components: description: Configuration for output translation oneOf: - $ref: '#/components/schemas/SAPDocumentTranslationOutput' + PartialModuleConfigs: + description: | + Partial module configuration for use with config_ref overrides. All fields are optional so that only the modules that should be overridden need to be specified. The remaining configuration is taken from the referenced orchestration config. + type: object + additionalProperties: false + properties: + prompt_templating: + $ref: '#/components/schemas/PartialPromptTemplatingModuleConfig' + filtering: + $ref: '#/components/schemas/FilteringModuleConfig' + masking: + $ref: '#/components/schemas/MaskingModuleConfig' + grounding: + $ref: '#/components/schemas/GroundingModuleConfig' + translation: + $ref: '#/components/schemas/TranslationModuleConfig' + PromptTemplatingModuleConfig: + type: object + required: + - 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. If omitted, messages_history must be provided in the request body. + oneOf: + - $ref: '#/components/schemas/Template' + - $ref: '#/components/schemas/TemplateRef' + model: + $ref: '#/components/schemas/LLMModelDetails' ModuleConfigs: type: object required: @@ -2080,18 +2136,6 @@ components: - . - '?' - '!' - OrchestrationConfig: - type: object - required: - - modules - additionalProperties: false - properties: - modules: - oneOf: - - $ref: '#/components/schemas/ModuleConfigs' - - $ref: '#/components/schemas/ModuleConfigsList' - stream: - $ref: '#/components/schemas/GlobalStreamOptions' responses: BadRequest: description: Bad Request @@ -2136,4 +2180,4 @@ components: - 'true' - 'True' - 'false' - - 'False' + - 'False' \ No newline at end of file diff --git a/docs/release_notes.md b/docs/release_notes.md index 5745d6681..7f0ea3f64 100644 --- a/docs/release_notes.md +++ b/docs/release_notes.md @@ -8,7 +8,7 @@ ### 🔧 Compatibility Notes -- +- [Prompt Registry] Use `PromptRegistryOrchestrationConfig` instead of `OrchestrationConfig` in `OrchestrationConfigPostRequest` and similar classes. ### ✨ New Functionality diff --git a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/PromptRegistryController.java b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/PromptRegistryController.java index 3de93678e..097a7c193 100644 --- a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/PromptRegistryController.java +++ b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/PromptRegistryController.java @@ -6,13 +6,14 @@ import com.sap.ai.sdk.prompt.registry.OrchestrationConfigClient; import com.sap.ai.sdk.prompt.registry.PromptClient; import com.sap.ai.sdk.prompt.registry.model.LLMModelDetails; -import com.sap.ai.sdk.prompt.registry.model.ModuleConfigs; -import com.sap.ai.sdk.prompt.registry.model.OrchestrationConfig; import com.sap.ai.sdk.prompt.registry.model.OrchestrationConfigDeleteResponse; import com.sap.ai.sdk.prompt.registry.model.OrchestrationConfigListResponse; -import com.sap.ai.sdk.prompt.registry.model.OrchestrationConfigModules; import com.sap.ai.sdk.prompt.registry.model.OrchestrationConfigPostRequest; import com.sap.ai.sdk.prompt.registry.model.OrchestrationConfigPostResponse; +import com.sap.ai.sdk.prompt.registry.model.PartialModuleConfigs; +import com.sap.ai.sdk.prompt.registry.model.PartialPromptTemplatingModuleConfig; +import com.sap.ai.sdk.prompt.registry.model.PromptRegistryOrchestrationConfig; +import com.sap.ai.sdk.prompt.registry.model.PromptRegistryOrchestrationConfigModules; import com.sap.ai.sdk.prompt.registry.model.PromptTemplateDeleteResponse; import com.sap.ai.sdk.prompt.registry.model.PromptTemplateListResponse; import com.sap.ai.sdk.prompt.registry.model.PromptTemplatePostRequest; @@ -20,7 +21,6 @@ import com.sap.ai.sdk.prompt.registry.model.PromptTemplateSpec; import com.sap.ai.sdk.prompt.registry.model.PromptTemplateSubstitutionRequest; import com.sap.ai.sdk.prompt.registry.model.PromptTemplateSubstitutionResponse; -import com.sap.ai.sdk.prompt.registry.model.PromptTemplatingModuleConfig; import com.sap.ai.sdk.prompt.registry.model.SingleChatTemplate; import com.sap.ai.sdk.prompt.registry.model.Template; import com.sap.ai.sdk.prompt.registry.model.UserChatMessage; @@ -163,21 +163,21 @@ OrchestrationConfigListResponse listOrchConfigs() { @GetMapping("/createOrchConfig") OrchestrationConfigPostResponse createOrchConfig() { - // build OrchestrationConfig + // build PromptRegistryOrchestrationConfig final var message = UserChatMessage.create() .content(new UserChatMessageContent.InnerString("message")) .role(UserChatMessage.RoleEnum.USER); final var promptTemplating = - PromptTemplatingModuleConfig.create() + PartialPromptTemplatingModuleConfig.create() .model(LLMModelDetails.create().name("model-name")) .prompt(Template.create().template(message)); final var orchestrationConfig = - OrchestrationConfig.create() + PromptRegistryOrchestrationConfig.create() .modules( - OrchestrationConfigModules.createInnerModuleConfigs( - ModuleConfigs.create().promptTemplating(promptTemplating))); - // use OrchestrationConfig in OrchestrationConfigClient + PromptRegistryOrchestrationConfigModules.createInnerPartialModuleConfigs( + PartialModuleConfigs.create().promptTemplating(promptTemplating))); + // use the config in OrchestrationConfigClient final OrchestrationConfigPostRequest postRequest = OrchestrationConfigPostRequest.create() .name(NAME) diff --git a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/OrchestrationService.java b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/OrchestrationService.java index bf8d82b9d..3bba5260c 100644 --- a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/OrchestrationService.java +++ b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/OrchestrationService.java @@ -41,11 +41,11 @@ import com.sap.ai.sdk.orchestration.model.Template; import com.sap.ai.sdk.prompt.registry.OrchestrationConfigClient; import com.sap.ai.sdk.prompt.registry.model.LLMModelDetails; -import com.sap.ai.sdk.prompt.registry.model.ModuleConfigs; -import com.sap.ai.sdk.prompt.registry.model.OrchestrationConfig; -import com.sap.ai.sdk.prompt.registry.model.OrchestrationConfigModules; import com.sap.ai.sdk.prompt.registry.model.OrchestrationConfigPostRequest; -import com.sap.ai.sdk.prompt.registry.model.PromptTemplatingModuleConfig; +import com.sap.ai.sdk.prompt.registry.model.PartialModuleConfigs; +import com.sap.ai.sdk.prompt.registry.model.PartialPromptTemplatingModuleConfig; +import com.sap.ai.sdk.prompt.registry.model.PromptRegistryOrchestrationConfig; +import com.sap.ai.sdk.prompt.registry.model.PromptRegistryOrchestrationConfigModules; import com.sap.ai.sdk.prompt.registry.model.UserChatMessage; import com.sap.ai.sdk.prompt.registry.model.UserChatMessageContent; import java.io.IOException; @@ -831,7 +831,7 @@ private boolean orchConfigExists( .anyMatch(resp -> resp.getName().equals(configName)); } - private OrchestrationConfig buildOrchestrationConfig() { + private PromptRegistryOrchestrationConfig buildOrchestrationConfig() { final var prompt = com.sap.ai.sdk.prompt.registry.model.Template.create() .template( @@ -843,14 +843,14 @@ private OrchestrationConfig buildOrchestrationConfig() { .defaults(Map.of("number", "3")); final var moduleConfig = - PromptTemplatingModuleConfig.create() + PartialPromptTemplatingModuleConfig.create() .model(LLMModelDetails.create().name(GPT_41_NANO.getName())) .prompt(prompt); - return OrchestrationConfig.create() + return PromptRegistryOrchestrationConfig.create() .modules( - OrchestrationConfigModules.createInnerModuleConfigs( - ModuleConfigs.create().promptTemplating(moduleConfig))); + PromptRegistryOrchestrationConfigModules.createInnerPartialModuleConfigs( + PartialModuleConfigs.create().promptTemplating(moduleConfig))); } /**