Skip to content
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
5 changes: 5 additions & 0 deletions .changeset/bold-towns-start.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sap-ai-sdk/langchain': minor
---

[Compatibility Note] Remove structured ouput handling for deprecated gpt-4 & gpt-3 models
6 changes: 6 additions & 0 deletions .changeset/curly-drinks-taste.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@sap-ai-sdk/orchestration': minor
'@sap-ai-sdk/core': minor
---

[Improvement] Add `cohere--command-a-reasoning`, `mistralai--mistral-medium-instruct` and perplexity-ai `sonar` and `sonar-pro` to model list
3 changes: 2 additions & 1 deletion packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export type {
AzureOpenAiEmbeddingModel,
GcpVertexAiChatModel,
AwsBedrockChatModel,
AiCoreOpenSourceChatModel
AiCoreOpenSourceChatModel,
PerplexityChatModel
} from './model-types.js';
export { SseStream, LineDecoder, SSEDecoder } from './stream/index.js';
10 changes: 9 additions & 1 deletion packages/core/src/model-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,17 @@ export type AwsBedrockChatModel = LiteralUnion<
| 'amazon--nova-premier'
>;

/**
* Perplexity models for chat completion.
*/
export type PerplexityChatModel = LiteralUnion<'sonar' | 'sonar-pro'>;

/**
* AI Core open source models for chat completion.
*/
export type AiCoreOpenSourceChatModel = LiteralUnion<
'mistralai--mistral-large-instruct' | 'mistralai--mistral-small-instruct'
| 'cohere--command-a-reasoning'
Copy link
Contributor

Choose a reason for hiding this comment

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

[q/req] Are you sure we can use this in orchestration? I tried it out, still 400 not supported.

Copy link
Member Author

Choose a reason for hiding this comment

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

It worked in Bruno with one of the orchestration presets for me.

| 'mistralai--mistral-large-instruct'
| 'mistralai--mistral-medium-instruct'
| 'mistralai--mistral-small-instruct'
>;
14 changes: 0 additions & 14 deletions packages/langchain/src/openai/chat.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,20 +259,6 @@ describe('Chat client', () => {
);
});

it('should use `functionCalling` for older deprecated models', async () => {
const oldClient = new AzureOpenAiChatClient({
modelName: 'gpt-35-turbo'
});
const spy = jest.spyOn(oldClient, 'withConfig');

oldClient.withStructuredOutput(joke);
expect(spy).toHaveBeenCalledWith(
expect.objectContaining({
tools: expect.any(Array)
})
);
});

it('should use `functionCalling` with openai function json schema', async () => {
const openAiFunctionJsonSchema: AzureOpenAiFunctionObject = {
name: 'joke',
Expand Down
14 changes: 2 additions & 12 deletions packages/langchain/src/openai/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,18 +175,8 @@ export class AzureOpenAiChatClient extends BaseChatModel<AzureOpenAiChatCallOpti
);
}

// TODO: Remove this once the deprecated models are removed
if (
!this.modelName.startsWith('gpt-3') &&
!this.modelName.startsWith('gpt-4-') &&
this.modelName !== 'gpt-4'
) {
if (method === undefined) {
method = 'jsonSchema';
}
} else if (method === 'jsonSchema') {
// Falling back to tool calling.`
method = '';
if (method === undefined) {
method = 'jsonSchema';
}

if (method === 'jsonMode') {
Expand Down
4 changes: 3 additions & 1 deletion packages/orchestration/src/model-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import type {
AiCoreOpenSourceChatModel,
AwsBedrockChatModel,
AzureOpenAiChatModel,
GcpVertexAiChatModel
GcpVertexAiChatModel,
PerplexityChatModel
} from '@sap-ai-sdk/core';

/**
Expand All @@ -12,4 +13,5 @@ export type ChatModel =
| AzureOpenAiChatModel
| GcpVertexAiChatModel
| AwsBedrockChatModel
| PerplexityChatModel
| AiCoreOpenSourceChatModel;
Loading