33import com .sap .ai .sdk .orchestration .client .model .LLMModuleConfig ;
44import java .util .Map ;
55import javax .annotation .Nonnull ;
6+ import lombok .AccessLevel ;
67import lombok .AllArgsConstructor ;
7- import lombok .Value ;
8+ import lombok .EqualsAndHashCode ;
9+ import lombok .Getter ;
810import lombok .With ;
11+ import lombok .experimental .Tolerate ;
912
1013/** Large language models available in Orchestration. */
11- @ Value
1214@ With
1315@ AllArgsConstructor
16+ @ Getter (AccessLevel .PACKAGE )
17+ @ EqualsAndHashCode
1418public class OrchestrationAiModel {
1519 /** The name of the model */
16- String name ;
20+ private final String name ;
1721
1822 /**
1923 * Optional parameters on this model.
@@ -26,10 +30,10 @@ public class OrchestrationAiModel {
2630 * "presence_penalty", 0)
2731 * }</pre>
2832 */
29- Map <String , Object > params ;
33+ private final Map <String , Object > params ;
3034
3135 /** The version of the model, defaults to "latest". */
32- String version ;
36+ private final String version ;
3337
3438 /** IBM Granite 13B chat completions model */
3539 public static final OrchestrationAiModel IBM_GRANITE_13B_CHAT =
@@ -76,23 +80,28 @@ public class OrchestrationAiModel {
7680 new OrchestrationAiModel ("amazon--titan-text-express" );
7781
7882 /** Azure OpenAI GPT-3.5 Turbo chat completions model */
79- public static final OrchestrationAiModel GPT_35_TURBO = new OrchestrationAiModel ("gpt-35-turbo" );
83+ public static final Parameterized <OrchestrationAiModelParameters .GPT > GPT_35_TURBO =
84+ new Parameterized <>("gpt-35-turbo" );
8085
8186 /** Azure OpenAI GPT-3.5 Turbo chat completions model */
82- public static final OrchestrationAiModel GPT_35_TURBO_16K =
83- new OrchestrationAiModel ("gpt-35-turbo-16k" );
87+ public static final Parameterized < OrchestrationAiModelParameters . GPT > GPT_35_TURBO_16K =
88+ new Parameterized <> ("gpt-35-turbo-16k" );
8489
8590 /** Azure OpenAI GPT-4 chat completions model */
86- public static final OrchestrationAiModel GPT_4 = new OrchestrationAiModel ("gpt-4" );
91+ public static final Parameterized <OrchestrationAiModelParameters .GPT > GPT_4 =
92+ new Parameterized <>("gpt-4" );
8793
8894 /** Azure OpenAI GPT-4-32k chat completions model */
89- public static final OrchestrationAiModel GPT_4_32K = new OrchestrationAiModel ("gpt-4-32k" );
95+ public static final Parameterized <OrchestrationAiModelParameters .GPT > GPT_4_32K =
96+ new Parameterized <>("gpt-4-32k" );
9097
9198 /** Azure OpenAI GPT-4o chat completions model */
92- public static final OrchestrationAiModel GPT_4O = new OrchestrationAiModel ("gpt-4o" );
99+ public static final Parameterized <OrchestrationAiModelParameters .GPT > GPT_4O =
100+ new Parameterized <>("gpt-4o" );
93101
94102 /** Azure OpenAI GPT-4o-mini chat completions model */
95- public static final OrchestrationAiModel GPT_4O_MINI = new OrchestrationAiModel ("gpt-4o-mini" );
103+ public static final Parameterized <OrchestrationAiModelParameters .GPT > GPT_4O_MINI =
104+ new Parameterized <>("gpt-4o-mini" );
96105
97106 /** Google Cloud Platform Gemini 1.0 Pro model */
98107 public static final OrchestrationAiModel GEMINI_1_0_PRO =
@@ -114,4 +123,28 @@ public class OrchestrationAiModel {
114123 LLMModuleConfig createConfig () {
115124 return new LLMModuleConfig ().modelName (name ).modelParams (params ).modelVersion (version );
116125 }
126+
127+ /**
128+ * Subclass to allow for parameterized models.
129+ *
130+ * @param <T> The type of parameters for this model.
131+ */
132+ public static final class Parameterized <T extends OrchestrationAiModelParameters >
133+ extends OrchestrationAiModel {
134+ private Parameterized (@ Nonnull final String name ) {
135+ super (name );
136+ }
137+
138+ /**
139+ * Set the typed parameters for this model.
140+ *
141+ * @param params The parameters for this model.
142+ * @return The model with the parameters set.
143+ */
144+ @ Tolerate
145+ @ Nonnull
146+ public OrchestrationAiModel withParams (@ Nonnull final T params ) {
147+ return super .withParams (params .getParams ());
148+ }
149+ }
117150}
0 commit comments