66import javax .annotation .Nullable ;
77
88import com .sap .ai .sdk .orchestration .client .model .LLMModuleResult ;
9+ import lombok .AccessLevel ;
910import lombok .Getter ;
11+ import lombok .RequiredArgsConstructor ;
1012
1113/** Large language models available in Orchestration. */
1214// https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/models-and-scenarios-in-generative-ai-hub
1315@ Getter
16+ @ RequiredArgsConstructor (access = AccessLevel .PRIVATE )
1417public class OrchestrationAiModel {
1518 private final LLMModuleConfig config ;
1619
@@ -123,10 +126,6 @@ public class OrchestrationAiModel {
123126 config = new LLMModuleConfig ().modelName (modelName ).modelParams (Map .of ());
124127 }
125128
126- private OrchestrationAiModel (@ Nonnull final LLMModuleConfig config ) {
127- this .config = config ;
128- }
129-
130129 /**
131130 * Set model version on this model.
132131 *
@@ -139,7 +138,10 @@ private OrchestrationAiModel(@Nonnull final LLMModuleConfig config) {
139138 */
140139 @ Nonnull
141140 public OrchestrationAiModel modelVersion (@ Nonnull final String version ) {
142- return new OrchestrationAiModel (config .modelVersion ((version )));
141+ return new OrchestrationAiModel (new LLMModuleConfig ()
142+ .modelVersion (version )
143+ .modelParams (config .getModelParams ())
144+ .modelName (config .getModelName ()));
143145 }
144146
145147 /**
@@ -157,9 +159,13 @@ public OrchestrationAiModel modelVersion(@Nonnull final String version) {
157159 * @param modelParams Map of parameters.
158160 * @return New instance of this class.
159161 */
160- @ Nonnull
161- public OrchestrationAiModel modelParams (
162- @ Nonnull final Map <String , ? extends Number > modelParams ) {
163- return new OrchestrationAiModel (config .modelParams (modelParams ));
164- }
162+ @ Nonnull
163+ public OrchestrationAiModel modelParams (
164+ @ Nonnull final Map <String , ? extends Number > modelParams ) {
165+ return new OrchestrationAiModel (
166+ new LLMModuleConfig ()
167+ .modelVersion (config .getModelVersion ())
168+ .modelParams (modelParams )
169+ .modelName (config .getModelName ()));
170+ }
165171}
0 commit comments