Skip to content

chore: Remove deprecated models #607

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

Merged
merged 8 commits into from
Mar 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/dark-flies-try.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@sap-ai-sdk/core': minor
---

[Compatibility Note] Removed deprecated model `text-embedding-ada-002`.
Use `text-embedding-3-small` or `text-embedding-3-large` instead.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Setup your SAP AI Core instance with SAP Cloud SDK for AI.
- [@sap-ai-sdk/document-grounding](#sap-ai-sdkdocument-grounding)
- [@sap-ai-sdk/prompt-registry](#sap-ai-sdkprompt-registry)
- [SAP Cloud SDK for AI Sample Project](#sap-cloud-sdk-for-ai-sample-project)
- [Deprecated Models](#deprecated-models)
- [Error Handling](#error-handling)
- [Accessing Error Information](#accessing-error-information)
- [Local Testing](#local-testing)
Expand Down Expand Up @@ -124,6 +125,17 @@ For details on prompt registry client, refer to this [document](https://github.c
We have created a sample project demonstrating the different clients' usage of the SAP Cloud SDK for AI for TypeScript/JavaScript.
The [project README](https://github.com/SAP/ai-sdk-js/blob/main/sample-code/README.md) outlines the set-up needed to build and run it locally.

## Deprecated Models

The following models are deprecated and should not be used.
Update your code to use one of the recommended replacement models.

| Model Name | Replacement |
|--------------------------|----------------------------------------------------|
| `text-embedding-ada-002` | `text-embedding-3-small`, `text-embedding-3-large` |

For more information, refer to the SAP note on [Availability of Generative AI Models](https://me.sap.com/notes/3437766).

## Error Handling

A common error scenario is `Request failed with status code STATUS_CODE` coming from `AxiosError`.
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/model-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export type AzureOpenAiChatModel = LiteralUnion<
* Azure OpenAI models for embedding.
*/
export type AzureOpenAiEmbeddingModel = LiteralUnion<
'text-embedding-ada-002' | 'text-embedding-3-small' | 'text-embedding-3-large'
'text-embedding-3-small' | 'text-embedding-3-large'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[q] A general question. Should we start removing deprecated (not retired) models already from types? If so, should we already remove other deprecated models? I would prefer we remove them now to give user some buffer to replace them before it gets permanently removed from remote service. @jjtang1985 What is your opinion?

>;

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/document-grounding/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const response = await VectorApi.createCollection(
{
title: 'ai-sdk-js-e2e',
embeddingConfig: {
modelName: 'text-embedding-ada-002'
modelName: 'text-embedding-3-small'
},
metadata: []
},
Expand Down
2 changes: 1 addition & 1 deletion packages/document-grounding/src/tests/vector-api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('vector api', () => {
{
title: 'ai-sdk-js-demo',
embeddingConfig: {
modelName: 'text-embedding-ada-002'
modelName: 'text-embedding-3-small'
},
metadata: [],
id: '7171c2b2-835b-4745-8824-ff5c7e98a416'
Expand Down
2 changes: 1 addition & 1 deletion packages/foundation-models/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ Use the `AzureOpenAiEmbeddingClient` to send embedding requests to an OpenAI mod
import { AzureOpenAiEmbeddingClient } from '@sap-ai-sdk/foundation-models';

const embeddingClient = new AzureOpenAiEmbeddingClient(
'text-embedding-ada-002'
'text-embedding-3-small'
);
const response = await embeddingClient.run({
input: 'AI is fascinating'
Expand Down
2 changes: 1 addition & 1 deletion packages/langchain/src/openai/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ const splits = await textSplitter.splitDocuments(docs);

// Initialize the embedding client
const embeddingClient = new AzureOpenAiEmbeddingClient({
modelName: 'text-embedding-ada-002'
modelName: 'text-embedding-3-small'
});

// Create a vector store from the document
Expand Down
2 changes: 1 addition & 1 deletion sample-code/src/document-grounding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export async function createCollection(): Promise<string> {
{
title: 'ai-sdk-js-e2e',
embeddingConfig: {
modelName: 'text-embedding-ada-002'
modelName: 'text-embedding-3-small'
},
metadata: []
},
Expand Down
2 changes: 1 addition & 1 deletion sample-code/src/foundation-models/azure-openai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export async function chatCompletionStream(
*/
export async function computeEmbedding(): Promise<AzureOpenAiEmbeddingResponse> {
const response = await new AzureOpenAiEmbeddingClient(
'text-embedding-ada-002'
'text-embedding-3-small'
).run({
input: 'Hello, world!'
});
Expand Down
2 changes: 1 addition & 1 deletion sample-code/src/langchain-azure-openai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export async function invokeRagChain(): Promise<string> {

// Initialize the embedding client with 0 retries for fast testing
const embeddingClient = new AzureOpenAiEmbeddingClient({
modelName: 'text-embedding-ada-002',
modelName: 'text-embedding-3-small',
maxRetries: 0
});

Expand Down
6 changes: 3 additions & 3 deletions tests/type-tests/test/azure-openai.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ expectType<Promise<AzureOpenAiChatCompletionResponse>>(
*/

expectType<Promise<AzureOpenAiEmbeddingResponse>>(
new AzureOpenAiEmbeddingClient('text-embedding-ada-002').run({
new AzureOpenAiEmbeddingClient('text-embedding-3-small').run({
input: 'test input'
})
);
Expand All @@ -136,7 +136,7 @@ expectType<AzureOpenAiEmbeddingClient>(
* Embeddings with optional parameters.
*/
expectType<Promise<AzureOpenAiEmbeddingResponse>>(
new AzureOpenAiEmbeddingClient('text-embedding-ada-002').run(
new AzureOpenAiEmbeddingClient('text-embedding-3-small').run(
{
input: ['test input 1', 'test input 2'],
user: 'some-guid'
Expand All @@ -150,7 +150,7 @@ expectType<Promise<AzureOpenAiEmbeddingResponse>>(
);

expectType<Promise<AzureOpenAiEmbeddingResponse>>(
new AzureOpenAiEmbeddingClient('text-embedding-ada-002', {
new AzureOpenAiEmbeddingClient('text-embedding-3-small', {
destinationName: 'destinationName',
useCache: false
}).run({
Expand Down
Loading