Skip to content

Commit 0c6924b

Browse files
HenryHengZJyau-wd
andauthored
Feat/Reasoning Support, Migrate LangChain to v1, Upgrade AI SDKs and Models (#5893)
* update langchain and all related scoped packages to v1, deprecate agents and llms, rename and upgrade chat models * add reasoning capability to Agent and LLM * add token cost to usageMetadata * update azure and chat openai * restore executable permission for husky pre-commit hook * refactor(agentflow): implement extractResponseContent utility for consistent response handling - Introduced extractResponseContent function to streamline response content extraction across various components. - Updated multiple files to utilize the new utility, enhancing code readability and maintainability. - Adjusted model configurations and added new parameters for Gemini models to improve functionality. * added a mock implementation for the logger in the URL security utilities test file to isolate tests and improve reliability. * chore: update package.json and pnpm-lock.yaml to add uuid dependency and mock multer-azure-blob-storage in Jest config - Added uuid dependency with version 10.0.0 and request>uuid with version 3.4.0 in package.json. - Updated pnpm-lock.yaml to reflect the new uuid dependency and its deprecation notice. - Modified Jest configuration to mock multer-azure-blob-storage to avoid module resolution issues with uuid/v4. * gpt 5.4 models * - Changed the stream conversion method in convertTextToSpeechStream to utilize Readable.fromWeb, enhancing compatibility with web streams. - Added '/api/v1/chatmessage/abort' to the WHITELIST_URLS array to allow for aborting chat messages in the API. * - Refactors how agentflow nodes (Agent, ConditionAgent, LLM) handle images in chat messages so that base64 is only used during model invocation - Storage and chat history keep file references only - Added comprehensive test cases to ensure correct handling of base64 image data and file references * fix unit test * implement filename sanitization to prevent path traversal vulnerabilities * fix(validator): normalize backslashes in file names for cross-platform compatibility * updated utils to process messages with images, converting stored-file references to base64 for model invocation, and implement interfaces * add sanitization to unwanted keys when processing images * add uuid to components package.json * move allow image uploads params on chat models * add encodingformat to openai embeddings * Refactor output parsing for reasoning models * Update ConditionAgent to version 2.0, refactor system prompt handling, and enhance message preparation logic * add claude settings local json to gitignore * remove claude settings local json --------- Co-authored-by: yau-wd <yau.ong@workday.com>
1 parent 9e92d60 commit 0c6924b

281 files changed

Lines changed: 7622 additions & 6176 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,7 @@ extensions/
114114
# Only allow apps/oss-app, ignore all other apps
115115
apps/*/
116116
!apps/oss-app/
117+
118+
# Claude - session/user specific files
119+
.claude/plans/
120+
.claude/settings.local.json

package.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,20 +86,24 @@
8686
"unset-value": "2.0.1",
8787
"webpack-dev-middleware": "7.4.2",
8888
"ws": "8.18.3",
89-
"xlsx": "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz"
89+
"xlsx": "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz",
90+
"uuid": "^10.0.0",
91+
"request>uuid": "^3.4.0"
9092
}
9193
},
9294
"engines": {
9395
"node": ">=18.15.0 <19.0.0 || ^20",
9496
"pnpm": "^10.26.0"
9597
},
9698
"resolutions": {
99+
"@anthropic-ai/sdk": "^0.73.0",
97100
"@google/generative-ai": "^0.24.0",
98101
"@grpc/grpc-js": "^1.10.10",
99-
"@langchain/core": "0.3.61",
102+
"@langchain/core": "1.1.20",
100103
"@qdrant/openapi-typescript-fetch": "1.2.6",
101-
"openai": "4.96.0",
102-
"protobufjs": "7.4.0"
104+
"openai": "6.19.0",
105+
"protobufjs": "7.4.0",
106+
"uuid": "^10.0.0"
103107
},
104108
"eslintIgnore": [
105109
"**/dist",

packages/agentflow/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
"@tabler/icons-react": "^3.7.0",
7272
"axios": "^1.7.2",
7373
"lodash": "^4.17.21",
74-
"uuid": "^9.0.1"
74+
"uuid": "^10.0.0"
7575
},
7676
"devDependencies": {
7777
"@testing-library/jest-dom": "^6.6.3",
@@ -81,7 +81,6 @@
8181
"@types/lodash": "^4.14.195",
8282
"@types/react": "^18.2.0",
8383
"@types/react-dom": "^18.2.0",
84-
"@types/uuid": "^9.0.0",
8584
"@typescript-eslint/eslint-plugin": "^8.18.2",
8685
"@typescript-eslint/parser": "^8.18.2",
8786
"@vitejs/plugin-react": "^4.2.0",

packages/components/credentials/AzureOpenAIApi.credential.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ class AzureOpenAIApi implements INodeCredential {
3636
label: 'Azure OpenAI Api Version',
3737
name: 'azureOpenAIApiVersion',
3838
type: 'string',
39-
placeholder: '2023-06-01-preview',
39+
placeholder: '2024-10-21',
4040
description:
41-
'Description of Supported API Versions. Please refer <a target="_blank" href="https://learn.microsoft.com/en-us/azure/cognitive-services/openai/reference#chat-completions">examples</a>'
41+
'Description of Supported API Versions. Please refer <a target="_blank" href="https://learn.microsoft.com/en-us/azure/ai-foundry/openai/api-version-lifecycle">API version lifecycle</a>'
4242
}
4343
]
4444
}

