Skip to content
Open
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
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@
"check:deps": "pnpm -r -F !./tests/smoke-tests -F !./tests/schema-tests -F !./sample-cap exec depcheck --ignores=\"nock,@jest/globals\" --quiet"
},
"devDependencies": {
"ts-to-zod": "^3.15.0",
"zod": "^3.25.76",
"zod": "^4.0.5",
"@changesets/cli": "^2.29.5",
"@jest/globals": "^30.0.4",
"@sap-ai-sdk/ai-api": "workspace:^",
Expand Down
2 changes: 1 addition & 1 deletion packages/langchain/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@
"@sap-cloud-sdk/connectivity": "^4.0.2",
"uuid": "^11.1.0",
"@langchain/core": "0.3.62",
"zod": "^3.25.76"
"zod": "^4.0.5"
Copy link
Contributor

@deekshas8 deekshas8 Jul 15, 2025

Choose a reason for hiding this comment

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

[q] I am confused, so we now use a mix of v4 and v3?

Copy link
Contributor

@ZhongpinWang ZhongpinWang Jul 15, 2025

Choose a reason for hiding this comment

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

We kind like have to. Let me explain this complex story:

In #837 , zod-to-json-schema failed the pipeline with minor updates from zod v3. We could either stop updating zod and wait for zod-to-json-schema, or adopt zod/v4 (by importing from zod/v4 in zod v3) as it has native support for zod to json. But since zod v4 has native support for this zod to json feature, I don't think zod-to-json-schema will be actively continued anymore.

Thus, the decision was to use zod/v4 (in zod v3).

Recently, zod officially released v4 (we can import directly from zod instead of zod/v4 from v3), we have this dependabot PR. But ts-to-zod again doesn't work with zod v4. At this point, we can either mix zod versions as they are used independently for different purposes in our overall project, or remove ts-to-zod in favour of supporting zod v4 fully, but I am not sure if we find a good alternative for ts-to-zod.

WDY think? I would hope eventually ts-to-zod will support zod v4, but no clear evidence that this will actually happen. In a worst case scenario, we eventually need to drop ts-to-zod.

Copy link
Contributor

Choose a reason for hiding this comment

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

A potential good replacement could be https://orval.dev/guides/zod

Copy link
Contributor

Choose a reason for hiding this comment

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

So even with the latest version we still have access to zod/v3 and updating imports like below works.
import { z } from 'zod/v3';
In the end, I don't have a strong opinion on if we use zod/v3 or the old dependency. However if we're pinning major versions for certain packages, then we'll probably need to ignore the updates in dependabot?

Copy link
Contributor

Choose a reason for hiding this comment

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

Good to know that we can use zod/v3! Maybe I go with this option for now and in the BLI we look for alternatives.

}
}
2 changes: 1 addition & 1 deletion packages/langchain/src/openai/util.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
SystemMessage,
ToolMessage
} from '@langchain/core/messages';
import * as z from 'zod/v4';
import * as z from 'zod';
import { tool } from '@langchain/core/tools';
import { parseMockResponse } from '../../../../test-util/mock-http.js';
import {
Expand Down
3 changes: 1 addition & 2 deletions packages/langchain/src/openai/util.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { AIMessage, AIMessageChunk } from '@langchain/core/messages';
// eslint-disable-next-line import/no-internal-modules
import * as z from 'zod/v4';
import * as z from 'zod';
import { v4 as uuidv4 } from 'uuid';
import { isZodSchemaV4 } from '@langchain/core/utils/types';
import type { ToolCall, ToolCallChunk } from '@langchain/core/messages/tool';
Expand Down
3 changes: 1 addition & 2 deletions packages/langchain/src/orchestration/util.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { v4 as uuidv4 } from 'uuid';
import { isZodSchemaV4 } from '@langchain/core/utils/types';
// eslint-disable-next-line import/no-internal-modules
import * as z from 'zod/v4';
import * as z from 'zod';
import { AIMessage, AIMessageChunk } from '@langchain/core/messages';
import type { ToolDefinition } from '@langchain/core/language_models/base';
import type { ChatOrchestrationToolType } from './types.js';
Expand Down
1 change: 1 addition & 0 deletions packages/prompt-registry/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
},
"dependencies": {
"@sap-ai-sdk/core": "workspace:^",
"ts-to-zod": "^3.15.0",
"zod": "^3.25.76"
}
}
Loading
Loading