generated from SAP/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* intermediate * ready-to-discuss state * Fix merge; Format * Add javadoc * Fix PMD warnings * Initial change of draft * Initial API change * Fix merge conflicts * Update readme * Fix PMD * Formatting * Apply suggestions from code review Co-authored-by: Charles Dubois <[email protected]> * Defuse functions * Update core/src/main/java/com/sap/ai/sdk/core/AiCoreServiceWithDeployment.java Co-authored-by: Charles Dubois <[email protected]> * Make service binding accessor changeable, e.g. for future testing * Rename methods and types; Fix merge * Formatting * Fix code, tests are working * Fix header provisioning * Add tests; Move stuff around * make base class extensible * work in progress * refine work in progress * Fix tests * Update test * Add annotations * Format * Format; JavaDoc * Restructure code * Fix PMD * Fix PMD * Fix test * Fix test * Added model version filtering * Fix model version filtering * Apply review comments * Apply review comments * Add assertion on AI-Client-Type header * Minor JavaDoc fix * Formatting * Add unit test for model comparison * Improve test coverage * Add missing JavaDoc comments * Add missing JavaDoc comments * Formatting * Add missing JavaDoc comments * Improve coding practice * Remove duplicate anonymous classes * Accept review changes * Fix merge conflicts * Fix naming --------- Co-authored-by: Alexander Dümont <[email protected]> Co-authored-by: SAP Cloud SDK Bot <[email protected]> Co-authored-by: Alexander Dümont <[email protected]> Co-authored-by: Charles Dubois <[email protected]> Co-authored-by: Roshin Rajan Panackal <[email protected]>
- Loading branch information
1 parent
e0078c8
commit 26bc938
Showing
8 changed files
with
152 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.sap.ai.sdk.core; | ||
|
||
import javax.annotation.Nonnull; | ||
import javax.annotation.Nullable; | ||
|
||
/** An interface defining essential attributes of an AI model. */ | ||
public interface AiModel { | ||
|
||
/** | ||
* Get the model's name. | ||
* | ||
* @return The name of the model. | ||
*/ | ||
@Nonnull | ||
String name(); | ||
|
||
/** | ||
* Get the model's version. | ||
* | ||
* @return The version of the model, or null if not specified. | ||
*/ | ||
@Nullable | ||
String version(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 28 additions & 14 deletions
42
...ation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,61 @@ | ||
package com.sap.ai.sdk.foundationmodels.openai; | ||
|
||
import com.sap.ai.sdk.core.AiModel; | ||
import javax.annotation.Nonnull; | ||
import javax.annotation.Nullable; | ||
|
||
/** | ||
* Available OpenAI models. | ||
* OpenAI models that are available in AI Core. | ||
* | ||
* @param model a deployed OpenAI model | ||
* @param name The name of the model. | ||
* @param version The version of the model (optional). | ||
*/ | ||
public record OpenAiModel(@Nonnull String model) { | ||
public record OpenAiModel(@Nonnull String name, @Nullable String version) implements AiModel { | ||
|
||
/** Azure OpenAI dall-e-3 image generate model */ | ||
public static final OpenAiModel DALL_E_3 = new OpenAiModel("dall-e-3"); | ||
public static final OpenAiModel DALL_E_3 = new OpenAiModel("dall-e-3", null); | ||
|
||
/** Azure OpenAI GPT-3.5 Turbo chat completions model */ | ||
public static final OpenAiModel GPT_35_TURBO = new OpenAiModel("gpt-35-turbo"); | ||
public static final OpenAiModel GPT_35_TURBO = new OpenAiModel("gpt-35-turbo", null); | ||
|
||
/** Azure OpenAI GPT-3.5 Turbo chat completions model */ | ||
public static final OpenAiModel GPT_35_TURBO_1025 = new OpenAiModel("gpt-35-turbo-0125"); | ||
public static final OpenAiModel GPT_35_TURBO_1025 = new OpenAiModel("gpt-35-turbo-0125", null); | ||
|
||
/** Azure OpenAI GPT-3.5 Turbo chat completions model */ | ||
public static final OpenAiModel GPT_35_TURBO_16K = new OpenAiModel("gpt-35-turbo-16k"); | ||
public static final OpenAiModel GPT_35_TURBO_16K = new OpenAiModel("gpt-35-turbo-16k", null); | ||
|
||
/** Azure OpenAI GPT-4 chat completions model */ | ||
public static final OpenAiModel GPT_4 = new OpenAiModel("gpt-4"); | ||
public static final OpenAiModel GPT_4 = new OpenAiModel("gpt-4", null); | ||
|
||
/** Azure OpenAI GPT-4-32k chat completions model */ | ||
public static final OpenAiModel GPT_4_32K = new OpenAiModel("gpt-4-32k"); | ||
public static final OpenAiModel GPT_4_32K = new OpenAiModel("gpt-4-32k", null); | ||
|
||
/** Azure OpenAI GPT-4o chat completions model */ | ||
public static final OpenAiModel GPT_4O = new OpenAiModel("gpt-4o"); | ||
public static final OpenAiModel GPT_4O = new OpenAiModel("gpt-4o", null); | ||
|
||
/** Azure OpenAI GPT-4o Mini chat completions model */ | ||
public static final OpenAiModel GPT_4O_MINI = new OpenAiModel("gpt-4o-mini"); | ||
public static final OpenAiModel GPT_4O_MINI = new OpenAiModel("gpt-4o-mini", null); | ||
|
||
/** Azure OpenAI Text Embedding 3 Large model */ | ||
public static final OpenAiModel TEXT_EMBEDDING_3_LARGE = | ||
new OpenAiModel("text-embedding-3-large"); | ||
new OpenAiModel("text-embedding-3-large", null); | ||
|
||
/** Azure OpenAI Text Embedding 3 Small model */ | ||
public static final OpenAiModel TEXT_EMBEDDING_3_SMALL = | ||
new OpenAiModel("text-embedding-3-small"); | ||
new OpenAiModel("text-embedding-3-small", null); | ||
|
||
/** Azure OpenAI Text Embedding ADA 002 model */ | ||
public static final OpenAiModel TEXT_EMBEDDING_ADA_002 = | ||
new OpenAiModel("text-embedding-ada-002"); | ||
new OpenAiModel("text-embedding-ada-002", null); | ||
|
||
/** | ||
* Create a new instance of OpenAiModel with the provided version. | ||
* | ||
* @param version The version of the model. | ||
* @return The new instance of OpenAiModel. | ||
*/ | ||
@Nonnull | ||
public OpenAiModel withVersion(@Nonnull final String version) { | ||
return new OpenAiModel(name, version); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.