packages/components/jest.config.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ module.exports = {
1717
// use these imports, so stubbing them out is safe.
1818
// Note: @langchain/core is NOT stubbed here because it ships CJS builds
1919
// (e.g. tools.cjs) that Jest can require() normally.
20-
'^@modelcontextprotocol/sdk/(.*)$': '<rootDir>/test/__mocks__/esm-stub.js'
20+
'^@modelcontextprotocol/sdk/(.*)$': '<rootDir>/test/__mocks__/esm-stub.js',
21+
// multer-azure-blob-storage transitively pulls in azure-storage -> request@2.88.2 -> uuid/v4.
22+
// The uuid/v4 sub-path no longer exists in modern uuid versions, breaking module resolution.
23+
// Tests don't exercise Azure storage, so stubbing it out avoids the chain entirely.
24+
'^multer-azure-blob-storage$': '<rootDir>/test/__mocks__/esm-stub.js'
2125
}
2226
}

packages/components/models.json

Lines changed: 118 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,20 @@
33
{
44
"name": "awsChatBedrock",
55
"models": [
6+
{
7+
"label": "anthropic.claude-opus-4-6-v1",
8+
"name": "anthropic.claude-opus-4-6-v1",
9+
"description": "Claude 4.6 Opus",
10+
"input_cost": 0.000005,
11+
"output_cost": 0.000025
12+
},
13+
{
14+
"label": "anthropic.claude-sonnet-4-6",
15+
"name": "anthropic.claude-sonnet-4-6",
16+
"description": "Claude 4.6 Sonnet",
17+
"input_cost": 0.000003,
18+
"output_cost": 0.000015
19+
},
620
{
721
"label": "anthropic.claude-opus-4-5-20251101-v1:0",
822
"name": "anthropic.claude-opus-4-5-20251101-v1:0",
@@ -382,6 +396,30 @@
382396
"input_cost": 1.1e-6,
383397
"output_cost": 4.4e-6
384398
},
399+
{
400+
"label": "o3",
401+
"name": "o3",
402+
"input_cost": 2e-6,
403+
"output_cost": 8e-6
404+
},
405+
{
406+
"label": "o3-pro",
407+
"name": "o3-pro",
408+
"input_cost": 2e-5,
409+
"output_cost": 8e-5
410+
},
411+
{
412+
"label": "o4-mini",
413+
"name": "o4-mini",
414+
"input_cost": 1.1e-6,
415+
"output_cost": 4.4e-6
416+
},
417+
{
418+
"label": "codex-mini",
419+
"name": "codex-mini",
420+
"input_cost": 1.5e-6,
421+
"output_cost": 6e-6
422+
},
385423
{
386424
"label": "o1",
387425
"name": "o1",
@@ -454,6 +492,18 @@
454492
"input_cost": 0.0000004,
455493
"output_cost": 0.0000016
456494
},
495+
{
496+
"label": "gpt-4.1-nano",
497+
"name": "gpt-4.1-nano",
498+
"input_cost": 1e-7,
499+
"output_cost": 4e-7
500+
},
501+
{
502+
"label": "gpt-5-pro",
503+
"name": "gpt-5-pro",
504+
"input_cost": 2.1e-5,
505+
"output_cost": 1.68e-4
506+
},
457507
{
458508
"label": "gpt-5-chat-latest",
459509
"name": "gpt-5-chat-latest",
@@ -536,6 +586,20 @@
536586
{
537587
"name": "chatAnthropic",
538588
"models": [
589+
{
590+
"label": "claude-opus-4-6",
591+
"name": "claude-opus-4-6",
592+
"description": "Claude 4.6 Opus",
593+
"input_cost": 0.000005,
594+
"output_cost": 0.000025
595+
},
596+
{
597+
"label": "claude-sonnet-4-6",
598+
"name": "claude-sonnet-4-6",
599+
"description": "Claude 4.6 Sonnet",
600+
"input_cost": 0.000003,
601+
"output_cost": 0.000015
602+
},
539603
{
540604
"label": "claude-opus-4-5",
541605
"name": "claude-opus-4-5",
@@ -666,11 +730,23 @@
666730
"name": "chatGoogleGenerativeAI",
667731
"models": [
668732
{
669-
"label": "gemini-3-pro-preview",
670-
"name": "gemini-3-pro-preview",
733+
"label": "gemini-3.1-pro-preview",
734+
"name": "gemini-3.1-pro-preview",
671735
"input_cost": 0.00002,
672736
"output_cost": 0.00012
673737
},
738+
{
739+
"label": "gemini-3.1-flash-lite-preview",
740+
"name": "gemini-3.1-flash-lite-preview",
741+
"input_cost": 0.00000025,
742+
"output_cost": 0.0000015
743+
},
744+
{
745+
"label": "gemini-3.1-flash-image-preview",
746+
"name": "gemini-3.1-flash-image-preview",
747+
"input_cost": 0.00000025,
748+
"output_cost": 0.000067
749+
},
674750
{
675751
"label": "gemini-3-flash-preview",
676752
"name": "gemini-3-flash-preview",
@@ -754,11 +830,17 @@
754830
"name": "chatGoogleVertexAI",
755831
"models": [
756832
{
757-
"label": "gemini-3-pro-preview",
758-
"name": "gemini-3-pro-preview",
833+
"label": "gemini-3.1-pro-preview",
834+
"name": "gemini-3.1-pro-preview",
759835
"input_cost": 0.00002,
760836
"output_cost": 0.00012
761837
},
838+
{
839+
"label": "gemini-3.1-flash-lite-preview",
840+
"name": "gemini-3.1-flash-lite-preview",
841+
"input_cost": 0.00000025,
842+
"output_cost": 0.0000015
843+
},
762844
{
763845
"label": "gemini-3-flash-preview",
764846
"name": "gemini-3-flash-preview",
@@ -831,6 +913,20 @@
831913
"input_cost": 1.25e-7,
832914
"output_cost": 3.75e-7
833915
},
916+
{
917+
"label": "claude-opus-4-6",
918+
"name": "claude-opus-4-6",
919+
"description": "Claude 4.6 Opus",
920+
"input_cost": 0.000005,
921+
"output_cost": 0.000025
922+
},
923+
{
924+
"label": "claude-sonnet-4-6",
925+
"name": "claude-sonnet-4-6",
926+
"description": "Claude 4.6 Sonnet",
927+
"input_cost": 0.000003,
928+
"output_cost": 0.000015
929+
},
834930
{
835931
"label": "claude-opus-4-5@20251101",
836932
"name": "claude-opus-4-5@20251101",
@@ -1137,6 +1233,18 @@
11371233
{
11381234
"name": "chatOpenAI",
11391235
"models": [
1236+
{
1237+
"label": "gpt-5.4",
1238+
"name": "gpt-5.4",
1239+
"input_cost": 0.0000025,
1240+
"output_cost": 0.000015
1241+
},
1242+
{
1243+
"label": "gpt-5.4-pro",
1244+
"name": "gpt-5.4-pro",
1245+
"input_cost": 0.00003,
1246+
"output_cost": 0.00018
1247+
},
11401248
{
11411249
"label": "gpt-5.2",
11421250
"name": "gpt-5.2",
@@ -1245,6 +1353,12 @@
12451353
"input_cost": 2.5e-6,
12461354
"output_cost": 0.00001
12471355
},
1356+
{
1357+
"label": "o4-mini (latest)",
1358+
"name": "o4-mini",
1359+
"input_cost": 1.5e-7,
1360+
"output_cost": 6e-7
1361+
},
12481362
{
12491363
"label": "o3-mini (latest)",
12501364
"name": "o3-mini",
@@ -1376,12 +1490,6 @@
13761490
"name": "gpt-3.5-turbo-16k-0613",
13771491
"input_cost": 0.000003,
13781492
"output_cost": 0.000004
1379-
},
1380-
{
1381-
"label": "o4-mini",
1382-
"name": "o4-mini",
1383-
"input_cost": 1.5e-7,
1384-
"output_cost": 6e-7
13851493
}
13861494
]
13871495
},

0 commit comments

Comments
 (0)