diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 5128a08c..3f7f55ac 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -7,10 +7,10 @@ export type { export { executeRequest } from './http-client.js'; export { getAiCoreDestination } from './context.js'; export { OpenApiRequestBuilder } from './openapi-request-builder.js'; -export type { +export { AzureOpenAiChatModel, AzureOpenAiEmbeddingModel, GcpVertexAiChatModel, AwsBedrockChatModel, - ChatModel + AiCoreOpenSourceChatModel } from './model-types.js'; diff --git a/packages/core/src/model-types.ts b/packages/core/src/model-types.ts index b42139da..65d298f1 100644 --- a/packages/core/src/model-types.ts +++ b/packages/core/src/model-types.ts @@ -9,7 +9,6 @@ export type AzureOpenAiChatModel = LiteralUnion< | 'gpt-4' | 'gpt-4-32k' | 'gpt-35-turbo' - | 'gpt-35-turbo-0125' | 'gpt-35-turbo-16k' >; @@ -24,15 +23,13 @@ export type AzureOpenAiEmbeddingModel = LiteralUnion< * 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' + 'gemini-1.0-pro' | 'gemini-1.5-pro' | 'gemini-1.5-flash' >; /** * 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' @@ -40,8 +37,8 @@ export type AwsBedrockChatModel = LiteralUnion< >; /** - * All available models for chat completion. + * AI Core open source models for chat completion. */ -export type ChatModel = LiteralUnion< - AzureOpenAiChatModel | GcpVertexAiChatModel | AwsBedrockChatModel +export type AiCoreOpenSourceChatModel = LiteralUnion< + 'mistralai--mixtral-8x7b-instruct-v01' | 'meta--llama3-70b-instruct' >; diff --git a/packages/foundation-models/src/azure-openai/azure-openai-chat-client.ts b/packages/foundation-models/src/azure-openai/azure-openai-chat-client.ts index 4ea24037..42e6357d 100644 --- a/packages/foundation-models/src/azure-openai/azure-openai-chat-client.ts +++ b/packages/foundation-models/src/azure-openai/azure-openai-chat-client.ts @@ -1,12 +1,9 @@ -import { - type CustomRequestConfig, - type AzureOpenAiChatModel, - executeRequest -} from '@sap-ai-sdk/core'; +import { type CustomRequestConfig, executeRequest } from '@sap-ai-sdk/core'; import { getDeploymentId, type ModelDeployment } from '@sap-ai-sdk/ai-api/internal.js'; +import type { AzureOpenAiChatModel } from './model-types.js'; import type { AzureOpenAiChatCompletionParameters } from './azure-openai-types.js'; import { AzureOpenAiChatCompletionResponse } from './azure-openai-response.js'; diff --git a/packages/foundation-models/src/azure-openai/azure-openai-embedding-client.ts b/packages/foundation-models/src/azure-openai/azure-openai-embedding-client.ts index 8be8b9a6..2c6fa0dd 100644 --- a/packages/foundation-models/src/azure-openai/azure-openai-embedding-client.ts +++ b/packages/foundation-models/src/azure-openai/azure-openai-embedding-client.ts @@ -1,12 +1,9 @@ -import { - type CustomRequestConfig, - type AzureOpenAiEmbeddingModel, - executeRequest -} from '@sap-ai-sdk/core'; +import { type CustomRequestConfig, executeRequest } from '@sap-ai-sdk/core'; import { getDeploymentId, type ModelDeployment } from '@sap-ai-sdk/ai-api/internal.js'; +import type { AzureOpenAiEmbeddingModel } from './model-types.js'; import type { AzureOpenAiEmbeddingParameters, AzureOpenAiEmbeddingOutput diff --git a/packages/foundation-models/src/azure-openai/index.ts b/packages/foundation-models/src/azure-openai/index.ts index fbca639e..570820b5 100644 --- a/packages/foundation-models/src/azure-openai/index.ts +++ b/packages/foundation-models/src/azure-openai/index.ts @@ -2,3 +2,4 @@ export * from './azure-openai-types.js'; export * from './azure-openai-chat-client.js'; export * from './azure-openai-embedding-client.js'; export * from './azure-openai-response.js'; +export * from './model-types.js'; diff --git a/packages/foundation-models/src/azure-openai/model-types.ts b/packages/foundation-models/src/azure-openai/model-types.ts new file mode 100644 index 00000000..defa6e8b --- /dev/null +++ b/packages/foundation-models/src/azure-openai/model-types.ts @@ -0,0 +1,14 @@ +import type { + AzureOpenAiChatModel as CoreAzureOpenAiChatModel, + AzureOpenAiEmbeddingModel as CoreAzureOpenAiEmbeddingModel +} from '@sap-ai-sdk/core'; + +/** + * Azure OpenAI models for chat completion. + */ +export type AzureOpenAiChatModel = CoreAzureOpenAiChatModel; + +/** + * Azure OpenAI models for embedding. + */ +export type AzureOpenAiEmbeddingModel = CoreAzureOpenAiEmbeddingModel; diff --git a/packages/foundation-models/src/index.ts b/packages/foundation-models/src/index.ts index 3b631cc3..95a2421d 100644 --- a/packages/foundation-models/src/index.ts +++ b/packages/foundation-models/src/index.ts @@ -24,8 +24,11 @@ export type { AzureOpenAiContentFilterResultBase, AzureOpenAiContentFilterDetectedResult, AzureOpenAiContentFilterSeverityResult, - AzureOpenAiEmbeddingOutput + AzureOpenAiEmbeddingOutput, + AzureOpenAiChatModel, + AzureOpenAiEmbeddingModel } from './azure-openai/index.js'; + export { AzureOpenAiChatClient, AzureOpenAiEmbeddingClient, diff --git a/packages/orchestration/src/index.ts b/packages/orchestration/src/index.ts index 5c5a4516..232594ac 100644 --- a/packages/orchestration/src/index.ts +++ b/packages/orchestration/src/index.ts @@ -39,3 +39,5 @@ export { OrchestrationClient } from './orchestration-client.js'; export { azureContentFilter } from './orchestration-filter-utility.js'; export { OrchestrationResponse } from './orchestration-response.js'; + +export type { ChatModel } from './model-types.js'; diff --git a/packages/orchestration/src/model-types.ts b/packages/orchestration/src/model-types.ts new file mode 100644 index 00000000..5fe9ccb4 --- /dev/null +++ b/packages/orchestration/src/model-types.ts @@ -0,0 +1,15 @@ +import { + AiCoreOpenSourceChatModel, + AwsBedrockChatModel, + AzureOpenAiChatModel, + GcpVertexAiChatModel +} from '@sap-ai-sdk/core'; + +/** + * Supported chat models for orchestration. + */ +export type ChatModel = + | Exclude + | GcpVertexAiChatModel + | AwsBedrockChatModel + | AiCoreOpenSourceChatModel; diff --git a/packages/orchestration/src/orchestration-types.ts b/packages/orchestration/src/orchestration-types.ts index aa26fb1c..ef6332d7 100644 --- a/packages/orchestration/src/orchestration-types.ts +++ b/packages/orchestration/src/orchestration-types.ts @@ -1,4 +1,4 @@ -import { ChatModel } from '@sap-ai-sdk/core'; +import { ChatModel } from './model-types.js'; import { ChatMessages, FilteringModuleConfig, diff --git a/tests/type-tests/test/azure-openai.test-d.ts b/tests/type-tests/test/azure-openai.test-d.ts index 58fd7027..93141c44 100644 --- a/tests/type-tests/test/azure-openai.test-d.ts +++ b/tests/type-tests/test/azure-openai.test-d.ts @@ -1,5 +1,6 @@ -import { expectError, expectType } from 'tsd'; +import { expectType } from 'tsd'; import { + type AzureOpenAiChatModel, AzureOpenAiChatCompletionOutput, AzureOpenAiEmbeddingOutput, AzureOpenAiChatClient, @@ -128,3 +129,6 @@ expectType>( } ) ); + +expect('custom-model'); +expect('gpt-4-32k'); diff --git a/tests/type-tests/test/model.test-d.ts b/tests/type-tests/test/model.test-d.ts deleted file mode 100644 index cdb3153b..00000000 --- a/tests/type-tests/test/model.test-d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { ChatModel, AzureOpenAiChatModel } from '@sap-ai-sdk/core'; - -expect('custom-model'); -expect('custom-model'); -expect('gpt-4-32k'); diff --git a/tests/type-tests/test/orchestration.test-d.ts b/tests/type-tests/test/orchestration.test-d.ts index 3fbcd57f..1ef64037 100644 --- a/tests/type-tests/test/orchestration.test-d.ts +++ b/tests/type-tests/test/orchestration.test-d.ts @@ -3,7 +3,8 @@ import { OrchestrationClient, CompletionPostResponse, OrchestrationResponse, - TokenUsage + TokenUsage, + ChatModel } from '@sap-ai-sdk/orchestration'; /** @@ -191,3 +192,6 @@ expectType>( } }).chatCompletion() ); + +expect('custom-model'); +expect('gemini-1.0-pro');