11package com .sap .ai .sdk .orchestration ;
22
3+ import com .sap .ai .sdk .core .AiModel ;
34import com .sap .ai .sdk .orchestration .client .model .LLMModuleConfig ;
45import java .util .Map ;
56import javax .annotation .Nonnull ;
7+ import javax .annotation .Nullable ;
68import lombok .AccessLevel ;
7- import lombok .Getter ;
8- import lombok .RequiredArgsConstructor ;
9+ import lombok .AllArgsConstructor ;
10+ import lombok .With ;
911
1012/** Large language models available in Orchestration. */
11- // https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/models-and-scenarios-in-generative-ai-hub
12- @ Getter
13- @ RequiredArgsConstructor (access = AccessLevel .PRIVATE )
14- public class OrchestrationAiModel {
15- private final LLMModuleConfig config ;
13+ @ With
14+ @ AllArgsConstructor (access = AccessLevel .PRIVATE )
15+ public class OrchestrationAiModel implements AiModel {
16+ /** The name of the model */
17+ private String modelName ;
18+
19+ /** The version of the model, defaults to "latest". */
20+ private String modelVersion = "latest" ;
21+
22+ /**
23+ * Optional parameters on this model.
24+ *
25+ * <pre>{@code
26+ * Map.of(
27+ * "max_tokens", 50,
28+ * "temperature", 0.1,
29+ * "frequency_penalty", 0,
30+ * "presence_penalty", 0)
31+ * }</pre>
32+ */
33+ private Map <String , Object > modelParams ;
1634
1735 /** IBM Granite 13B chat completions model */
1836 public static final OrchestrationAiModel IBM_GRANITE_13B_CHAT =
@@ -50,10 +68,6 @@ public class OrchestrationAiModel {
5068 public static final OrchestrationAiModel CLAUDE_3_5_SONNET =
5169 new OrchestrationAiModel ("anthropic--claude-3.5-sonnet" );
5270
53- /** Amazon Titan Embed Text model */
54- public static final OrchestrationAiModel TITAN_EMBED_TEXT =
55- new OrchestrationAiModel ("amazon--titan-embed-text" );
56-
5771 /** Amazon Titan Text Lite model */
5872 public static final OrchestrationAiModel TITAN_TEXT_LITE =
5973 new OrchestrationAiModel ("amazon--titan-text-lite" );
@@ -75,38 +89,12 @@ public class OrchestrationAiModel {
7589 /** Azure OpenAI GPT-4-32k chat completions model */
7690 public static final OrchestrationAiModel GPT_4_32K = new OrchestrationAiModel ("gpt-4-32k" );
7791
78- /** Azure OpenAI Text Embedding Ada 002 model */
79- public static final OrchestrationAiModel TEXT_EMBEDDING_ADA_002 =
80- new OrchestrationAiModel ("text-embedding-ada-002" );
81-
82- /** Azure OpenAI Text Embedding 3 Small model */
83- public static final OrchestrationAiModel TEXT_EMBEDDING_3_SMALL =
84- new OrchestrationAiModel ("text-embedding-3-small" );
85-
86- /** Azure OpenAI Text Embedding 3 Large model */
87- public static final OrchestrationAiModel TEXT_EMBEDDING_3_LARGE =
88- new OrchestrationAiModel ("text-embedding-3-large" );
89-
9092 /** Azure OpenAI GPT-4o chat completions model */
9193 public static final OrchestrationAiModel GPT_4O = new OrchestrationAiModel ("gpt-4o" );
9294
9395 /** Azure OpenAI GPT-4o-mini chat completions model */
9496 public static final OrchestrationAiModel GPT_4O_MINI = new OrchestrationAiModel ("gpt-4o-mini" );
9597
96- /** Google Cloud Platform Text Bison model */
97- public static final OrchestrationAiModel TEXT_BISON = new OrchestrationAiModel ("text-bison" );
98-
99- /** Google Cloud Platform Chat Bison model */
100- public static final OrchestrationAiModel CHAT_BISON = new OrchestrationAiModel ("chat-bison" );
101-
102- /** Google Cloud Platform Text Embedding Gecko model */
103- public static final OrchestrationAiModel TEXT_EMBEDDING_GECKO =
104- new OrchestrationAiModel ("textembedding-gecko" );
105-
106- /** Google Cloud Platform Text Embedding Gecko Multilingual model */
107- public static final OrchestrationAiModel TEXT_EMBEDDING_GECKO_MULTILINGUAL =
108- new OrchestrationAiModel ("textembedding-gecko-multilingual" );
109-
11098 /** Google Cloud Platform Gemini 1.0 Pro model */
11199 public static final OrchestrationAiModel GEMINI_1_0_PRO =
112100 new OrchestrationAiModel ("gemini-1.0-pro" );
@@ -120,50 +108,28 @@ public class OrchestrationAiModel {
120108 new OrchestrationAiModel ("gemini-1.5-flash" );
121109
122110 OrchestrationAiModel (@ Nonnull final String modelName ) {
123- config = new LLMModuleConfig (). modelName ( modelName ). modelParams ( Map . of ()) ;
111+ this . modelName = modelName ;
124112 }
125113
126- /**
127- * Set model version on this model.
128- *
129- * <pre>{@code
130- * .modelVersion("latest")
131- * }</pre>
132- *
133- * @param version The new version.
134- * @return New instance of this class with new version.
135- */
136114 @ Nonnull
137- public OrchestrationAiModel modelVersion (@ Nonnull final String version ) {
138- return new OrchestrationAiModel (
139- new LLMModuleConfig ()
140- .modelVersion (version )
141- .modelParams (config .getModelParams ())
142- .modelName (config .getModelName ()));
115+ LLMModuleConfig createConfig () {
116+ return new LLMModuleConfig ()
117+ .modelName (modelName )
118+ .modelParams (modelParams )
119+ .modelVersion (modelVersion );
143120 }
144121
145- /**
146- * Set model parameters on this model.
147- *
148- * <pre>{@code
149- * .modelParams(
150- * Map.of(
151- * "max_tokens", 50,
152- * "temperature", 0.1,
153- * "frequency_penalty", 0,
154- * "presence_penalty", 0));
155- * }</pre>
156- *
157- * @param modelParams Map of parameters.
158- * @return New instance of this class.
159- */
122+ /** {@inheritDoc} */
160123 @ Nonnull
161- public OrchestrationAiModel modelParams (
162- @ Nonnull final Map <String , ? extends Number > modelParams ) {
163- return new OrchestrationAiModel (
164- new LLMModuleConfig ()
165- .modelVersion (config .getModelVersion ())
166- .modelParams (modelParams )
167- .modelName (config .getModelName ()));
124+ @ Override
125+ public String name () {
126+ return modelName ;
127+ }
128+
129+ /** {@inheritDoc} */
130+ @ Nullable
131+ @ Override
132+ public String version () {
133+ return modelVersion ;
168134 }
169135}
0 commit comments