Skip to content

Commit 309ae88

Browse files
authored
Merge branch 'main' into spec-update/ai-api/main
2 parents e455cf5 + 6100bca commit 309ae88

File tree

11 files changed

+471
-430
lines changed

11 files changed

+471
-430
lines changed

.changeset/bold-towns-start.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@sap-ai-sdk/langchain': minor
3+
---
4+
5+
[Compatibility Note] Remove structured ouput handling for deprecated gpt-4 & gpt-3 models

.changeset/curly-drinks-taste.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@sap-ai-sdk/orchestration': minor
3+
'@sap-ai-sdk/core': minor
4+
---
5+
6+
[Improvement] Add `cohere--command-a-reasoning`, `mistralai--mistral-medium-instruct` and perplexity-ai `sonar` and `sonar-pro` to model list

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@
5151
"@types/jest": "^30.0.0",
5252
"@types/jsonwebtoken": "^9.0.10",
5353
"@types/mock-fs": "^4.13.4",
54-
"@types/node": "^22.18.13",
54+
"@types/node": "^22.19.0",
5555
"depcheck": "^1.4.7",
56-
"eslint": "^9.38.0",
56+
"eslint": "^9.39.1",
5757
"glob": "^11.0.3",
5858
"jest": "^30.2.0",
5959
"jsonwebtoken": "^9.0.2",

packages/core/src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export type {
77
AzureOpenAiEmbeddingModel,
88
GcpVertexAiChatModel,
99
AwsBedrockChatModel,
10-
AiCoreOpenSourceChatModel
10+
AiCoreOpenSourceChatModel,
11+
PerplexityChatModel
1112
} from './model-types.js';
1213
export { SseStream, LineDecoder, SSEDecoder } from './stream/index.js';

packages/core/src/model-types.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,17 @@ export type AwsBedrockChatModel = LiteralUnion<
5252
| 'amazon--nova-premier'
5353
>;
5454

55+
/**
56+
* Perplexity models for chat completion.
57+
*/
58+
export type PerplexityChatModel = LiteralUnion<'sonar' | 'sonar-pro'>;
59+
5560
/**
5661
* AI Core open source models for chat completion.
5762
*/
5863
export type AiCoreOpenSourceChatModel = LiteralUnion<
59-
'mistralai--mistral-large-instruct' | 'mistralai--mistral-small-instruct'
64+
| 'cohere--command-a-reasoning'
65+
| 'mistralai--mistral-large-instruct'
66+
| 'mistralai--mistral-medium-instruct'
67+
| 'mistralai--mistral-small-instruct'
6068
>;

packages/langchain/src/openai/chat.test.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -259,20 +259,6 @@ describe('Chat client', () => {
259259
);
260260
});
261261

262-
it('should use `functionCalling` for older deprecated models', async () => {
263-
const oldClient = new AzureOpenAiChatClient({
264-
modelName: 'gpt-35-turbo'
265-
});
266-
const spy = jest.spyOn(oldClient, 'withConfig');
267-
268-
oldClient.withStructuredOutput(joke);
269-
expect(spy).toHaveBeenCalledWith(
270-
expect.objectContaining({
271-
tools: expect.any(Array)
272-
})
273-
);
274-
});
275-
276262
it('should use `functionCalling` with openai function json schema', async () => {
277263
const openAiFunctionJsonSchema: AzureOpenAiFunctionObject = {
278264
name: 'joke',

packages/langchain/src/openai/chat.ts

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -175,18 +175,8 @@ export class AzureOpenAiChatClient extends BaseChatModel<AzureOpenAiChatCallOpti
175175
);
176176
}
177177

178-
// TODO: Remove this once the deprecated models are removed
179-
if (
180-
!this.modelName.startsWith('gpt-3') &&
181-
!this.modelName.startsWith('gpt-4-') &&
182-
this.modelName !== 'gpt-4'
183-
) {
184-
if (method === undefined) {
185-
method = 'jsonSchema';
186-
}
187-
} else if (method === 'jsonSchema') {
188-
// Falling back to tool calling.`
189-
method = '';
178+
if (method === undefined) {
179+
method = 'jsonSchema';
190180
}
191181

192182
if (method === 'jsonMode') {

packages/orchestration/src/model-types.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import type {
22
AiCoreOpenSourceChatModel,
33
AwsBedrockChatModel,
44
AzureOpenAiChatModel,
5-
GcpVertexAiChatModel
5+
GcpVertexAiChatModel,
6+
PerplexityChatModel
67
} from '@sap-ai-sdk/core';
78

89
/**
@@ -12,4 +13,5 @@ export type ChatModel =
1213
| AzureOpenAiChatModel
1314
| GcpVertexAiChatModel
1415
| AwsBedrockChatModel
16+
| PerplexityChatModel
1517
| AiCoreOpenSourceChatModel;

0 commit comments

Comments
 (0)