generated from SAP/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Use literal string for orchestration models (#125)
* refactor: move model types into core package for reuse * feat: use literal string with custom string support for model_name in orchestration * fix: lint * fix: adapt type tests to allow custom models for openai * fix: remove useless EmbeddingModel type * fix: remove further * fix: Changes from lint --------- Co-authored-by: cloud-sdk-js <[email protected]>
- Loading branch information
1 parent
bc2de8c
commit 6f3b31e
Showing
10 changed files
with
85 additions
and
37 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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from './context.js'; | ||
export * from './http-client.js'; | ||
export * from './openapi-request-builder.js'; | ||
export * from './model-types.js'; |
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,47 @@ | ||
type LiteralUnion<T extends U, U = string> = T | (U & Record<never, never>); | ||
|
||
/** | ||
* Azure OpenAI models for chat completion. | ||
*/ | ||
export type AzureOpenAiChatModel = LiteralUnion< | ||
| 'gpt-4o-mini' | ||
| 'gpt-4o' | ||
| 'gpt-4' | ||
| 'gpt-4-32k' | ||
| 'gpt-35-turbo' | ||
| 'gpt-35-turbo-0125' | ||
| 'gpt-35-turbo-16k' | ||
>; | ||
|
||
/** | ||
* Azure OpenAI models for embedding. | ||
*/ | ||
export type AzureOpenAiEmbeddingModel = LiteralUnion< | ||
'text-embedding-ada-002' | 'text-embedding-3-small' | 'text-embedding-3-large' | ||
>; | ||
|
||
/** | ||
* GCP Vertex AI models for chat completion. | ||
*/ | ||
export type GcpVertexAiChatModel = LiteralUnion< | ||
'gemini-1.0-pro' | 'gemini-1.5-pro' | 'gemini-1.5-flash' | 'chat-bison' | ||
>; | ||
|
||
/** | ||
* AWS Bedrock models for chat completion. | ||
*/ | ||
export type AwsBedrockChatModel = LiteralUnion< | ||
| 'amazon--titan-text-express' | ||
| 'amazon--titan-text-lite' | ||
| 'anthropic--claude-3-haiku' | ||
| 'anthropic--claude-3-opus' | ||
| 'anthropic--claude-3-sonnet' | ||
| 'anthropic--claude-3.5-sonnet' | ||
>; | ||
|
||
/** | ||
* All available models for chat completion. | ||
*/ | ||
export type ChatModel = LiteralUnion< | ||
AzureOpenAiChatModel | GcpVertexAiChatModel | AwsBedrockChatModel | ||
>; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { ChatModel, AzureOpenAiChatModel } from '@sap-ai-sdk/core'; | ||
|
||
expect<ChatModel>('custom-model'); | ||
expect<AzureOpenAiChatModel>('custom-model'); | ||
expect<ChatModel>('gpt-4-32k'); |
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