generated from SAP/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Orchestration LLM Config Convenience #152
Merged
Merged
Changes from 15 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
cc12f82
Added Orchestration LLM Config Convenience
CharlesDuboisSAP 8c0f088
Fixed orchestrationModelAvailability
CharlesDuboisSAP ff88704
Fixed orchestrationModelAvailability
CharlesDuboisSAP 2c89c1a
Revert "Fixed orchestrationModelAvailability"
CharlesDuboisSAP 851390d
Re-added all models, removed test
CharlesDuboisSAP 1d4a0b1
Formatting
bot-sdk-js f8fb1de
Work in progress
869e83a
Merge branch 'main' into orchestration-llm-config
0b9a107
Work in progress
3fe07db
Work in progress
50f2a78
Work in Progress.
6862111
Merge branch 'main' into orchestration-llm-config
fd29be9
Merged main branch.
1d39c23
Matthias' review
CharlesDuboisSAP 2e77d44
renaming
CharlesDuboisSAP 21f44f8
Formatting
bot-sdk-js 7d2d9dd
change
CharlesDuboisSAP f3ce345
Merge branch 'main' into orchestration-llm-config
CharlesDuboisSAP 63a15b0
2nd review
CharlesDuboisSAP 266a934
Update orchestration/src/main/java/com/sap/ai/sdk/orchestration/Orche…
MatKuhr f30922b
Formatting
bot-sdk-js 3aa6ddc
Fix
CharlesDuboisSAP 7611504
Fix
MatKuhr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
135 changes: 135 additions & 0 deletions
135
orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationAiModel.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 |
---|---|---|
@@ -0,0 +1,135 @@ | ||
package com.sap.ai.sdk.orchestration; | ||
|
||
import com.sap.ai.sdk.core.AiModel; | ||
import com.sap.ai.sdk.orchestration.client.model.LLMModuleConfig; | ||
import java.util.Map; | ||
import javax.annotation.Nonnull; | ||
import javax.annotation.Nullable; | ||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.With; | ||
|
||
/** Large language models available in Orchestration. */ | ||
Jonas-Isr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
@With | ||
@AllArgsConstructor(access = AccessLevel.PRIVATE) | ||
CharlesDuboisSAP marked this conversation as resolved.
Show resolved
Hide resolved
|
||
public class OrchestrationAiModel implements AiModel { | ||
/** The name of the model */ | ||
private String modelName; | ||
CharlesDuboisSAP marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
/** The version of the model, defaults to "latest". */ | ||
private String modelVersion = "latest"; | ||
|
||
/** | ||
* Optional parameters on this model. | ||
* | ||
* <pre>{@code | ||
* Map.of( | ||
* "max_tokens", 50, | ||
* "temperature", 0.1, | ||
* "frequency_penalty", 0, | ||
* "presence_penalty", 0) | ||
* }</pre> | ||
*/ | ||
private Map<String, Object> modelParams; | ||
CharlesDuboisSAP marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
/** IBM Granite 13B chat completions model */ | ||
public static final OrchestrationAiModel IBM_GRANITE_13B_CHAT = | ||
new OrchestrationAiModel("ibm--granite-13b-chat"); | ||
|
||
/** MistralAI Mistral Large Instruct model */ | ||
public static final OrchestrationAiModel MISTRAL_LARGE_INSTRUCT = | ||
new OrchestrationAiModel("mistralai--mistral-large-instruct"); | ||
|
||
/** MistralAI Mixtral 8x7B Instruct v01 model */ | ||
public static final OrchestrationAiModel MIXTRAL_8X7B_INSTRUCT_V01 = | ||
new OrchestrationAiModel("mistralai--mixtral-8x7b-instruct-v01"); | ||
|
||
/** Meta Llama3 70B Instruct model */ | ||
public static final OrchestrationAiModel LLAMA3_70B_INSTRUCT = | ||
new OrchestrationAiModel("meta--llama3-70b-instruct"); | ||
|
||
/** Meta Llama3.1 70B Instruct model */ | ||
public static final OrchestrationAiModel LLAMA3_1_70B_INSTRUCT = | ||
new OrchestrationAiModel("meta--llama3.1-70b-instruct"); | ||
|
||
/** Anthropic Claude 3 Sonnet model */ | ||
public static final OrchestrationAiModel CLAUDE_3_SONNET = | ||
new OrchestrationAiModel("anthropic--claude-3-sonnet"); | ||
|
||
/** Anthropic Claude 3 Haiku model */ | ||
public static final OrchestrationAiModel CLAUDE_3_HAIKU = | ||
new OrchestrationAiModel("anthropic--claude-3-haiku"); | ||
|
||
/** Anthropic Claude 3 Opus model */ | ||
public static final OrchestrationAiModel CLAUDE_3_OPUS = | ||
new OrchestrationAiModel("anthropic--claude-3-opus"); | ||
|
||
/** Anthropic Claude 3.5 Sonnet model */ | ||
public static final OrchestrationAiModel CLAUDE_3_5_SONNET = | ||
new OrchestrationAiModel("anthropic--claude-3.5-sonnet"); | ||
|
||
/** Amazon Titan Text Lite model */ | ||
public static final OrchestrationAiModel TITAN_TEXT_LITE = | ||
new OrchestrationAiModel("amazon--titan-text-lite"); | ||
|
||
/** Amazon Titan Text Express model */ | ||
public static final OrchestrationAiModel TITAN_TEXT_EXPRESS = | ||
new OrchestrationAiModel("amazon--titan-text-express"); | ||
|
||
/** Azure OpenAI GPT-3.5 Turbo chat completions model */ | ||
public static final OrchestrationAiModel GPT_35_TURBO = new OrchestrationAiModel("gpt-35-turbo"); | ||
|
||
/** Azure OpenAI GPT-3.5 Turbo chat completions model */ | ||
public static final OrchestrationAiModel GPT_35_TURBO_16K = | ||
new OrchestrationAiModel("gpt-35-turbo-16k"); | ||
|
||
/** Azure OpenAI GPT-4 chat completions model */ | ||
public static final OrchestrationAiModel GPT_4 = new OrchestrationAiModel("gpt-4"); | ||
|
||
/** Azure OpenAI GPT-4-32k chat completions model */ | ||
public static final OrchestrationAiModel GPT_4_32K = new OrchestrationAiModel("gpt-4-32k"); | ||
|
||
/** Azure OpenAI GPT-4o chat completions model */ | ||
public static final OrchestrationAiModel GPT_4O = new OrchestrationAiModel("gpt-4o"); | ||
|
||
/** Azure OpenAI GPT-4o-mini chat completions model */ | ||
public static final OrchestrationAiModel GPT_4O_MINI = new OrchestrationAiModel("gpt-4o-mini"); | ||
|
||
/** Google Cloud Platform Gemini 1.0 Pro model */ | ||
public static final OrchestrationAiModel GEMINI_1_0_PRO = | ||
new OrchestrationAiModel("gemini-1.0-pro"); | ||
|
||
/** Google Cloud Platform Gemini 1.5 Pro model */ | ||
public static final OrchestrationAiModel GEMINI_1_5_PRO = | ||
new OrchestrationAiModel("gemini-1.5-pro"); | ||
|
||
/** Google Cloud Platform Gemini 1.5 Flash model */ | ||
public static final OrchestrationAiModel GEMINI_1_5_FLASH = | ||
new OrchestrationAiModel("gemini-1.5-flash"); | ||
|
||
OrchestrationAiModel(@Nonnull final String modelName) { | ||
newtork marked this conversation as resolved.
Show resolved
Hide resolved
|
||
this.modelName = modelName; | ||
} | ||
|
||
@Nonnull | ||
LLMModuleConfig createConfig() { | ||
return new LLMModuleConfig() | ||
.modelName(modelName) | ||
.modelParams(modelParams) | ||
CharlesDuboisSAP marked this conversation as resolved.
Show resolved
Hide resolved
|
||
.modelVersion(modelVersion); | ||
} | ||
|
||
/** {@inheritDoc} */ | ||
CharlesDuboisSAP marked this conversation as resolved.
Show resolved
Hide resolved
|
||
@Nonnull | ||
@Override | ||
public String name() { | ||
return modelName; | ||
} | ||
|
||
/** {@inheritDoc} */ | ||
CharlesDuboisSAP marked this conversation as resolved.
Show resolved
Hide resolved
|
||
@Nullable | ||
CharlesDuboisSAP marked this conversation as resolved.
Show resolved
Hide resolved
|
||
@Override | ||
public String version() { | ||
return modelVersion; | ||
} | ||
} |
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
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Minor/Question)
Could/should we shorten the method names...?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can discuss here:
#170