Skip to content

Commit

Permalink
Drop redundant "model" method prefix (#170)
Browse files Browse the repository at this point in the history
* Initial

* Formatting

---------

Co-authored-by: Alexander Dümont <alexander_duemont@web.de>
Co-authored-by: SAP Cloud SDK Bot <cloudsdk@sap.com>
Co-authored-by: Matthias Kuhr <52661546+MatKuhr@users.noreply.github.com>
  • Loading branch information
4 people authored Nov 21, 2024
1 parent 95409ae commit bf1f491
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 18 deletions.
4 changes: 2 additions & 2 deletions docs/guides/ORCHESTRATION_CHAT_COMPLETION.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,11 @@ Change your LLM configuration to add model parameters:
```java
OrchestrationAiModel customGPT4O =
OrchestrationAiModel.GPT_4O
.withModelParams(
.withParams(
Map.of(
"max_tokens", 50,
"temperature", 0.1,
"frequency_penalty", 0,
"presence_penalty", 0))
.withModelVersion("2024-05-13");
.withVersion("2024-05-13");
```
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
@AllArgsConstructor
public class OrchestrationAiModel {
/** The name of the model */
String modelName;
String name;

/**
* Optional parameters on this model.
Expand All @@ -26,10 +26,10 @@ public class OrchestrationAiModel {
* "presence_penalty", 0)
* }</pre>
*/
Map<String, Object> modelParams;
Map<String, Object> params;

/** The version of the model, defaults to "latest". */
String modelVersion;
String version;

/** IBM Granite 13B chat completions model */
public static final OrchestrationAiModel IBM_GRANITE_13B_CHAT =
Expand Down Expand Up @@ -106,15 +106,12 @@ public class OrchestrationAiModel {
public static final OrchestrationAiModel GEMINI_1_5_FLASH =
new OrchestrationAiModel("gemini-1.5-flash");

OrchestrationAiModel(@Nonnull final String modelName) {
this(modelName, Map.of(), "latest");
OrchestrationAiModel(@Nonnull final String name) {
this(name, Map.of(), "latest");
}

@Nonnull
LLMModuleConfig createConfig() {
return new LLMModuleConfig()
.modelName(modelName)
.modelParams(modelParams)
.modelVersion(modelVersion);
return new LLMModuleConfig().modelName(name).modelParams(params).modelVersion(version);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,16 @@ void testDpiMaskingConfig() {
void testLLMConfig() {
Map<String, Object> params = Map.of("foo", "bar");
String version = "2024-05-13";
OrchestrationAiModel aiModel = GPT_4O.withModelParams(params).withModelVersion(version);
OrchestrationAiModel aiModel = GPT_4O.withParams(params).withVersion(version);
var config = new OrchestrationModuleConfig().withLlmConfig(aiModel);

assertThat(config.getLlmConfig()).isNotNull();
assertThat(config.getLlmConfig().getModelName()).isEqualTo(GPT_4O.getModelName());
assertThat(config.getLlmConfig().getModelName()).isEqualTo(GPT_4O.getName());
assertThat(config.getLlmConfig().getModelParams()).isEqualTo(params);
assertThat(config.getLlmConfig().getModelVersion()).isEqualTo(version);

assertThat(GPT_4O.getModelParams())
.withFailMessage("Static models should be unchanged")
.isEmpty();
assertThat(GPT_4O.getModelVersion())
assertThat(GPT_4O.getParams()).withFailMessage("Static models should be unchanged").isEmpty();
assertThat(GPT_4O.getVersion())
.withFailMessage("Static models should be unchanged")
.isEqualTo("latest");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
@WireMockTest
class OrchestrationUnitTest {
static final OrchestrationAiModel CUSTOM_GPT_35 =
GPT_35_TURBO_16K.withModelParams(
GPT_35_TURBO_16K.withParams(
Map.of(
"max_tokens", 50,
"temperature", 0.1,
Expand Down

0 comments on commit bf1f491

Please sign in to comment.