langgraph-ui-components 0.0.10 → 0.0.11-testing
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +3 -2
- package/dist/index.es10.js +25 -6
- package/dist/index.es10.js.map +1 -1
- package/dist/index.es100.js +131 -64
- package/dist/index.es100.js.map +1 -1
- package/dist/index.es101.js +65 -32
- package/dist/index.es101.js.map +1 -1
- package/dist/index.es102.js +34 -34
- package/dist/index.es102.js.map +1 -1
- package/dist/index.es103.js +35 -164
- package/dist/index.es103.js.map +1 -1
- package/dist/index.es104.js +156 -193
- package/dist/index.es104.js.map +1 -1
- package/dist/index.es105.js +202 -13
- package/dist/index.es105.js.map +1 -1
- package/dist/index.es106.js +13 -29
- package/dist/index.es106.js.map +1 -1
- package/dist/index.es107.js +25 -29
- package/dist/index.es107.js.map +1 -1
- package/dist/index.es108.js +24 -3147
- package/dist/index.es108.js.map +1 -1
- package/dist/index.es109.js +3151 -31
- package/dist/index.es109.js.map +1 -1
- package/dist/index.es110.js +21 -5
- package/dist/index.es110.js.map +1 -1
- package/dist/index.es111.js +64 -69
- package/dist/index.es111.js.map +1 -1
- package/dist/index.es112.js +3 -37
- package/dist/index.es112.js.map +1 -1
- package/dist/index.es113.js +16 -5
- package/dist/index.es113.js.map +1 -1
- package/dist/index.es114.js +7 -2
- package/dist/index.es114.js.map +1 -1
- package/dist/index.es115.js +2 -13
- package/dist/index.es115.js.map +1 -1
- package/dist/index.es116.js +9 -499
- package/dist/index.es116.js.map +1 -1
- package/dist/index.es117.js +501 -5
- package/dist/index.es117.js.map +1 -1
- package/dist/index.es118.js +7 -2
- package/dist/index.es118.js.map +1 -1
- package/dist/index.es119.js +2 -148
- package/dist/index.es119.js.map +1 -1
- package/dist/index.es120.js +118 -878
- package/dist/index.es120.js.map +1 -1
- package/dist/index.es121.js +877 -251
- package/dist/index.es121.js.map +1 -1
- package/dist/index.es122.js +281 -3
- package/dist/index.es122.js.map +1 -1
- package/dist/index.es123.js +3 -445
- package/dist/index.es123.js.map +1 -1
- package/dist/index.es124.js +437 -39
- package/dist/index.es124.js.map +1 -1
- package/dist/index.es125.js +46 -22
- package/dist/index.es125.js.map +1 -1
- package/dist/index.es126.js +21 -78
- package/dist/index.es126.js.map +1 -1
- package/dist/index.es127.js +76 -126
- package/dist/index.es127.js.map +1 -1
- package/dist/index.es128.js +125 -45
- package/dist/index.es128.js.map +1 -1
- package/dist/index.es129.js +48 -9
- package/dist/index.es129.js.map +1 -1
- package/dist/index.es130.js +10 -45
- package/dist/index.es130.js.map +1 -1
- package/dist/index.es131.js +43 -97
- package/dist/index.es131.js.map +1 -1
- package/dist/index.es132.js +94 -48
- package/dist/index.es132.js.map +1 -1
- package/dist/index.es133.js +51 -14
- package/dist/index.es133.js.map +1 -1
- package/dist/index.es134.js +1 -1
- package/dist/index.es135.js +1 -1
- package/dist/index.es138.js +1 -1
- package/dist/index.es139.js +1 -1
- package/dist/index.es140.js +1 -1
- package/dist/index.es141.js +1 -1
- package/dist/index.es142.js +1 -1
- package/dist/index.es143.js +1 -1
- package/dist/index.es144.js +1 -1
- package/dist/index.es145.js +1 -1
- package/dist/index.es146.js +1 -1
- package/dist/index.es147.js +1 -1
- package/dist/index.es148.js +1 -1
- package/dist/index.es149.js +1 -1
- package/dist/index.es150.js +1 -1
- package/dist/index.es151.js +1 -1
- package/dist/index.es152.js +1 -1
- package/dist/index.es153.js +1 -1
- package/dist/index.es154.js +1 -1
- package/dist/index.es155.js +1 -1
- package/dist/index.es156.js +1 -1
- package/dist/index.es157.js +1 -1
- package/dist/index.es158.js +1 -1
- package/dist/index.es159.js +1 -1
- package/dist/index.es16.js +3 -3
- package/dist/index.es16.js.map +1 -1
- package/dist/index.es160.js +1 -1
- package/dist/index.es161.js +1 -1
- package/dist/index.es162.js +1 -1
- package/dist/index.es163.js +1 -1
- package/dist/index.es164.js +1 -1
- package/dist/index.es165.js +1 -1
- package/dist/index.es166.js +1 -1
- package/dist/index.es167.js +1 -1
- package/dist/index.es168.js +1 -1
- package/dist/index.es169.js +1 -1
- package/dist/index.es170.js +1 -1
- package/dist/index.es171.js +1 -1
- package/dist/index.es172.js +1 -1
- package/dist/index.es173.js +1 -1
- package/dist/index.es174.js +1 -1
- package/dist/index.es175.js +1 -1
- package/dist/index.es176.js +1 -1
- package/dist/index.es177.js +1 -1
- package/dist/index.es178.js +1 -1
- package/dist/index.es179.js +1 -1
- package/dist/index.es18.js +15 -15
- package/dist/index.es180.js +1 -1
- package/dist/index.es181.js +1 -1
- package/dist/index.es182.js +1 -1
- package/dist/index.es183.js +162 -13
- package/dist/index.es183.js.map +1 -1
- package/dist/index.es184.js +2 -89
- package/dist/index.es184.js.map +1 -1
- package/dist/index.es185.js +15 -2
- package/dist/index.es185.js.map +1 -1
- package/dist/index.es186.js +89 -2
- package/dist/index.es186.js.map +1 -1
- package/dist/index.es187.js +2 -2
- package/dist/index.es188.js +56 -2
- package/dist/index.es188.js.map +1 -1
- package/dist/index.es189.js +100 -2
- package/dist/index.es189.js.map +1 -1
- package/dist/index.es190.js +191 -2
- package/dist/index.es190.js.map +1 -1
- package/dist/index.es191.js +110 -2
- package/dist/index.es191.js.map +1 -1
- package/dist/index.es192.js +35 -2
- package/dist/index.es192.js.map +1 -1
- package/dist/index.es193.js +10 -2
- package/dist/index.es193.js.map +1 -1
- package/dist/index.es194.js +11 -2
- package/dist/index.es194.js.map +1 -1
- package/dist/index.es195.js +12 -2
- package/dist/index.es195.js.map +1 -1
- package/dist/index.es196.js +91 -2
- package/dist/index.es196.js.map +1 -1
- package/dist/index.es197.js +275 -2
- package/dist/index.es197.js.map +1 -1
- package/dist/index.es198.js +2 -2
- package/dist/index.es199.js +164 -2
- package/dist/index.es199.js.map +1 -1
- package/dist/index.es200.js +51 -2
- package/dist/index.es200.js.map +1 -1
- package/dist/index.es201.js +40 -2
- package/dist/index.es201.js.map +1 -1
- package/dist/index.es202.js +35 -2
- package/dist/index.es202.js.map +1 -1
- package/dist/index.es203.js +40 -2
- package/dist/index.es203.js.map +1 -1
- package/dist/index.es204.js +24 -2
- package/dist/index.es204.js.map +1 -1
- package/dist/index.es205.js +591 -2
- package/dist/index.es205.js.map +1 -1
- package/dist/index.es206.js +125 -2
- package/dist/index.es206.js.map +1 -1
- package/dist/index.es207.js +2 -2
- package/dist/index.es208.js +2 -2
- package/dist/index.es209.js +2 -2
- package/dist/index.es210.js +2 -2
- package/dist/index.es211.js +2 -2
- package/dist/index.es212.js +2 -2
- package/dist/index.es213.js +2 -2
- package/dist/index.es214.js +2 -2
- package/dist/index.es215.js +2 -2
- package/dist/index.es216.js +2 -2
- package/dist/index.es217.js +2 -2
- package/dist/index.es218.js +2 -2
- package/dist/index.es219.js +2 -2
- package/dist/index.es220.js +2 -2
- package/dist/index.es221.js +2 -2
- package/dist/index.es222.js +2 -2
- package/dist/index.es223.js +2 -2
- package/dist/index.es224.js +2 -2
- package/dist/index.es225.js +2 -2
- package/dist/index.es226.js +2 -2
- package/dist/index.es227.js +2 -2
- package/dist/index.es228.js +2 -2
- package/dist/index.es229.js +2 -2
- package/dist/index.es230.js +2 -2
- package/dist/index.es231.js +2 -56
- package/dist/index.es231.js.map +1 -1
- package/dist/index.es232.js +2 -100
- package/dist/index.es232.js.map +1 -1
- package/dist/index.es233.js +2 -191
- package/dist/index.es233.js.map +1 -1
- package/dist/index.es234.js +2 -110
- package/dist/index.es234.js.map +1 -1
- package/dist/index.es235.js +2 -35
- package/dist/index.es235.js.map +1 -1
- package/dist/index.es236.js +2 -10
- package/dist/index.es236.js.map +1 -1
- package/dist/index.es237.js +2 -11
- package/dist/index.es237.js.map +1 -1
- package/dist/index.es238.js +2 -12
- package/dist/index.es238.js.map +1 -1
- package/dist/index.es239.js +2 -91
- package/dist/index.es239.js.map +1 -1
- package/dist/index.es24.js +1 -1
- package/dist/index.es240.js +2 -275
- package/dist/index.es240.js.map +1 -1
- package/dist/index.es241.js +2 -2
- package/dist/index.es242.js +2 -164
- package/dist/index.es242.js.map +1 -1
- package/dist/index.es243.js +2 -51
- package/dist/index.es243.js.map +1 -1
- package/dist/index.es244.js +2 -40
- package/dist/index.es244.js.map +1 -1
- package/dist/index.es245.js +2 -35
- package/dist/index.es245.js.map +1 -1
- package/dist/index.es246.js +2 -40
- package/dist/index.es246.js.map +1 -1
- package/dist/index.es247.js +2 -24
- package/dist/index.es247.js.map +1 -1
- package/dist/index.es248.js +2 -591
- package/dist/index.es248.js.map +1 -1
- package/dist/index.es249.js +2 -125
- package/dist/index.es249.js.map +1 -1
- package/dist/index.es25.js +3 -1
- package/dist/index.es25.js.map +1 -1
- package/dist/index.es250.js +2 -164
- package/dist/index.es250.js.map +1 -1
- package/dist/index.es251.js +2 -2
- package/dist/index.es252.js +2 -2
- package/dist/index.es253.js +1 -1
- package/dist/index.es258.js +1 -1
- package/dist/index.es260.js +2 -2
- package/dist/index.es262.js +2 -2
- package/dist/index.es265.js +1 -1
- package/dist/index.es267.js +1 -1
- package/dist/index.es277.js +2 -147
- package/dist/index.es277.js.map +1 -1
- package/dist/index.es278.js +126 -167
- package/dist/index.es278.js.map +1 -1
- package/dist/index.es279.js +188 -2
- package/dist/index.es279.js.map +1 -1
- package/dist/index.es280.js +1 -1
- package/dist/index.es283.js +1 -1
- package/dist/index.es288.js +1 -1
- package/dist/index.es29.js +1 -1
- package/dist/index.es3.js +24 -9
- package/dist/index.es3.js.map +1 -1
- package/dist/index.es300.js +1 -1
- package/dist/index.es302.js +1 -1
- package/dist/index.es31.js +7 -7
- package/dist/index.es314.js +1 -1
- package/dist/index.es32.js +1 -1
- package/dist/index.es334.js +2 -2
- package/dist/index.es35.js +4 -4
- package/dist/index.es36.js +1185 -111
- package/dist/index.es36.js.map +1 -1
- package/dist/index.es37.js +7 -71
- package/dist/index.es37.js.map +1 -1
- package/dist/index.es38.js +9 -18
- package/dist/index.es38.js.map +1 -1
- package/dist/index.es39.js +136 -250
- package/dist/index.es39.js.map +1 -1
- package/dist/index.es4.js +2 -1
- package/dist/index.es4.js.map +1 -1
- package/dist/index.es40.js +116 -41
- package/dist/index.es40.js.map +1 -1
- package/dist/index.es41.js +64 -208
- package/dist/index.es41.js.map +1 -1
- package/dist/index.es42.js +17 -66
- package/dist/index.es42.js.map +1 -1
- package/dist/index.es43.js +236 -117
- package/dist/index.es43.js.map +1 -1
- package/dist/index.es44.js +38 -19
- package/dist/index.es44.js.map +1 -1
- package/dist/index.es45.js +202 -217
- package/dist/index.es45.js.map +1 -1
- package/dist/index.es46.js +65 -7
- package/dist/index.es46.js.map +1 -1
- package/dist/index.es47.js +131 -1181
- package/dist/index.es47.js.map +1 -1
- package/dist/index.es48.js +25 -8
- package/dist/index.es48.js.map +1 -1
- package/dist/index.es49.js +218 -135
- package/dist/index.es49.js.map +1 -1
- package/dist/index.es5.js.map +1 -1
- package/dist/index.es50.js +5 -208
- package/dist/index.es50.js.map +1 -1
- package/dist/index.es51.js +208 -5
- package/dist/index.es51.js.map +1 -1
- package/dist/index.es52.js +90 -7
- package/dist/index.es52.js.map +1 -1
- package/dist/index.es53.js +6 -92
- package/dist/index.es53.js.map +1 -1
- package/dist/index.es54.js +14 -3
- package/dist/index.es54.js.map +1 -1
- package/dist/index.es55.js +8 -36
- package/dist/index.es55.js.map +1 -1
- package/dist/index.es56.js +83 -61
- package/dist/index.es56.js.map +1 -1
- package/dist/index.es57.js +3 -37
- package/dist/index.es57.js.map +1 -1
- package/dist/index.es58.js +34 -304
- package/dist/index.es58.js.map +1 -1
- package/dist/index.es59.js +72 -9
- package/dist/index.es59.js.map +1 -1
- package/dist/index.es60.js +32 -85
- package/dist/index.es60.js.map +1 -1
- package/dist/index.es61.js +304 -6
- package/dist/index.es61.js.map +1 -1
- package/dist/index.es62.js +9 -15
- package/dist/index.es62.js.map +1 -1
- package/dist/index.es63.js +3 -3
- package/dist/index.es64.js +5 -142
- package/dist/index.es64.js.map +1 -1
- package/dist/index.es65.js +148 -285
- package/dist/index.es65.js.map +1 -1
- package/dist/index.es66.js +668 -62
- package/dist/index.es66.js.map +1 -1
- package/dist/index.es67.js +131 -201
- package/dist/index.es67.js.map +1 -1
- package/dist/index.es68.js +295 -29
- package/dist/index.es68.js.map +1 -1
- package/dist/index.es69.js +65 -8
- package/dist/index.es69.js.map +1 -1
- package/dist/index.es7.js +2 -1
- package/dist/index.es7.js.map +1 -1
- package/dist/index.es70.js +210 -9
- package/dist/index.es70.js.map +1 -1
- package/dist/index.es71.js +28 -181
- package/dist/index.es71.js.map +1 -1
- package/dist/index.es72.js +8 -23
- package/dist/index.es72.js.map +1 -1
- package/dist/index.es73.js +9 -1397
- package/dist/index.es73.js.map +1 -1
- package/dist/index.es74.js +187 -9
- package/dist/index.es74.js.map +1 -1
- package/dist/index.es75.js +24 -8
- package/dist/index.es75.js.map +1 -1
- package/dist/index.es76.js +1399 -5
- package/dist/index.es76.js.map +1 -1
- package/dist/index.es77.js +9 -163
- package/dist/index.es77.js.map +1 -1
- package/dist/index.es78.js +8 -672
- package/dist/index.es78.js.map +1 -1
- package/dist/index.es79.js +36 -20
- package/dist/index.es79.js.map +1 -1
- package/dist/index.es80.js +5 -68
- package/dist/index.es80.js.map +1 -1
- package/dist/index.es81.js +73 -3
- package/dist/index.es81.js.map +1 -1
- package/dist/index.es82.js +36 -11
- package/dist/index.es82.js.map +1 -1
- package/dist/index.es83.js +10 -38
- package/dist/index.es83.js.map +1 -1
- package/dist/index.es84.js +34 -28
- package/dist/index.es84.js.map +1 -1
- package/dist/index.es85.js +28 -226
- package/dist/index.es85.js.map +1 -1
- package/dist/index.es86.js +228 -26
- package/dist/index.es86.js.map +1 -1
- package/dist/index.es87.js +26 -71
- package/dist/index.es87.js.map +1 -1
- package/dist/index.es88.js +41 -42
- package/dist/index.es88.js.map +1 -1
- package/dist/index.es89.js +71 -47
- package/dist/index.es89.js.map +1 -1
- package/dist/index.es90.js +37 -15
- package/dist/index.es90.js.map +1 -1
- package/dist/index.es91.js +6 -19
- package/dist/index.es91.js.map +1 -1
- package/dist/index.es92.js +40 -54
- package/dist/index.es92.js.map +1 -1
- package/dist/index.es93.js +56 -12
- package/dist/index.es93.js.map +1 -1
- package/dist/index.es94.js +13 -137
- package/dist/index.es94.js.map +1 -1
- package/dist/index.es95.js +135 -19
- package/dist/index.es95.js.map +1 -1
- package/dist/index.es96.js +18 -179
- package/dist/index.es96.js.map +1 -1
- package/dist/index.es97.js +163 -222
- package/dist/index.es97.js.map +1 -1
- package/dist/index.es98.js +187 -301
- package/dist/index.es98.js.map +1 -1
- package/dist/index.es99.js +348 -130
- package/dist/index.es99.js.map +1 -1
- package/package.json +1 -1
package/dist/index.es87.js
CHANGED
|
@@ -1,78 +1,33 @@
|
|
|
1
|
-
import {
|
|
2
|
-
function
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { _isString } from "./index.es85.js";
|
|
2
|
+
function convertToV1FromDeepSeekMessage(message) {
|
|
3
|
+
const blocks = [];
|
|
4
|
+
const reasoningContent = message.additional_kwargs?.reasoning_content;
|
|
5
|
+
if (_isString(reasoningContent) && reasoningContent.length > 0) blocks.push({
|
|
6
|
+
type: "reasoning",
|
|
7
|
+
reasoning: reasoningContent
|
|
8
|
+
});
|
|
9
|
+
if (typeof message.content === "string") {
|
|
10
|
+
if (message.content.length > 0) blocks.push({
|
|
5
11
|
type: "text",
|
|
6
12
|
text: message.content
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
...block.signature ? { signature: block.signature } : {}
|
|
20
|
-
};
|
|
21
|
-
continue;
|
|
22
|
-
} else if (_isContentBlock(block, "inlineData") && _isObject(block.inlineData) && _isString(block.inlineData.mimeType) && _isString(block.inlineData.data)) {
|
|
23
|
-
yield {
|
|
24
|
-
type: "file",
|
|
25
|
-
mimeType: block.inlineData.mimeType,
|
|
26
|
-
data: block.inlineData.data
|
|
27
|
-
};
|
|
28
|
-
continue;
|
|
29
|
-
} else if (_isContentBlock(block, "functionCall") && _isObject(block.functionCall) && _isString(block.functionCall.name) && _isObject(block.functionCall.args)) {
|
|
30
|
-
yield {
|
|
31
|
-
type: "tool_call",
|
|
32
|
-
id: message.id,
|
|
33
|
-
name: block.functionCall.name,
|
|
34
|
-
args: block.functionCall.args
|
|
35
|
-
};
|
|
36
|
-
continue;
|
|
37
|
-
} else if (_isContentBlock(block, "functionResponse")) {
|
|
38
|
-
yield {
|
|
39
|
-
type: "non_standard",
|
|
40
|
-
value: block
|
|
41
|
-
};
|
|
42
|
-
continue;
|
|
43
|
-
} else if (_isContentBlock(block, "fileData") && _isObject(block.fileData) && _isString(block.fileData.mimeType) && _isString(block.fileData.fileUri)) {
|
|
44
|
-
yield {
|
|
45
|
-
type: "file",
|
|
46
|
-
mimeType: block.fileData.mimeType,
|
|
47
|
-
fileId: block.fileData.fileUri
|
|
48
|
-
};
|
|
49
|
-
continue;
|
|
50
|
-
} else if (_isContentBlock(block, "executableCode")) {
|
|
51
|
-
yield {
|
|
52
|
-
type: "non_standard",
|
|
53
|
-
value: block
|
|
54
|
-
};
|
|
55
|
-
continue;
|
|
56
|
-
} else if (_isContentBlock(block, "codeExecutionResult")) {
|
|
57
|
-
yield {
|
|
58
|
-
type: "non_standard",
|
|
59
|
-
value: block
|
|
60
|
-
};
|
|
61
|
-
continue;
|
|
62
|
-
}
|
|
63
|
-
yield {
|
|
64
|
-
type: "non_standard",
|
|
65
|
-
value: block
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
return Array.from(iterateContent());
|
|
13
|
+
});
|
|
14
|
+
} else for (const block of message.content) if (typeof block === "object" && "type" in block && block.type === "text" && "text" in block && _isString(block.text)) blocks.push({
|
|
15
|
+
type: "text",
|
|
16
|
+
text: block.text
|
|
17
|
+
});
|
|
18
|
+
for (const toolCall of message.tool_calls ?? []) blocks.push({
|
|
19
|
+
type: "tool_call",
|
|
20
|
+
id: toolCall.id,
|
|
21
|
+
name: toolCall.name,
|
|
22
|
+
args: toolCall.args
|
|
23
|
+
});
|
|
24
|
+
return blocks;
|
|
70
25
|
}
|
|
71
|
-
const
|
|
72
|
-
translateContent:
|
|
73
|
-
translateContentChunk:
|
|
26
|
+
const ChatDeepSeekTranslator = {
|
|
27
|
+
translateContent: convertToV1FromDeepSeekMessage,
|
|
28
|
+
translateContentChunk: convertToV1FromDeepSeekMessage
|
|
74
29
|
};
|
|
75
30
|
export {
|
|
76
|
-
|
|
31
|
+
ChatDeepSeekTranslator
|
|
77
32
|
};
|
|
78
33
|
//# sourceMappingURL=index.es87.js.map
|
package/dist/index.es87.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es87.js","sources":["../node_modules/.pnpm/@langchain+core@1.1.13_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/
|
|
1
|
+
{"version":3,"file":"index.es87.js","sources":["../node_modules/.pnpm/@langchain+core@1.1.13_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/deepseek.js"],"sourcesContent":["import { _isString } from \"./utils.js\";\n\n//#region src/messages/block_translators/deepseek.ts\n/**\n* Converts a DeepSeek AI message to an array of v1 standard content blocks.\n*\n* This function processes an AI message from DeepSeek's API format\n* and converts it to the standardized v1 content block format. It handles\n* both string content and the reasoning_content in additional_kwargs.\n*\n* @param message - The AI message containing DeepSeek-formatted content\n* @returns Array of content blocks in v1 standard format\n*\n* @example\n* ```typescript\n* const message = new AIMessage({\n* content: \"The answer is 42\",\n* additional_kwargs: { reasoning_content: \"Let me think about this...\" }\n* });\n* const standardBlocks = convertToV1FromDeepSeekMessage(message);\n* // Returns:\n* // [\n* // { type: \"reasoning\", reasoning: \"Let me think about this...\" },\n* // { type: \"text\", text: \"The answer is 42\" }\n* // ]\n* ```\n*/\nfunction convertToV1FromDeepSeekMessage(message) {\n\tconst blocks = [];\n\tconst reasoningContent = message.additional_kwargs?.reasoning_content;\n\tif (_isString(reasoningContent) && reasoningContent.length > 0) blocks.push({\n\t\ttype: \"reasoning\",\n\t\treasoning: reasoningContent\n\t});\n\tif (typeof message.content === \"string\") {\n\t\tif (message.content.length > 0) blocks.push({\n\t\t\ttype: \"text\",\n\t\t\ttext: message.content\n\t\t});\n\t} else for (const block of message.content) if (typeof block === \"object\" && \"type\" in block && block.type === \"text\" && \"text\" in block && _isString(block.text)) blocks.push({\n\t\ttype: \"text\",\n\t\ttext: block.text\n\t});\n\tfor (const toolCall of message.tool_calls ?? []) blocks.push({\n\t\ttype: \"tool_call\",\n\t\tid: toolCall.id,\n\t\tname: toolCall.name,\n\t\targs: toolCall.args\n\t});\n\treturn blocks;\n}\nconst ChatDeepSeekTranslator = {\n\ttranslateContent: convertToV1FromDeepSeekMessage,\n\ttranslateContentChunk: convertToV1FromDeepSeekMessage\n};\n\n//#endregion\nexport { ChatDeepSeekTranslator };\n//# sourceMappingURL=deepseek.js.map"],"names":[],"mappings":";AA2BA,SAAS,+BAA+B,SAAS;AAChD,QAAM,SAAS,CAAA;AACf,QAAM,mBAAmB,QAAQ,mBAAmB;AACpD,MAAI,UAAU,gBAAgB,KAAK,iBAAiB,SAAS,EAAG,QAAO,KAAK;AAAA,IAC3E,MAAM;AAAA,IACN,WAAW;AAAA,EACb,CAAE;AACD,MAAI,OAAO,QAAQ,YAAY,UAAU;AACxC,QAAI,QAAQ,QAAQ,SAAS,EAAG,QAAO,KAAK;AAAA,MAC3C,MAAM;AAAA,MACN,MAAM,QAAQ;AAAA,IACjB,CAAG;AAAA,EACF,MAAO,YAAW,SAAS,QAAQ,QAAS,KAAI,OAAO,UAAU,YAAY,UAAU,SAAS,MAAM,SAAS,UAAU,UAAU,SAAS,UAAU,MAAM,IAAI,EAAG,QAAO,KAAK;AAAA,IAC9K,MAAM;AAAA,IACN,MAAM,MAAM;AAAA,EACd,CAAE;AACD,aAAW,YAAY,QAAQ,cAAc,CAAA,EAAI,QAAO,KAAK;AAAA,IAC5D,MAAM;AAAA,IACN,IAAI,SAAS;AAAA,IACb,MAAM,SAAS;AAAA,IACf,MAAM,SAAS;AAAA,EACjB,CAAE;AACD,SAAO;AACR;AACK,MAAC,yBAAyB;AAAA,EAC9B,kBAAkB;AAAA,EAClB,uBAAuB;AACxB;","x_google_ignoreList":[0]}
|
package/dist/index.es88.js
CHANGED
|
@@ -1,25 +1,15 @@
|
|
|
1
|
-
import { _isContentBlock, _isString,
|
|
2
|
-
function
|
|
1
|
+
import { _isContentBlock, _isString, _isObject } from "./index.es85.js";
|
|
2
|
+
function convertToV1FromChatGoogleMessage(message) {
|
|
3
3
|
function* iterateContent() {
|
|
4
4
|
const content = typeof message.content === "string" ? [{
|
|
5
5
|
type: "text",
|
|
6
6
|
text: message.content
|
|
7
7
|
}] : message.content;
|
|
8
8
|
for (const block of content) {
|
|
9
|
-
if (_isContentBlock(block, "
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return void 0;
|
|
14
|
-
});
|
|
15
|
-
if (_isString(signature)) yield {
|
|
16
|
-
type: "reasoning",
|
|
17
|
-
reasoning: block.reasoning,
|
|
18
|
-
signature
|
|
19
|
-
};
|
|
20
|
-
else yield {
|
|
21
|
-
type: "reasoning",
|
|
22
|
-
reasoning: block.reasoning
|
|
9
|
+
if (_isContentBlock(block, "text") && _isString(block.text)) {
|
|
10
|
+
yield {
|
|
11
|
+
type: "text",
|
|
12
|
+
text: block.text
|
|
23
13
|
};
|
|
24
14
|
continue;
|
|
25
15
|
} else if (_isContentBlock(block, "thinking") && _isString(block.thinking)) {
|
|
@@ -29,35 +19,44 @@ function convertToV1FromChatVertexMessage(message) {
|
|
|
29
19
|
...block.signature ? { signature: block.signature } : {}
|
|
30
20
|
};
|
|
31
21
|
continue;
|
|
32
|
-
} else if (_isContentBlock(block, "
|
|
22
|
+
} else if (_isContentBlock(block, "inlineData") && _isObject(block.inlineData) && _isString(block.inlineData.mimeType) && _isString(block.inlineData.data)) {
|
|
33
23
|
yield {
|
|
34
|
-
type: "
|
|
35
|
-
|
|
24
|
+
type: "file",
|
|
25
|
+
mimeType: block.inlineData.mimeType,
|
|
26
|
+
data: block.inlineData.data
|
|
36
27
|
};
|
|
37
28
|
continue;
|
|
38
|
-
} else if (_isContentBlock(block, "
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
data: match[2],
|
|
45
|
-
mimeType: match[1]
|
|
46
|
-
};
|
|
47
|
-
else yield {
|
|
48
|
-
type: "image",
|
|
49
|
-
url: block.image_url
|
|
50
|
-
};
|
|
51
|
-
} else yield {
|
|
52
|
-
type: "image",
|
|
53
|
-
url: block.image_url
|
|
29
|
+
} else if (_isContentBlock(block, "functionCall") && _isObject(block.functionCall) && _isString(block.functionCall.name) && _isObject(block.functionCall.args)) {
|
|
30
|
+
yield {
|
|
31
|
+
type: "tool_call",
|
|
32
|
+
id: message.id,
|
|
33
|
+
name: block.functionCall.name,
|
|
34
|
+
args: block.functionCall.args
|
|
54
35
|
};
|
|
55
36
|
continue;
|
|
56
|
-
} else if (_isContentBlock(block, "
|
|
37
|
+
} else if (_isContentBlock(block, "functionResponse")) {
|
|
38
|
+
yield {
|
|
39
|
+
type: "non_standard",
|
|
40
|
+
value: block
|
|
41
|
+
};
|
|
42
|
+
continue;
|
|
43
|
+
} else if (_isContentBlock(block, "fileData") && _isObject(block.fileData) && _isString(block.fileData.mimeType) && _isString(block.fileData.fileUri)) {
|
|
57
44
|
yield {
|
|
58
45
|
type: "file",
|
|
59
|
-
mimeType: block.mimeType,
|
|
60
|
-
|
|
46
|
+
mimeType: block.fileData.mimeType,
|
|
47
|
+
fileId: block.fileData.fileUri
|
|
48
|
+
};
|
|
49
|
+
continue;
|
|
50
|
+
} else if (_isContentBlock(block, "executableCode")) {
|
|
51
|
+
yield {
|
|
52
|
+
type: "non_standard",
|
|
53
|
+
value: block
|
|
54
|
+
};
|
|
55
|
+
continue;
|
|
56
|
+
} else if (_isContentBlock(block, "codeExecutionResult")) {
|
|
57
|
+
yield {
|
|
58
|
+
type: "non_standard",
|
|
59
|
+
value: block
|
|
61
60
|
};
|
|
62
61
|
continue;
|
|
63
62
|
}
|
|
@@ -69,11 +68,11 @@ function convertToV1FromChatVertexMessage(message) {
|
|
|
69
68
|
}
|
|
70
69
|
return Array.from(iterateContent());
|
|
71
70
|
}
|
|
72
|
-
const
|
|
73
|
-
translateContent:
|
|
74
|
-
translateContentChunk:
|
|
71
|
+
const ChatGoogleGenAITranslator = {
|
|
72
|
+
translateContent: convertToV1FromChatGoogleMessage,
|
|
73
|
+
translateContentChunk: convertToV1FromChatGoogleMessage
|
|
75
74
|
};
|
|
76
75
|
export {
|
|
77
|
-
|
|
76
|
+
ChatGoogleGenAITranslator
|
|
78
77
|
};
|
|
79
78
|
//# sourceMappingURL=index.es88.js.map
|
package/dist/index.es88.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es88.js","sources":["../node_modules/.pnpm/@langchain+core@1.1.13_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/
|
|
1
|
+
{"version":3,"file":"index.es88.js","sources":["../node_modules/.pnpm/@langchain+core@1.1.13_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/google_genai.js"],"sourcesContent":["import { _isContentBlock, _isObject, _isString } from \"./utils.js\";\n\n//#region src/messages/block_translators/google_genai.ts\nfunction convertToV1FromChatGoogleMessage(message) {\n\tfunction* iterateContent() {\n\t\tconst content = typeof message.content === \"string\" ? [{\n\t\t\ttype: \"text\",\n\t\t\ttext: message.content\n\t\t}] : message.content;\n\t\tfor (const block of content) {\n\t\t\tif (_isContentBlock(block, \"text\") && _isString(block.text)) {\n\t\t\t\tyield {\n\t\t\t\t\ttype: \"text\",\n\t\t\t\t\ttext: block.text\n\t\t\t\t};\n\t\t\t\tcontinue;\n\t\t\t} else if (_isContentBlock(block, \"thinking\") && _isString(block.thinking)) {\n\t\t\t\tyield {\n\t\t\t\t\ttype: \"reasoning\",\n\t\t\t\t\treasoning: block.thinking,\n\t\t\t\t\t...block.signature ? { signature: block.signature } : {}\n\t\t\t\t};\n\t\t\t\tcontinue;\n\t\t\t} else if (_isContentBlock(block, \"inlineData\") && _isObject(block.inlineData) && _isString(block.inlineData.mimeType) && _isString(block.inlineData.data)) {\n\t\t\t\tyield {\n\t\t\t\t\ttype: \"file\",\n\t\t\t\t\tmimeType: block.inlineData.mimeType,\n\t\t\t\t\tdata: block.inlineData.data\n\t\t\t\t};\n\t\t\t\tcontinue;\n\t\t\t} else if (_isContentBlock(block, \"functionCall\") && _isObject(block.functionCall) && _isString(block.functionCall.name) && _isObject(block.functionCall.args)) {\n\t\t\t\tyield {\n\t\t\t\t\ttype: \"tool_call\",\n\t\t\t\t\tid: message.id,\n\t\t\t\t\tname: block.functionCall.name,\n\t\t\t\t\targs: block.functionCall.args\n\t\t\t\t};\n\t\t\t\tcontinue;\n\t\t\t} else if (_isContentBlock(block, \"functionResponse\")) {\n\t\t\t\tyield {\n\t\t\t\t\ttype: \"non_standard\",\n\t\t\t\t\tvalue: block\n\t\t\t\t};\n\t\t\t\tcontinue;\n\t\t\t} else if (_isContentBlock(block, \"fileData\") && _isObject(block.fileData) && _isString(block.fileData.mimeType) && _isString(block.fileData.fileUri)) {\n\t\t\t\tyield {\n\t\t\t\t\ttype: \"file\",\n\t\t\t\t\tmimeType: block.fileData.mimeType,\n\t\t\t\t\tfileId: block.fileData.fileUri\n\t\t\t\t};\n\t\t\t\tcontinue;\n\t\t\t} else if (_isContentBlock(block, \"executableCode\")) {\n\t\t\t\tyield {\n\t\t\t\t\ttype: \"non_standard\",\n\t\t\t\t\tvalue: block\n\t\t\t\t};\n\t\t\t\tcontinue;\n\t\t\t} else if (_isContentBlock(block, \"codeExecutionResult\")) {\n\t\t\t\tyield {\n\t\t\t\t\ttype: \"non_standard\",\n\t\t\t\t\tvalue: block\n\t\t\t\t};\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tyield {\n\t\t\t\ttype: \"non_standard\",\n\t\t\t\tvalue: block\n\t\t\t};\n\t\t}\n\t}\n\treturn Array.from(iterateContent());\n}\nconst ChatGoogleGenAITranslator = {\n\ttranslateContent: convertToV1FromChatGoogleMessage,\n\ttranslateContentChunk: convertToV1FromChatGoogleMessage\n};\n\n//#endregion\nexport { ChatGoogleGenAITranslator };\n//# sourceMappingURL=google_genai.js.map"],"names":[],"mappings":";AAGA,SAAS,iCAAiC,SAAS;AAClD,YAAU,iBAAiB;AAC1B,UAAM,UAAU,OAAO,QAAQ,YAAY,WAAW,CAAC;AAAA,MACtD,MAAM;AAAA,MACN,MAAM,QAAQ;AAAA,IACjB,CAAG,IAAI,QAAQ;AACb,eAAW,SAAS,SAAS;AAC5B,UAAI,gBAAgB,OAAO,MAAM,KAAK,UAAU,MAAM,IAAI,GAAG;AAC5D,cAAM;AAAA,UACL,MAAM;AAAA,UACN,MAAM,MAAM;AAAA,QACjB;AACI;AAAA,MACD,WAAW,gBAAgB,OAAO,UAAU,KAAK,UAAU,MAAM,QAAQ,GAAG;AAC3E,cAAM;AAAA,UACL,MAAM;AAAA,UACN,WAAW,MAAM;AAAA,UACjB,GAAG,MAAM,YAAY,EAAE,WAAW,MAAM,UAAS,IAAK,CAAA;AAAA,QAC3D;AACI;AAAA,MACD,WAAW,gBAAgB,OAAO,YAAY,KAAK,UAAU,MAAM,UAAU,KAAK,UAAU,MAAM,WAAW,QAAQ,KAAK,UAAU,MAAM,WAAW,IAAI,GAAG;AAC3J,cAAM;AAAA,UACL,MAAM;AAAA,UACN,UAAU,MAAM,WAAW;AAAA,UAC3B,MAAM,MAAM,WAAW;AAAA,QAC5B;AACI;AAAA,MACD,WAAW,gBAAgB,OAAO,cAAc,KAAK,UAAU,MAAM,YAAY,KAAK,UAAU,MAAM,aAAa,IAAI,KAAK,UAAU,MAAM,aAAa,IAAI,GAAG;AAC/J,cAAM;AAAA,UACL,MAAM;AAAA,UACN,IAAI,QAAQ;AAAA,UACZ,MAAM,MAAM,aAAa;AAAA,UACzB,MAAM,MAAM,aAAa;AAAA,QAC9B;AACI;AAAA,MACD,WAAW,gBAAgB,OAAO,kBAAkB,GAAG;AACtD,cAAM;AAAA,UACL,MAAM;AAAA,UACN,OAAO;AAAA,QACZ;AACI;AAAA,MACD,WAAW,gBAAgB,OAAO,UAAU,KAAK,UAAU,MAAM,QAAQ,KAAK,UAAU,MAAM,SAAS,QAAQ,KAAK,UAAU,MAAM,SAAS,OAAO,GAAG;AACtJ,cAAM;AAAA,UACL,MAAM;AAAA,UACN,UAAU,MAAM,SAAS;AAAA,UACzB,QAAQ,MAAM,SAAS;AAAA,QAC5B;AACI;AAAA,MACD,WAAW,gBAAgB,OAAO,gBAAgB,GAAG;AACpD,cAAM;AAAA,UACL,MAAM;AAAA,UACN,OAAO;AAAA,QACZ;AACI;AAAA,MACD,WAAW,gBAAgB,OAAO,qBAAqB,GAAG;AACzD,cAAM;AAAA,UACL,MAAM;AAAA,UACN,OAAO;AAAA,QACZ;AACI;AAAA,MACD;AACA,YAAM;AAAA,QACL,MAAM;AAAA,QACN,OAAO;AAAA,MACX;AAAA,IACE;AAAA,EACD;AACA,SAAO,MAAM,KAAK,gBAAgB;AACnC;AACK,MAAC,4BAA4B;AAAA,EACjC,kBAAkB;AAAA,EAClB,uBAAuB;AACxB;","x_google_ignoreList":[0]}
|
package/dist/index.es89.js
CHANGED
|
@@ -1,55 +1,79 @@
|
|
|
1
|
-
import { _isString } from "./index.
|
|
2
|
-
function
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
if (_isString(parsedReasoning) && parsedReasoning.length > 0) blocks.push({
|
|
6
|
-
type: "reasoning",
|
|
7
|
-
reasoning: parsedReasoning
|
|
8
|
-
});
|
|
9
|
-
if (typeof message.content === "string") {
|
|
10
|
-
let textContent = message.content;
|
|
11
|
-
const thinkMatch = textContent.match(/<think>([\s\S]*?)<\/think>/);
|
|
12
|
-
if (thinkMatch) {
|
|
13
|
-
const thinkingContent = thinkMatch[1].trim();
|
|
14
|
-
if (thinkingContent.length > 0) blocks.push({
|
|
15
|
-
type: "reasoning",
|
|
16
|
-
reasoning: thinkingContent
|
|
17
|
-
});
|
|
18
|
-
textContent = textContent.replace(/<think>[\s\S]*?<\/think>/, "").trim();
|
|
19
|
-
}
|
|
20
|
-
if (textContent.length > 0) blocks.push({
|
|
1
|
+
import { _isContentBlock, _isString, iife, _isArray } from "./index.es85.js";
|
|
2
|
+
function convertToV1FromChatVertexMessage(message) {
|
|
3
|
+
function* iterateContent() {
|
|
4
|
+
const content = typeof message.content === "string" ? [{
|
|
21
5
|
type: "text",
|
|
22
|
-
text:
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
6
|
+
text: message.content
|
|
7
|
+
}] : message.content;
|
|
8
|
+
for (const block of content) {
|
|
9
|
+
if (_isContentBlock(block, "reasoning") && _isString(block.reasoning)) {
|
|
10
|
+
const signature = iife(() => {
|
|
11
|
+
const reasoningIndex = content.indexOf(block);
|
|
12
|
+
if (_isArray(message.additional_kwargs?.signatures) && reasoningIndex >= 0) return message.additional_kwargs.signatures.at(reasoningIndex);
|
|
13
|
+
return void 0;
|
|
14
|
+
});
|
|
15
|
+
if (_isString(signature)) yield {
|
|
16
|
+
type: "reasoning",
|
|
17
|
+
reasoning: block.reasoning,
|
|
18
|
+
signature
|
|
19
|
+
};
|
|
20
|
+
else yield {
|
|
21
|
+
type: "reasoning",
|
|
22
|
+
reasoning: block.reasoning
|
|
23
|
+
};
|
|
24
|
+
continue;
|
|
25
|
+
} else if (_isContentBlock(block, "thinking") && _isString(block.thinking)) {
|
|
26
|
+
yield {
|
|
27
|
+
type: "reasoning",
|
|
28
|
+
reasoning: block.thinking,
|
|
29
|
+
...block.signature ? { signature: block.signature } : {}
|
|
30
|
+
};
|
|
31
|
+
continue;
|
|
32
|
+
} else if (_isContentBlock(block, "text") && _isString(block.text)) {
|
|
33
|
+
yield {
|
|
34
|
+
type: "text",
|
|
35
|
+
text: block.text
|
|
36
|
+
};
|
|
37
|
+
continue;
|
|
38
|
+
} else if (_isContentBlock(block, "image_url")) {
|
|
39
|
+
if (_isString(block.image_url)) if (block.image_url.startsWith("data:")) {
|
|
40
|
+
const dataUrlRegex = /^data:([^;]+);base64,(.+)$/;
|
|
41
|
+
const match = block.image_url.match(dataUrlRegex);
|
|
42
|
+
if (match) yield {
|
|
43
|
+
type: "image",
|
|
44
|
+
data: match[2],
|
|
45
|
+
mimeType: match[1]
|
|
46
|
+
};
|
|
47
|
+
else yield {
|
|
48
|
+
type: "image",
|
|
49
|
+
url: block.image_url
|
|
50
|
+
};
|
|
51
|
+
} else yield {
|
|
52
|
+
type: "image",
|
|
53
|
+
url: block.image_url
|
|
54
|
+
};
|
|
55
|
+
continue;
|
|
56
|
+
} else if (_isContentBlock(block, "media") && _isString(block.mimeType) && _isString(block.data)) {
|
|
57
|
+
yield {
|
|
58
|
+
type: "file",
|
|
59
|
+
mimeType: block.mimeType,
|
|
60
|
+
data: block.data
|
|
61
|
+
};
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
yield {
|
|
65
|
+
type: "non_standard",
|
|
66
|
+
value: block
|
|
67
|
+
};
|
|
34
68
|
}
|
|
35
|
-
if (textContent.length > 0) blocks.push({
|
|
36
|
-
type: "text",
|
|
37
|
-
text: textContent
|
|
38
|
-
});
|
|
39
69
|
}
|
|
40
|
-
|
|
41
|
-
type: "tool_call",
|
|
42
|
-
id: toolCall.id,
|
|
43
|
-
name: toolCall.name,
|
|
44
|
-
args: toolCall.args
|
|
45
|
-
});
|
|
46
|
-
return blocks;
|
|
70
|
+
return Array.from(iterateContent());
|
|
47
71
|
}
|
|
48
|
-
const
|
|
49
|
-
translateContent:
|
|
50
|
-
translateContentChunk:
|
|
72
|
+
const ChatVertexTranslator = {
|
|
73
|
+
translateContent: convertToV1FromChatVertexMessage,
|
|
74
|
+
translateContentChunk: convertToV1FromChatVertexMessage
|
|
51
75
|
};
|
|
52
76
|
export {
|
|
53
|
-
|
|
77
|
+
ChatVertexTranslator
|
|
54
78
|
};
|
|
55
79
|
//# sourceMappingURL=index.es89.js.map
|
package/dist/index.es89.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es89.js","sources":["../node_modules/.pnpm/@langchain+core@1.1.13_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/
|
|
1
|
+
{"version":3,"file":"index.es89.js","sources":["../node_modules/.pnpm/@langchain+core@1.1.13_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/google_vertexai.js"],"sourcesContent":["import { _isArray, _isContentBlock, _isString, iife } from \"./utils.js\";\n\n//#region src/messages/block_translators/google_vertexai.ts\nfunction convertToV1FromChatVertexMessage(message) {\n\tfunction* iterateContent() {\n\t\tconst content = typeof message.content === \"string\" ? [{\n\t\t\ttype: \"text\",\n\t\t\ttext: message.content\n\t\t}] : message.content;\n\t\tfor (const block of content) {\n\t\t\tif (_isContentBlock(block, \"reasoning\") && _isString(block.reasoning)) {\n\t\t\t\tconst signature = iife(() => {\n\t\t\t\t\tconst reasoningIndex = content.indexOf(block);\n\t\t\t\t\tif (_isArray(message.additional_kwargs?.signatures) && reasoningIndex >= 0) return message.additional_kwargs.signatures.at(reasoningIndex);\n\t\t\t\t\treturn void 0;\n\t\t\t\t});\n\t\t\t\tif (_isString(signature)) yield {\n\t\t\t\t\ttype: \"reasoning\",\n\t\t\t\t\treasoning: block.reasoning,\n\t\t\t\t\tsignature\n\t\t\t\t};\n\t\t\t\telse yield {\n\t\t\t\t\ttype: \"reasoning\",\n\t\t\t\t\treasoning: block.reasoning\n\t\t\t\t};\n\t\t\t\tcontinue;\n\t\t\t} else if (_isContentBlock(block, \"thinking\") && _isString(block.thinking)) {\n\t\t\t\tyield {\n\t\t\t\t\ttype: \"reasoning\",\n\t\t\t\t\treasoning: block.thinking,\n\t\t\t\t\t...block.signature ? { signature: block.signature } : {}\n\t\t\t\t};\n\t\t\t\tcontinue;\n\t\t\t} else if (_isContentBlock(block, \"text\") && _isString(block.text)) {\n\t\t\t\tyield {\n\t\t\t\t\ttype: \"text\",\n\t\t\t\t\ttext: block.text\n\t\t\t\t};\n\t\t\t\tcontinue;\n\t\t\t} else if (_isContentBlock(block, \"image_url\")) {\n\t\t\t\tif (_isString(block.image_url)) if (block.image_url.startsWith(\"data:\")) {\n\t\t\t\t\tconst dataUrlRegex = /^data:([^;]+);base64,(.+)$/;\n\t\t\t\t\tconst match = block.image_url.match(dataUrlRegex);\n\t\t\t\t\tif (match) yield {\n\t\t\t\t\t\ttype: \"image\",\n\t\t\t\t\t\tdata: match[2],\n\t\t\t\t\t\tmimeType: match[1]\n\t\t\t\t\t};\n\t\t\t\t\telse yield {\n\t\t\t\t\t\ttype: \"image\",\n\t\t\t\t\t\turl: block.image_url\n\t\t\t\t\t};\n\t\t\t\t} else yield {\n\t\t\t\t\ttype: \"image\",\n\t\t\t\t\turl: block.image_url\n\t\t\t\t};\n\t\t\t\tcontinue;\n\t\t\t} else if (_isContentBlock(block, \"media\") && _isString(block.mimeType) && _isString(block.data)) {\n\t\t\t\tyield {\n\t\t\t\t\ttype: \"file\",\n\t\t\t\t\tmimeType: block.mimeType,\n\t\t\t\t\tdata: block.data\n\t\t\t\t};\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tyield {\n\t\t\t\ttype: \"non_standard\",\n\t\t\t\tvalue: block\n\t\t\t};\n\t\t}\n\t}\n\treturn Array.from(iterateContent());\n}\nconst ChatVertexTranslator = {\n\ttranslateContent: convertToV1FromChatVertexMessage,\n\ttranslateContentChunk: convertToV1FromChatVertexMessage\n};\n\n//#endregion\nexport { ChatVertexTranslator };\n//# sourceMappingURL=google_vertexai.js.map"],"names":[],"mappings":";AAGA,SAAS,iCAAiC,SAAS;AAClD,YAAU,iBAAiB;AAC1B,UAAM,UAAU,OAAO,QAAQ,YAAY,WAAW,CAAC;AAAA,MACtD,MAAM;AAAA,MACN,MAAM,QAAQ;AAAA,IACjB,CAAG,IAAI,QAAQ;AACb,eAAW,SAAS,SAAS;AAC5B,UAAI,gBAAgB,OAAO,WAAW,KAAK,UAAU,MAAM,SAAS,GAAG;AACtE,cAAM,YAAY,KAAK,MAAM;AAC5B,gBAAM,iBAAiB,QAAQ,QAAQ,KAAK;AAC5C,cAAI,SAAS,QAAQ,mBAAmB,UAAU,KAAK,kBAAkB,EAAG,QAAO,QAAQ,kBAAkB,WAAW,GAAG,cAAc;AACzI,iBAAO;AAAA,QACR,CAAC;AACD,YAAI,UAAU,SAAS,EAAG,OAAM;AAAA,UAC/B,MAAM;AAAA,UACN,WAAW,MAAM;AAAA,UACjB;AAAA,QACL;AAAA,YACS,OAAM;AAAA,UACV,MAAM;AAAA,UACN,WAAW,MAAM;AAAA,QACtB;AACI;AAAA,MACD,WAAW,gBAAgB,OAAO,UAAU,KAAK,UAAU,MAAM,QAAQ,GAAG;AAC3E,cAAM;AAAA,UACL,MAAM;AAAA,UACN,WAAW,MAAM;AAAA,UACjB,GAAG,MAAM,YAAY,EAAE,WAAW,MAAM,UAAS,IAAK,CAAA;AAAA,QAC3D;AACI;AAAA,MACD,WAAW,gBAAgB,OAAO,MAAM,KAAK,UAAU,MAAM,IAAI,GAAG;AACnE,cAAM;AAAA,UACL,MAAM;AAAA,UACN,MAAM,MAAM;AAAA,QACjB;AACI;AAAA,MACD,WAAW,gBAAgB,OAAO,WAAW,GAAG;AAC/C,YAAI,UAAU,MAAM,SAAS,EAAG,KAAI,MAAM,UAAU,WAAW,OAAO,GAAG;AACxE,gBAAM,eAAe;AACrB,gBAAM,QAAQ,MAAM,UAAU,MAAM,YAAY;AAChD,cAAI,MAAO,OAAM;AAAA,YAChB,MAAM;AAAA,YACN,MAAM,MAAM,CAAC;AAAA,YACb,UAAU,MAAM,CAAC;AAAA,UACvB;AAAA,cACU,OAAM;AAAA,YACV,MAAM;AAAA,YACN,KAAK,MAAM;AAAA,UACjB;AAAA,QACI,MAAO,OAAM;AAAA,UACZ,MAAM;AAAA,UACN,KAAK,MAAM;AAAA,QAChB;AACI;AAAA,MACD,WAAW,gBAAgB,OAAO,OAAO,KAAK,UAAU,MAAM,QAAQ,KAAK,UAAU,MAAM,IAAI,GAAG;AACjG,cAAM;AAAA,UACL,MAAM;AAAA,UACN,UAAU,MAAM;AAAA,UAChB,MAAM,MAAM;AAAA,QACjB;AACI;AAAA,MACD;AACA,YAAM;AAAA,QACL,MAAM;AAAA,QACN,OAAO;AAAA,MACX;AAAA,IACE;AAAA,EACD;AACA,SAAO,MAAM,KAAK,gBAAgB;AACnC;AACK,MAAC,uBAAuB;AAAA,EAC5B,kBAAkB;AAAA,EAClB,uBAAuB;AACxB;","x_google_ignoreList":[0]}
|
package/dist/index.es90.js
CHANGED
|
@@ -1,20 +1,42 @@
|
|
|
1
|
-
import { _isString } from "./index.
|
|
2
|
-
function
|
|
1
|
+
import { _isString } from "./index.es85.js";
|
|
2
|
+
function convertToV1FromGroqMessage(message) {
|
|
3
3
|
const blocks = [];
|
|
4
|
-
const
|
|
5
|
-
if (_isString(
|
|
4
|
+
const parsedReasoning = message.additional_kwargs?.reasoning;
|
|
5
|
+
if (_isString(parsedReasoning) && parsedReasoning.length > 0) blocks.push({
|
|
6
6
|
type: "reasoning",
|
|
7
|
-
reasoning:
|
|
7
|
+
reasoning: parsedReasoning
|
|
8
8
|
});
|
|
9
9
|
if (typeof message.content === "string") {
|
|
10
|
-
|
|
10
|
+
let textContent = message.content;
|
|
11
|
+
const thinkMatch = textContent.match(/<think>([\s\S]*?)<\/think>/);
|
|
12
|
+
if (thinkMatch) {
|
|
13
|
+
const thinkingContent = thinkMatch[1].trim();
|
|
14
|
+
if (thinkingContent.length > 0) blocks.push({
|
|
15
|
+
type: "reasoning",
|
|
16
|
+
reasoning: thinkingContent
|
|
17
|
+
});
|
|
18
|
+
textContent = textContent.replace(/<think>[\s\S]*?<\/think>/, "").trim();
|
|
19
|
+
}
|
|
20
|
+
if (textContent.length > 0) blocks.push({
|
|
11
21
|
type: "text",
|
|
12
|
-
text:
|
|
22
|
+
text: textContent
|
|
13
23
|
});
|
|
14
|
-
} else for (const block of message.content) if (typeof block === "object" && "type" in block && block.type === "text" && "text" in block && _isString(block.text))
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
24
|
+
} else for (const block of message.content) if (typeof block === "object" && "type" in block && block.type === "text" && "text" in block && _isString(block.text)) {
|
|
25
|
+
let textContent = block.text;
|
|
26
|
+
const thinkMatch = textContent.match(/<think>([\s\S]*?)<\/think>/);
|
|
27
|
+
if (thinkMatch) {
|
|
28
|
+
const thinkingContent = thinkMatch[1].trim();
|
|
29
|
+
if (thinkingContent.length > 0) blocks.push({
|
|
30
|
+
type: "reasoning",
|
|
31
|
+
reasoning: thinkingContent
|
|
32
|
+
});
|
|
33
|
+
textContent = textContent.replace(/<think>[\s\S]*?<\/think>/, "").trim();
|
|
34
|
+
}
|
|
35
|
+
if (textContent.length > 0) blocks.push({
|
|
36
|
+
type: "text",
|
|
37
|
+
text: textContent
|
|
38
|
+
});
|
|
39
|
+
}
|
|
18
40
|
for (const toolCall of message.tool_calls ?? []) blocks.push({
|
|
19
41
|
type: "tool_call",
|
|
20
42
|
id: toolCall.id,
|
|
@@ -23,11 +45,11 @@ function convertToV1FromOllamaMessage(message) {
|
|
|
23
45
|
});
|
|
24
46
|
return blocks;
|
|
25
47
|
}
|
|
26
|
-
const
|
|
27
|
-
translateContent:
|
|
28
|
-
translateContentChunk:
|
|
48
|
+
const ChatGroqTranslator = {
|
|
49
|
+
translateContent: convertToV1FromGroqMessage,
|
|
50
|
+
translateContentChunk: convertToV1FromGroqMessage
|
|
29
51
|
};
|
|
30
52
|
export {
|
|
31
|
-
|
|
53
|
+
ChatGroqTranslator
|
|
32
54
|
};
|
|
33
55
|
//# sourceMappingURL=index.es90.js.map
|
package/dist/index.es90.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es90.js","sources":["../node_modules/.pnpm/@langchain+core@1.1.13_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/
|
|
1
|
+
{"version":3,"file":"index.es90.js","sources":["../node_modules/.pnpm/@langchain+core@1.1.13_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/groq.js"],"sourcesContent":["import { _isString } from \"./utils.js\";\n\n//#region src/messages/block_translators/groq.ts\n/**\n* Converts a Groq AI message to an array of v1 standard content blocks.\n*\n* This function processes an AI message from Groq's API format\n* and converts it to the standardized v1 content block format. It handles\n* both parsed reasoning (in additional_kwargs.reasoning) and raw reasoning\n* (in <think> tags within content).\n*\n* @param message - The AI message containing Groq-formatted content\n* @returns Array of content blocks in v1 standard format\n*\n* @example\n* ```typescript\n* // Parsed format (reasoning_format=\"parsed\")\n* const message = new AIMessage({\n* content: \"The answer is 42\",\n* additional_kwargs: { reasoning: \"Let me think about this...\" }\n* });\n* const standardBlocks = convertToV1FromGroqMessage(message);\n* // Returns:\n* // [\n* // { type: \"reasoning\", reasoning: \"Let me think about this...\" },\n* // { type: \"text\", text: \"The answer is 42\" }\n* // ]\n* ```\n*\n* @example\n* ```typescript\n* // Raw format (reasoning_format=\"raw\")\n* const message = new AIMessage({\n* content: \"<think>Let me think...</think>The answer is 42\"\n* });\n* const standardBlocks = convertToV1FromGroqMessage(message);\n* // Returns:\n* // [\n* // { type: \"reasoning\", reasoning: \"Let me think...\" },\n* // { type: \"text\", text: \"The answer is 42\" }\n* // ]\n* ```\n*/\nfunction convertToV1FromGroqMessage(message) {\n\tconst blocks = [];\n\tconst parsedReasoning = message.additional_kwargs?.reasoning;\n\tif (_isString(parsedReasoning) && parsedReasoning.length > 0) blocks.push({\n\t\ttype: \"reasoning\",\n\t\treasoning: parsedReasoning\n\t});\n\tif (typeof message.content === \"string\") {\n\t\tlet textContent = message.content;\n\t\tconst thinkMatch = textContent.match(/<think>([\\s\\S]*?)<\\/think>/);\n\t\tif (thinkMatch) {\n\t\t\tconst thinkingContent = thinkMatch[1].trim();\n\t\t\tif (thinkingContent.length > 0) blocks.push({\n\t\t\t\ttype: \"reasoning\",\n\t\t\t\treasoning: thinkingContent\n\t\t\t});\n\t\t\ttextContent = textContent.replace(/<think>[\\s\\S]*?<\\/think>/, \"\").trim();\n\t\t}\n\t\tif (textContent.length > 0) blocks.push({\n\t\t\ttype: \"text\",\n\t\t\ttext: textContent\n\t\t});\n\t} else for (const block of message.content) if (typeof block === \"object\" && \"type\" in block && block.type === \"text\" && \"text\" in block && _isString(block.text)) {\n\t\tlet textContent = block.text;\n\t\tconst thinkMatch = textContent.match(/<think>([\\s\\S]*?)<\\/think>/);\n\t\tif (thinkMatch) {\n\t\t\tconst thinkingContent = thinkMatch[1].trim();\n\t\t\tif (thinkingContent.length > 0) blocks.push({\n\t\t\t\ttype: \"reasoning\",\n\t\t\t\treasoning: thinkingContent\n\t\t\t});\n\t\t\ttextContent = textContent.replace(/<think>[\\s\\S]*?<\\/think>/, \"\").trim();\n\t\t}\n\t\tif (textContent.length > 0) blocks.push({\n\t\t\ttype: \"text\",\n\t\t\ttext: textContent\n\t\t});\n\t}\n\tfor (const toolCall of message.tool_calls ?? []) blocks.push({\n\t\ttype: \"tool_call\",\n\t\tid: toolCall.id,\n\t\tname: toolCall.name,\n\t\targs: toolCall.args\n\t});\n\treturn blocks;\n}\nconst ChatGroqTranslator = {\n\ttranslateContent: convertToV1FromGroqMessage,\n\ttranslateContentChunk: convertToV1FromGroqMessage\n};\n\n//#endregion\nexport { ChatGroqTranslator };\n//# sourceMappingURL=groq.js.map"],"names":[],"mappings":";AA2CA,SAAS,2BAA2B,SAAS;AAC5C,QAAM,SAAS,CAAA;AACf,QAAM,kBAAkB,QAAQ,mBAAmB;AACnD,MAAI,UAAU,eAAe,KAAK,gBAAgB,SAAS,EAAG,QAAO,KAAK;AAAA,IACzE,MAAM;AAAA,IACN,WAAW;AAAA,EACb,CAAE;AACD,MAAI,OAAO,QAAQ,YAAY,UAAU;AACxC,QAAI,cAAc,QAAQ;AAC1B,UAAM,aAAa,YAAY,MAAM,4BAA4B;AACjE,QAAI,YAAY;AACf,YAAM,kBAAkB,WAAW,CAAC,EAAE,KAAI;AAC1C,UAAI,gBAAgB,SAAS,EAAG,QAAO,KAAK;AAAA,QAC3C,MAAM;AAAA,QACN,WAAW;AAAA,MACf,CAAI;AACD,oBAAc,YAAY,QAAQ,4BAA4B,EAAE,EAAE,KAAI;AAAA,IACvE;AACA,QAAI,YAAY,SAAS,EAAG,QAAO,KAAK;AAAA,MACvC,MAAM;AAAA,MACN,MAAM;AAAA,IACT,CAAG;AAAA,EACF,MAAO,YAAW,SAAS,QAAQ,QAAS,KAAI,OAAO,UAAU,YAAY,UAAU,SAAS,MAAM,SAAS,UAAU,UAAU,SAAS,UAAU,MAAM,IAAI,GAAG;AAClK,QAAI,cAAc,MAAM;AACxB,UAAM,aAAa,YAAY,MAAM,4BAA4B;AACjE,QAAI,YAAY;AACf,YAAM,kBAAkB,WAAW,CAAC,EAAE,KAAI;AAC1C,UAAI,gBAAgB,SAAS,EAAG,QAAO,KAAK;AAAA,QAC3C,MAAM;AAAA,QACN,WAAW;AAAA,MACf,CAAI;AACD,oBAAc,YAAY,QAAQ,4BAA4B,EAAE,EAAE,KAAI;AAAA,IACvE;AACA,QAAI,YAAY,SAAS,EAAG,QAAO,KAAK;AAAA,MACvC,MAAM;AAAA,MACN,MAAM;AAAA,IACT,CAAG;AAAA,EACF;AACA,aAAW,YAAY,QAAQ,cAAc,CAAA,EAAI,QAAO,KAAK;AAAA,IAC5D,MAAM;AAAA,IACN,IAAI,SAAS;AAAA,IACb,MAAM,SAAS;AAAA,IACf,MAAM,SAAS;AAAA,EACjB,CAAE;AACD,SAAO;AACR;AACK,MAAC,qBAAqB;AAAA,EAC1B,kBAAkB;AAAA,EAClB,uBAAuB;AACxB;","x_google_ignoreList":[0]}
|
package/dist/index.es91.js
CHANGED
|
@@ -1,19 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
function
|
|
1
|
+
import { _isString } from "./index.es85.js";
|
|
2
|
+
function convertToV1FromOllamaMessage(message) {
|
|
3
3
|
const blocks = [];
|
|
4
|
-
if (_isObject(message.additional_kwargs?.reasoning)) {
|
|
5
|
-
const reasoning = message.additional_kwargs.reasoning;
|
|
6
|
-
if (_isArray(reasoning.summary)) {
|
|
7
|
-
const summaryText = reasoning.summary.reduce((acc, item) => {
|
|
8
|
-
if (_isObject(item) && _isString(item.text)) return `${acc}${item.text}`;
|
|
9
|
-
return acc;
|
|
10
|
-
}, "");
|
|
11
|
-
if (summaryText.length > 0) blocks.push({
|
|
12
|
-
type: "reasoning",
|
|
13
|
-
reasoning: summaryText
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
4
|
const reasoningContent = message.additional_kwargs?.reasoning_content;
|
|
18
5
|
if (_isString(reasoningContent) && reasoningContent.length > 0) blocks.push({
|
|
19
6
|
type: "reasoning",
|
|
@@ -36,11 +23,11 @@ function convertToV1FromXAIMessage(message) {
|
|
|
36
23
|
});
|
|
37
24
|
return blocks;
|
|
38
25
|
}
|
|
39
|
-
const
|
|
40
|
-
translateContent:
|
|
41
|
-
translateContentChunk:
|
|
26
|
+
const ChatOllamaTranslator = {
|
|
27
|
+
translateContent: convertToV1FromOllamaMessage,
|
|
28
|
+
translateContentChunk: convertToV1FromOllamaMessage
|
|
42
29
|
};
|
|
43
30
|
export {
|
|
44
|
-
|
|
31
|
+
ChatOllamaTranslator
|
|
45
32
|
};
|
|
46
33
|
//# sourceMappingURL=index.es91.js.map
|
package/dist/index.es91.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es91.js","sources":["../node_modules/.pnpm/@langchain+core@1.1.13_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/
|
|
1
|
+
{"version":3,"file":"index.es91.js","sources":["../node_modules/.pnpm/@langchain+core@1.1.13_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/ollama.js"],"sourcesContent":["import { _isString } from \"./utils.js\";\n\n//#region src/messages/block_translators/ollama.ts\n/**\n* Converts an Ollama AI message to an array of v1 standard content blocks.\n*\n* This function processes an AI message from Ollama's API format\n* and converts it to the standardized v1 content block format. It handles\n* the reasoning_content in additional_kwargs (populated when think mode is enabled).\n*\n* @param message - The AI message containing Ollama-formatted content\n* @returns Array of content blocks in v1 standard format\n*\n* @example\n* ```typescript\n* const message = new AIMessage({\n* content: \"The answer is 42\",\n* additional_kwargs: { reasoning_content: \"Let me think about this...\" }\n* });\n* const standardBlocks = convertToV1FromOllamaMessage(message);\n* // Returns:\n* // [\n* // { type: \"reasoning\", reasoning: \"Let me think about this...\" },\n* // { type: \"text\", text: \"The answer is 42\" }\n* // ]\n* ```\n*/\nfunction convertToV1FromOllamaMessage(message) {\n\tconst blocks = [];\n\tconst reasoningContent = message.additional_kwargs?.reasoning_content;\n\tif (_isString(reasoningContent) && reasoningContent.length > 0) blocks.push({\n\t\ttype: \"reasoning\",\n\t\treasoning: reasoningContent\n\t});\n\tif (typeof message.content === \"string\") {\n\t\tif (message.content.length > 0) blocks.push({\n\t\t\ttype: \"text\",\n\t\t\ttext: message.content\n\t\t});\n\t} else for (const block of message.content) if (typeof block === \"object\" && \"type\" in block && block.type === \"text\" && \"text\" in block && _isString(block.text)) blocks.push({\n\t\ttype: \"text\",\n\t\ttext: block.text\n\t});\n\tfor (const toolCall of message.tool_calls ?? []) blocks.push({\n\t\ttype: \"tool_call\",\n\t\tid: toolCall.id,\n\t\tname: toolCall.name,\n\t\targs: toolCall.args\n\t});\n\treturn blocks;\n}\nconst ChatOllamaTranslator = {\n\ttranslateContent: convertToV1FromOllamaMessage,\n\ttranslateContentChunk: convertToV1FromOllamaMessage\n};\n\n//#endregion\nexport { ChatOllamaTranslator };\n//# sourceMappingURL=ollama.js.map"],"names":[],"mappings":";AA2BA,SAAS,6BAA6B,SAAS;AAC9C,QAAM,SAAS,CAAA;AACf,QAAM,mBAAmB,QAAQ,mBAAmB;AACpD,MAAI,UAAU,gBAAgB,KAAK,iBAAiB,SAAS,EAAG,QAAO,KAAK;AAAA,IAC3E,MAAM;AAAA,IACN,WAAW;AAAA,EACb,CAAE;AACD,MAAI,OAAO,QAAQ,YAAY,UAAU;AACxC,QAAI,QAAQ,QAAQ,SAAS,EAAG,QAAO,KAAK;AAAA,MAC3C,MAAM;AAAA,MACN,MAAM,QAAQ;AAAA,IACjB,CAAG;AAAA,EACF,MAAO,YAAW,SAAS,QAAQ,QAAS,KAAI,OAAO,UAAU,YAAY,UAAU,SAAS,MAAM,SAAS,UAAU,UAAU,SAAS,UAAU,MAAM,IAAI,EAAG,QAAO,KAAK;AAAA,IAC9K,MAAM;AAAA,IACN,MAAM,MAAM;AAAA,EACd,CAAE;AACD,aAAW,YAAY,QAAQ,cAAc,CAAA,EAAI,QAAO,KAAK;AAAA,IAC5D,MAAM;AAAA,IACN,IAAI,SAAS;AAAA,IACb,MAAM,SAAS;AAAA,IACf,MAAM,SAAS;AAAA,EACjB,CAAE;AACD,SAAO;AACR;AACK,MAAC,uBAAuB;AAAA,EAC5B,kBAAkB;AAAA,EAClB,uBAAuB;AACxB;","x_google_ignoreList":[0]}
|