@langchain/core 1.0.0-alpha.4 → 1.0.0-alpha.6
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/agents.d.ts.map +1 -1
- package/dist/caches/base.d.cts.map +1 -1
- package/dist/caches/base.d.ts.map +1 -1
- package/dist/callbacks/base.d.cts.map +1 -1
- package/dist/language_models/chat_models.d.cts.map +1 -1
- package/dist/language_models/chat_models.d.ts.map +1 -1
- package/dist/load/import_map.cjs +1 -1
- package/dist/load/import_map.js +1 -1
- package/dist/messages/ai.cjs +19 -14
- package/dist/messages/ai.cjs.map +1 -1
- package/dist/messages/ai.js +19 -14
- package/dist/messages/ai.js.map +1 -1
- package/dist/messages/base.cjs +9 -2
- package/dist/messages/base.cjs.map +1 -1
- package/dist/messages/base.d.cts +2 -2
- package/dist/messages/base.d.cts.map +1 -1
- package/dist/messages/base.d.ts +2 -2
- package/dist/messages/base.d.ts.map +1 -1
- package/dist/messages/base.js +9 -2
- package/dist/messages/base.js.map +1 -1
- package/dist/messages/block_translators/bedrock_converse.cjs +213 -0
- package/dist/messages/block_translators/bedrock_converse.cjs.map +1 -0
- package/dist/messages/block_translators/bedrock_converse.js +213 -0
- package/dist/messages/block_translators/bedrock_converse.js.map +1 -0
- package/dist/messages/block_translators/google_genai.cjs +73 -0
- package/dist/messages/block_translators/google_genai.cjs.map +1 -0
- package/dist/messages/block_translators/google_genai.js +73 -0
- package/dist/messages/block_translators/google_genai.js.map +1 -0
- package/dist/messages/block_translators/google_vertexai.cjs +74 -0
- package/dist/messages/block_translators/google_vertexai.cjs.map +1 -0
- package/dist/messages/block_translators/google_vertexai.js +74 -0
- package/dist/messages/block_translators/google_vertexai.js.map +1 -0
- package/dist/messages/block_translators/index.cjs +10 -1
- package/dist/messages/block_translators/index.cjs.map +1 -1
- package/dist/messages/block_translators/index.js +10 -1
- package/dist/messages/block_translators/index.js.map +1 -1
- package/dist/messages/block_translators/utils.cjs +4 -0
- package/dist/messages/block_translators/utils.cjs.map +1 -1
- package/dist/messages/block_translators/utils.js +4 -1
- package/dist/messages/block_translators/utils.js.map +1 -1
- package/dist/messages/content/index.cjs.map +1 -1
- package/dist/messages/content/index.d.cts +20 -1
- package/dist/messages/content/index.d.cts.map +1 -1
- package/dist/messages/content/index.d.ts +20 -1
- package/dist/messages/content/index.d.ts.map +1 -1
- package/dist/messages/content/index.js.map +1 -1
- package/dist/messages/content/tools.cjs +3 -0
- package/dist/messages/content/tools.cjs.map +1 -1
- package/dist/messages/content/tools.d.cts +67 -6
- package/dist/messages/content/tools.d.cts.map +1 -1
- package/dist/messages/content/tools.d.ts +67 -6
- package/dist/messages/content/tools.d.ts.map +1 -1
- package/dist/messages/content/tools.js +3 -0
- package/dist/messages/content/tools.js.map +1 -1
- package/dist/messages/index.cjs +4 -0
- package/dist/messages/index.cjs.map +1 -1
- package/dist/messages/index.d.cts +2 -2
- package/dist/messages/index.d.ts +2 -2
- package/dist/messages/index.js +4 -2
- package/dist/messages/index.js.map +1 -1
- package/dist/messages/message.cjs.map +1 -1
- package/dist/messages/message.d.cts +6 -6
- package/dist/messages/message.d.cts.map +1 -1
- package/dist/messages/message.d.ts +6 -6
- package/dist/messages/message.d.ts.map +1 -1
- package/dist/messages/message.js.map +1 -1
- package/dist/messages/tool.cjs.map +1 -1
- package/dist/messages/tool.d.cts +3 -1
- package/dist/messages/tool.d.cts.map +1 -1
- package/dist/messages/tool.d.ts +3 -1
- package/dist/messages/tool.d.ts.map +1 -1
- package/dist/messages/tool.js.map +1 -1
- package/dist/utils/testing/chat_models.cjs +245 -0
- package/dist/utils/testing/chat_models.cjs.map +1 -0
- package/dist/utils/testing/chat_models.d.cts +134 -0
- package/dist/utils/testing/chat_models.d.cts.map +1 -0
- package/dist/utils/testing/chat_models.d.ts +134 -0
- package/dist/utils/testing/chat_models.d.ts.map +1 -0
- package/dist/utils/testing/chat_models.js +243 -0
- package/dist/utils/testing/chat_models.js.map +1 -0
- package/dist/utils/testing/embeddings.cjs +90 -0
- package/dist/utils/testing/embeddings.cjs.map +1 -0
- package/dist/utils/testing/embeddings.d.cts +58 -0
- package/dist/utils/testing/embeddings.d.cts.map +1 -0
- package/dist/utils/testing/embeddings.d.ts +58 -0
- package/dist/utils/testing/embeddings.d.ts.map +1 -0
- package/dist/utils/testing/embeddings.js +89 -0
- package/dist/utils/testing/embeddings.js.map +1 -0
- package/dist/utils/testing/index.cjs +42 -655
- package/dist/utils/testing/index.cjs.map +1 -1
- package/dist/utils/testing/index.d.cts +11 -379
- package/dist/utils/testing/index.d.ts +11 -379
- package/dist/utils/testing/index.js +10 -623
- package/dist/utils/testing/index.js.map +1 -1
- package/dist/utils/testing/llms.cjs +59 -0
- package/dist/utils/testing/llms.cjs.map +1 -0
- package/dist/utils/testing/llms.d.cts +31 -0
- package/dist/utils/testing/llms.d.cts.map +1 -0
- package/dist/utils/testing/llms.d.ts +31 -0
- package/dist/utils/testing/llms.d.ts.map +1 -0
- package/dist/utils/testing/llms.js +58 -0
- package/dist/utils/testing/llms.js.map +1 -0
- package/dist/utils/testing/message_history.cjs +67 -0
- package/dist/utils/testing/message_history.cjs.map +1 -0
- package/dist/utils/testing/message_history.d.cts +31 -0
- package/dist/utils/testing/message_history.d.cts.map +1 -0
- package/dist/utils/testing/message_history.d.ts +31 -0
- package/dist/utils/testing/message_history.d.ts.map +1 -0
- package/dist/utils/testing/message_history.js +65 -0
- package/dist/utils/testing/message_history.js.map +1 -0
- package/dist/utils/testing/output_parsers.cjs +20 -0
- package/dist/utils/testing/output_parsers.cjs.map +1 -0
- package/dist/utils/testing/output_parsers.d.cts +16 -0
- package/dist/utils/testing/output_parsers.d.cts.map +1 -0
- package/dist/utils/testing/output_parsers.d.ts +16 -0
- package/dist/utils/testing/output_parsers.d.ts.map +1 -0
- package/dist/utils/testing/output_parsers.js +20 -0
- package/dist/utils/testing/output_parsers.js.map +1 -0
- package/dist/utils/testing/retrievers.cjs +19 -0
- package/dist/utils/testing/retrievers.cjs.map +1 -0
- package/dist/utils/testing/retrievers.d.cts +17 -0
- package/dist/utils/testing/retrievers.d.cts.map +1 -0
- package/dist/utils/testing/retrievers.d.ts +17 -0
- package/dist/utils/testing/retrievers.d.ts.map +1 -0
- package/dist/utils/testing/retrievers.js +19 -0
- package/dist/utils/testing/retrievers.js.map +1 -0
- package/dist/utils/testing/runnables.cjs +19 -0
- package/dist/utils/testing/runnables.cjs.map +1 -0
- package/dist/utils/testing/runnables.d.cts +15 -0
- package/dist/utils/testing/runnables.d.cts.map +1 -0
- package/dist/utils/testing/runnables.d.ts +15 -0
- package/dist/utils/testing/runnables.d.ts.map +1 -0
- package/dist/utils/testing/runnables.js +19 -0
- package/dist/utils/testing/runnables.js.map +1 -0
- package/dist/utils/testing/tools.cjs +21 -0
- package/dist/utils/testing/tools.cjs.map +1 -0
- package/dist/utils/testing/tools.d.cts +21 -0
- package/dist/utils/testing/tools.d.cts.map +1 -0
- package/dist/utils/testing/tools.d.ts +21 -0
- package/dist/utils/testing/tools.d.ts.map +1 -0
- package/dist/utils/testing/tools.js +21 -0
- package/dist/utils/testing/tools.js.map +1 -0
- package/dist/utils/testing/tracers.cjs +25 -0
- package/dist/utils/testing/tracers.cjs.map +1 -0
- package/dist/utils/testing/tracers.d.cts +15 -0
- package/dist/utils/testing/tracers.d.cts.map +1 -0
- package/dist/utils/testing/tracers.d.ts +15 -0
- package/dist/utils/testing/tracers.d.ts.map +1 -0
- package/dist/utils/testing/tracers.js +25 -0
- package/dist/utils/testing/tracers.js.map +1 -0
- package/dist/utils/testing/vectorstores.cjs +129 -0
- package/dist/utils/testing/vectorstores.cjs.map +1 -0
- package/dist/utils/testing/vectorstores.d.cts +101 -0
- package/dist/utils/testing/vectorstores.d.cts.map +1 -0
- package/dist/utils/testing/vectorstores.d.ts +101 -0
- package/dist/utils/testing/vectorstores.d.ts.map +1 -0
- package/dist/utils/testing/vectorstores.js +129 -0
- package/dist/utils/testing/vectorstores.js.map +1 -0
- package/dist/utils/types/index.cjs +2 -0
- package/dist/utils/types/index.d.cts +2 -2
- package/dist/utils/types/index.d.ts +2 -2
- package/dist/utils/types/index.js +3 -2
- package/dist/utils/types/zod.cjs +39 -3
- package/dist/utils/types/zod.cjs.map +1 -1
- package/dist/utils/types/zod.d.cts +18 -1
- package/dist/utils/types/zod.d.cts.map +1 -1
- package/dist/utils/types/zod.d.ts +18 -1
- package/dist/utils/types/zod.d.ts.map +1 -1
- package/dist/utils/types/zod.js +39 -4
- package/dist/utils/types/zod.js.map +1 -1
- package/package.json +1 -1
- package/dist/utils/testing/index.d.cts.map +0 -1
- package/dist/utils/testing/index.d.ts.map +0 -1
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
const require_utils = require('./utils.cjs');
|
|
2
|
+
|
|
3
|
+
//#region src/messages/block_translators/google_genai.ts
|
|
4
|
+
function convertToV1FromChatGoogleMessage(message) {
|
|
5
|
+
function* iterateContent() {
|
|
6
|
+
const content = typeof message.content === "string" ? [{
|
|
7
|
+
type: "text",
|
|
8
|
+
text: message.content
|
|
9
|
+
}] : message.content;
|
|
10
|
+
for (const block of content) {
|
|
11
|
+
if (require_utils._isContentBlock(block, "text") && require_utils._isString(block.text)) {
|
|
12
|
+
yield {
|
|
13
|
+
type: "text",
|
|
14
|
+
text: block.text
|
|
15
|
+
};
|
|
16
|
+
continue;
|
|
17
|
+
} else if (require_utils._isContentBlock(block, "inlineData") && require_utils._isObject(block.inlineData) && require_utils._isString(block.inlineData.mimeType) && require_utils._isString(block.inlineData.data)) {
|
|
18
|
+
yield {
|
|
19
|
+
type: "file",
|
|
20
|
+
mimeType: block.inlineData.mimeType,
|
|
21
|
+
data: block.inlineData.data
|
|
22
|
+
};
|
|
23
|
+
continue;
|
|
24
|
+
} else if (require_utils._isContentBlock(block, "functionCall") && require_utils._isObject(block.functionCall) && require_utils._isString(block.functionCall.name) && require_utils._isObject(block.functionCall.args)) {
|
|
25
|
+
yield {
|
|
26
|
+
type: "tool_call",
|
|
27
|
+
id: message.id,
|
|
28
|
+
name: block.functionCall.name,
|
|
29
|
+
args: block.functionCall.args
|
|
30
|
+
};
|
|
31
|
+
continue;
|
|
32
|
+
} else if (require_utils._isContentBlock(block, "functionResponse")) {
|
|
33
|
+
yield {
|
|
34
|
+
type: "non_standard",
|
|
35
|
+
value: block
|
|
36
|
+
};
|
|
37
|
+
continue;
|
|
38
|
+
} else if (require_utils._isContentBlock(block, "fileData") && require_utils._isObject(block.fileData) && require_utils._isString(block.fileData.mimeType) && require_utils._isString(block.fileData.fileUri)) {
|
|
39
|
+
yield {
|
|
40
|
+
type: "file",
|
|
41
|
+
mimeType: block.fileData.mimeType,
|
|
42
|
+
fileId: block.fileData.fileUri
|
|
43
|
+
};
|
|
44
|
+
continue;
|
|
45
|
+
} else if (require_utils._isContentBlock(block, "executableCode")) {
|
|
46
|
+
yield {
|
|
47
|
+
type: "non_standard",
|
|
48
|
+
value: block
|
|
49
|
+
};
|
|
50
|
+
continue;
|
|
51
|
+
} else if (require_utils._isContentBlock(block, "codeExecutionResult")) {
|
|
52
|
+
yield {
|
|
53
|
+
type: "non_standard",
|
|
54
|
+
value: block
|
|
55
|
+
};
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
yield {
|
|
59
|
+
type: "non_standard",
|
|
60
|
+
value: block
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return Array.from(iterateContent());
|
|
65
|
+
}
|
|
66
|
+
const ChatGoogleGenAITranslator = {
|
|
67
|
+
translateContent: convertToV1FromChatGoogleMessage,
|
|
68
|
+
translateContentChunk: convertToV1FromChatGoogleMessage
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
//#endregion
|
|
72
|
+
exports.ChatGoogleGenAITranslator = ChatGoogleGenAITranslator;
|
|
73
|
+
//# sourceMappingURL=google_genai.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"google_genai.cjs","names":["message: AIMessage","_isContentBlock","_isString","_isObject","ChatGoogleGenAITranslator: StandardContentBlockTranslator"],"sources":["../../../src/messages/block_translators/google_genai.ts"],"sourcesContent":["import { AIMessage } from \"../ai.js\";\nimport { ContentBlock } from \"../content/index.js\";\nimport type { StandardContentBlockTranslator } from \"./index.js\";\nimport { _isContentBlock, _isObject, _isString } from \"./utils.js\";\n\nfunction convertToV1FromChatGoogleMessage(\n message: AIMessage\n): Array<ContentBlock.Standard> {\n // see `libs/providers/langchain-google-genai/src/utils/common.ts:mapGenerateContentResultToChatResult\n function* iterateContent(): Iterable<ContentBlock.Standard> {\n const content =\n typeof message.content === \"string\"\n ? [{ type: \"text\", text: message.content }]\n : message.content;\n for (const block of content) {\n if (_isContentBlock(block, \"text\") && _isString(block.text)) {\n yield { type: \"text\", text: block.text };\n continue;\n } else if (\n _isContentBlock(block, \"inlineData\") &&\n _isObject(block.inlineData) &&\n _isString(block.inlineData.mimeType) &&\n _isString(block.inlineData.data)\n ) {\n yield {\n type: \"file\",\n mimeType: block.inlineData.mimeType,\n data: block.inlineData.data,\n };\n continue;\n } else if (\n _isContentBlock(block, \"functionCall\") &&\n _isObject(block.functionCall) &&\n _isString(block.functionCall.name) &&\n _isObject(block.functionCall.args)\n ) {\n yield {\n type: \"tool_call\",\n id: message.id,\n name: block.functionCall.name,\n args: block.functionCall.args,\n };\n continue;\n } else if (_isContentBlock(block, \"functionResponse\")) {\n yield { type: \"non_standard\", value: block };\n continue;\n } else if (\n _isContentBlock(block, \"fileData\") &&\n _isObject(block.fileData) &&\n _isString(block.fileData.mimeType) &&\n _isString(block.fileData.fileUri)\n ) {\n yield {\n type: \"file\",\n mimeType: block.fileData.mimeType,\n fileId: block.fileData.fileUri,\n };\n continue;\n } else if (_isContentBlock(block, \"executableCode\")) {\n yield { type: \"non_standard\", value: block };\n continue;\n } else if (_isContentBlock(block, \"codeExecutionResult\")) {\n yield { type: \"non_standard\", value: block };\n continue;\n }\n yield { type: \"non_standard\", value: block };\n }\n }\n return Array.from(iterateContent());\n}\n\nexport const ChatGoogleGenAITranslator: StandardContentBlockTranslator = {\n translateContent: convertToV1FromChatGoogleMessage,\n translateContentChunk: convertToV1FromChatGoogleMessage,\n};\n"],"mappings":";;;AAKA,SAAS,iCACPA,SAC8B;CAE9B,UAAU,iBAAkD;EAC1D,MAAM,UACJ,OAAO,QAAQ,YAAY,WACvB,CAAC;GAAE,MAAM;GAAQ,MAAM,QAAQ;EAAS,CAAC,IACzC,QAAQ;AACd,OAAK,MAAM,SAAS,SAAS;AAC3B,OAAIC,8BAAgB,OAAO,OAAO,IAAIC,wBAAU,MAAM,KAAK,EAAE;IAC3D,MAAM;KAAE,MAAM;KAAQ,MAAM,MAAM;IAAM;AACxC;GACD,WACCD,8BAAgB,OAAO,aAAa,IACpCE,wBAAU,MAAM,WAAW,IAC3BD,wBAAU,MAAM,WAAW,SAAS,IACpCA,wBAAU,MAAM,WAAW,KAAK,EAChC;IACA,MAAM;KACJ,MAAM;KACN,UAAU,MAAM,WAAW;KAC3B,MAAM,MAAM,WAAW;IACxB;AACD;GACD,WACCD,8BAAgB,OAAO,eAAe,IACtCE,wBAAU,MAAM,aAAa,IAC7BD,wBAAU,MAAM,aAAa,KAAK,IAClCC,wBAAU,MAAM,aAAa,KAAK,EAClC;IACA,MAAM;KACJ,MAAM;KACN,IAAI,QAAQ;KACZ,MAAM,MAAM,aAAa;KACzB,MAAM,MAAM,aAAa;IAC1B;AACD;GACD,WAAUF,8BAAgB,OAAO,mBAAmB,EAAE;IACrD,MAAM;KAAE,MAAM;KAAgB,OAAO;IAAO;AAC5C;GACD,WACCA,8BAAgB,OAAO,WAAW,IAClCE,wBAAU,MAAM,SAAS,IACzBD,wBAAU,MAAM,SAAS,SAAS,IAClCA,wBAAU,MAAM,SAAS,QAAQ,EACjC;IACA,MAAM;KACJ,MAAM;KACN,UAAU,MAAM,SAAS;KACzB,QAAQ,MAAM,SAAS;IACxB;AACD;GACD,WAAUD,8BAAgB,OAAO,iBAAiB,EAAE;IACnD,MAAM;KAAE,MAAM;KAAgB,OAAO;IAAO;AAC5C;GACD,WAAUA,8BAAgB,OAAO,sBAAsB,EAAE;IACxD,MAAM;KAAE,MAAM;KAAgB,OAAO;IAAO;AAC5C;GACD;GACD,MAAM;IAAE,MAAM;IAAgB,OAAO;GAAO;EAC7C;CACF;AACD,QAAO,MAAM,KAAK,gBAAgB,CAAC;AACpC;AAED,MAAaG,4BAA4D;CACvE,kBAAkB;CAClB,uBAAuB;AACxB"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { _isContentBlock, _isObject, _isString } from "./utils.js";
|
|
2
|
+
|
|
3
|
+
//#region src/messages/block_translators/google_genai.ts
|
|
4
|
+
function convertToV1FromChatGoogleMessage(message) {
|
|
5
|
+
function* iterateContent() {
|
|
6
|
+
const content = typeof message.content === "string" ? [{
|
|
7
|
+
type: "text",
|
|
8
|
+
text: message.content
|
|
9
|
+
}] : message.content;
|
|
10
|
+
for (const block of content) {
|
|
11
|
+
if (_isContentBlock(block, "text") && _isString(block.text)) {
|
|
12
|
+
yield {
|
|
13
|
+
type: "text",
|
|
14
|
+
text: block.text
|
|
15
|
+
};
|
|
16
|
+
continue;
|
|
17
|
+
} else if (_isContentBlock(block, "inlineData") && _isObject(block.inlineData) && _isString(block.inlineData.mimeType) && _isString(block.inlineData.data)) {
|
|
18
|
+
yield {
|
|
19
|
+
type: "file",
|
|
20
|
+
mimeType: block.inlineData.mimeType,
|
|
21
|
+
data: block.inlineData.data
|
|
22
|
+
};
|
|
23
|
+
continue;
|
|
24
|
+
} else if (_isContentBlock(block, "functionCall") && _isObject(block.functionCall) && _isString(block.functionCall.name) && _isObject(block.functionCall.args)) {
|
|
25
|
+
yield {
|
|
26
|
+
type: "tool_call",
|
|
27
|
+
id: message.id,
|
|
28
|
+
name: block.functionCall.name,
|
|
29
|
+
args: block.functionCall.args
|
|
30
|
+
};
|
|
31
|
+
continue;
|
|
32
|
+
} else if (_isContentBlock(block, "functionResponse")) {
|
|
33
|
+
yield {
|
|
34
|
+
type: "non_standard",
|
|
35
|
+
value: block
|
|
36
|
+
};
|
|
37
|
+
continue;
|
|
38
|
+
} else if (_isContentBlock(block, "fileData") && _isObject(block.fileData) && _isString(block.fileData.mimeType) && _isString(block.fileData.fileUri)) {
|
|
39
|
+
yield {
|
|
40
|
+
type: "file",
|
|
41
|
+
mimeType: block.fileData.mimeType,
|
|
42
|
+
fileId: block.fileData.fileUri
|
|
43
|
+
};
|
|
44
|
+
continue;
|
|
45
|
+
} else if (_isContentBlock(block, "executableCode")) {
|
|
46
|
+
yield {
|
|
47
|
+
type: "non_standard",
|
|
48
|
+
value: block
|
|
49
|
+
};
|
|
50
|
+
continue;
|
|
51
|
+
} else if (_isContentBlock(block, "codeExecutionResult")) {
|
|
52
|
+
yield {
|
|
53
|
+
type: "non_standard",
|
|
54
|
+
value: block
|
|
55
|
+
};
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
yield {
|
|
59
|
+
type: "non_standard",
|
|
60
|
+
value: block
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return Array.from(iterateContent());
|
|
65
|
+
}
|
|
66
|
+
const ChatGoogleGenAITranslator = {
|
|
67
|
+
translateContent: convertToV1FromChatGoogleMessage,
|
|
68
|
+
translateContentChunk: convertToV1FromChatGoogleMessage
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
//#endregion
|
|
72
|
+
export { ChatGoogleGenAITranslator };
|
|
73
|
+
//# sourceMappingURL=google_genai.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"google_genai.js","names":["message: AIMessage","ChatGoogleGenAITranslator: StandardContentBlockTranslator"],"sources":["../../../src/messages/block_translators/google_genai.ts"],"sourcesContent":["import { AIMessage } from \"../ai.js\";\nimport { ContentBlock } from \"../content/index.js\";\nimport type { StandardContentBlockTranslator } from \"./index.js\";\nimport { _isContentBlock, _isObject, _isString } from \"./utils.js\";\n\nfunction convertToV1FromChatGoogleMessage(\n message: AIMessage\n): Array<ContentBlock.Standard> {\n // see `libs/providers/langchain-google-genai/src/utils/common.ts:mapGenerateContentResultToChatResult\n function* iterateContent(): Iterable<ContentBlock.Standard> {\n const content =\n typeof message.content === \"string\"\n ? [{ type: \"text\", text: message.content }]\n : message.content;\n for (const block of content) {\n if (_isContentBlock(block, \"text\") && _isString(block.text)) {\n yield { type: \"text\", text: block.text };\n continue;\n } else if (\n _isContentBlock(block, \"inlineData\") &&\n _isObject(block.inlineData) &&\n _isString(block.inlineData.mimeType) &&\n _isString(block.inlineData.data)\n ) {\n yield {\n type: \"file\",\n mimeType: block.inlineData.mimeType,\n data: block.inlineData.data,\n };\n continue;\n } else if (\n _isContentBlock(block, \"functionCall\") &&\n _isObject(block.functionCall) &&\n _isString(block.functionCall.name) &&\n _isObject(block.functionCall.args)\n ) {\n yield {\n type: \"tool_call\",\n id: message.id,\n name: block.functionCall.name,\n args: block.functionCall.args,\n };\n continue;\n } else if (_isContentBlock(block, \"functionResponse\")) {\n yield { type: \"non_standard\", value: block };\n continue;\n } else if (\n _isContentBlock(block, \"fileData\") &&\n _isObject(block.fileData) &&\n _isString(block.fileData.mimeType) &&\n _isString(block.fileData.fileUri)\n ) {\n yield {\n type: \"file\",\n mimeType: block.fileData.mimeType,\n fileId: block.fileData.fileUri,\n };\n continue;\n } else if (_isContentBlock(block, \"executableCode\")) {\n yield { type: \"non_standard\", value: block };\n continue;\n } else if (_isContentBlock(block, \"codeExecutionResult\")) {\n yield { type: \"non_standard\", value: block };\n continue;\n }\n yield { type: \"non_standard\", value: block };\n }\n }\n return Array.from(iterateContent());\n}\n\nexport const ChatGoogleGenAITranslator: StandardContentBlockTranslator = {\n translateContent: convertToV1FromChatGoogleMessage,\n translateContentChunk: convertToV1FromChatGoogleMessage,\n};\n"],"mappings":";;;AAKA,SAAS,iCACPA,SAC8B;CAE9B,UAAU,iBAAkD;EAC1D,MAAM,UACJ,OAAO,QAAQ,YAAY,WACvB,CAAC;GAAE,MAAM;GAAQ,MAAM,QAAQ;EAAS,CAAC,IACzC,QAAQ;AACd,OAAK,MAAM,SAAS,SAAS;AAC3B,OAAI,gBAAgB,OAAO,OAAO,IAAI,UAAU,MAAM,KAAK,EAAE;IAC3D,MAAM;KAAE,MAAM;KAAQ,MAAM,MAAM;IAAM;AACxC;GACD,WACC,gBAAgB,OAAO,aAAa,IACpC,UAAU,MAAM,WAAW,IAC3B,UAAU,MAAM,WAAW,SAAS,IACpC,UAAU,MAAM,WAAW,KAAK,EAChC;IACA,MAAM;KACJ,MAAM;KACN,UAAU,MAAM,WAAW;KAC3B,MAAM,MAAM,WAAW;IACxB;AACD;GACD,WACC,gBAAgB,OAAO,eAAe,IACtC,UAAU,MAAM,aAAa,IAC7B,UAAU,MAAM,aAAa,KAAK,IAClC,UAAU,MAAM,aAAa,KAAK,EAClC;IACA,MAAM;KACJ,MAAM;KACN,IAAI,QAAQ;KACZ,MAAM,MAAM,aAAa;KACzB,MAAM,MAAM,aAAa;IAC1B;AACD;GACD,WAAU,gBAAgB,OAAO,mBAAmB,EAAE;IACrD,MAAM;KAAE,MAAM;KAAgB,OAAO;IAAO;AAC5C;GACD,WACC,gBAAgB,OAAO,WAAW,IAClC,UAAU,MAAM,SAAS,IACzB,UAAU,MAAM,SAAS,SAAS,IAClC,UAAU,MAAM,SAAS,QAAQ,EACjC;IACA,MAAM;KACJ,MAAM;KACN,UAAU,MAAM,SAAS;KACzB,QAAQ,MAAM,SAAS;IACxB;AACD;GACD,WAAU,gBAAgB,OAAO,iBAAiB,EAAE;IACnD,MAAM;KAAE,MAAM;KAAgB,OAAO;IAAO;AAC5C;GACD,WAAU,gBAAgB,OAAO,sBAAsB,EAAE;IACxD,MAAM;KAAE,MAAM;KAAgB,OAAO;IAAO;AAC5C;GACD;GACD,MAAM;IAAE,MAAM;IAAgB,OAAO;GAAO;EAC7C;CACF;AACD,QAAO,MAAM,KAAK,gBAAgB,CAAC;AACpC;AAED,MAAaC,4BAA4D;CACvE,kBAAkB;CAClB,uBAAuB;AACxB"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
const require_utils = require('./utils.cjs');
|
|
2
|
+
|
|
3
|
+
//#region src/messages/block_translators/google_vertexai.ts
|
|
4
|
+
function convertToV1FromChatVertexMessage(message) {
|
|
5
|
+
function* iterateContent() {
|
|
6
|
+
const content = typeof message.content === "string" ? [{
|
|
7
|
+
type: "text",
|
|
8
|
+
text: message.content
|
|
9
|
+
}] : message.content;
|
|
10
|
+
for (const block of content) {
|
|
11
|
+
if (require_utils._isContentBlock(block, "reasoning") && require_utils._isString(block.reasoning)) {
|
|
12
|
+
const signature = require_utils.iife(() => {
|
|
13
|
+
const reasoningIndex = content.indexOf(block);
|
|
14
|
+
if (require_utils._isArray(message.additional_kwargs?.signatures) && reasoningIndex >= 0) return message.additional_kwargs.signatures.at(reasoningIndex);
|
|
15
|
+
return void 0;
|
|
16
|
+
});
|
|
17
|
+
if (require_utils._isString(signature)) yield {
|
|
18
|
+
type: "reasoning",
|
|
19
|
+
reasoning: block.reasoning,
|
|
20
|
+
signature
|
|
21
|
+
};
|
|
22
|
+
else yield {
|
|
23
|
+
type: "reasoning",
|
|
24
|
+
reasoning: block.reasoning
|
|
25
|
+
};
|
|
26
|
+
continue;
|
|
27
|
+
} else if (require_utils._isContentBlock(block, "text") && require_utils._isString(block.text)) {
|
|
28
|
+
yield {
|
|
29
|
+
type: "text",
|
|
30
|
+
text: block.text
|
|
31
|
+
};
|
|
32
|
+
continue;
|
|
33
|
+
} else if (require_utils._isContentBlock(block, "image_url")) {
|
|
34
|
+
if (require_utils._isString(block.image_url)) if (block.image_url.startsWith("data:")) {
|
|
35
|
+
const dataUrlRegex = /^data:([^;]+);base64,(.+)$/;
|
|
36
|
+
const match = block.image_url.match(dataUrlRegex);
|
|
37
|
+
if (match) yield {
|
|
38
|
+
type: "image",
|
|
39
|
+
data: match[2],
|
|
40
|
+
mimeType: match[1]
|
|
41
|
+
};
|
|
42
|
+
else yield {
|
|
43
|
+
type: "image",
|
|
44
|
+
url: block.image_url
|
|
45
|
+
};
|
|
46
|
+
} else yield {
|
|
47
|
+
type: "image",
|
|
48
|
+
url: block.image_url
|
|
49
|
+
};
|
|
50
|
+
continue;
|
|
51
|
+
} else if (require_utils._isContentBlock(block, "media") && require_utils._isString(block.mimeType) && require_utils._isString(block.data)) {
|
|
52
|
+
yield {
|
|
53
|
+
type: "file",
|
|
54
|
+
mimeType: block.mimeType,
|
|
55
|
+
data: block.data
|
|
56
|
+
};
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
yield {
|
|
60
|
+
type: "non_standard",
|
|
61
|
+
value: block
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return Array.from(iterateContent());
|
|
66
|
+
}
|
|
67
|
+
const ChatVertexTranslator = {
|
|
68
|
+
translateContent: convertToV1FromChatVertexMessage,
|
|
69
|
+
translateContentChunk: convertToV1FromChatVertexMessage
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
//#endregion
|
|
73
|
+
exports.ChatVertexTranslator = ChatVertexTranslator;
|
|
74
|
+
//# sourceMappingURL=google_vertexai.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"google_vertexai.cjs","names":["message: AIMessage","_isContentBlock","_isString","iife","_isArray","ChatVertexTranslator: StandardContentBlockTranslator"],"sources":["../../../src/messages/block_translators/google_vertexai.ts"],"sourcesContent":["import { AIMessage } from \"../ai.js\";\nimport { ContentBlock } from \"../content/index.js\";\nimport type { StandardContentBlockTranslator } from \"./index.js\";\nimport { _isArray, _isContentBlock, _isString, iife } from \"./utils.js\";\n\nfunction convertToV1FromChatVertexMessage(\n message: AIMessage\n): Array<ContentBlock.Standard> {\n // see `/libs/providers/langchain-google-common/src/utils/gemini.ts:partsToMessageContent`\n function* iterateContent(): Iterable<ContentBlock.Standard> {\n const content =\n typeof message.content === \"string\"\n ? [{ type: \"text\", text: message.content }]\n : message.content;\n for (const block of content) {\n if (_isContentBlock(block, \"reasoning\") && _isString(block.reasoning)) {\n const signature = iife(() => {\n const reasoningIndex = content.indexOf(block);\n if (\n _isArray(message.additional_kwargs?.signatures) &&\n reasoningIndex >= 0\n ) {\n return message.additional_kwargs.signatures.at(reasoningIndex);\n }\n return undefined;\n });\n if (_isString(signature)) {\n yield {\n type: \"reasoning\",\n reasoning: block.reasoning,\n signature,\n };\n } else {\n yield {\n type: \"reasoning\",\n reasoning: block.reasoning,\n };\n }\n continue;\n } else if (_isContentBlock(block, \"text\") && _isString(block.text)) {\n yield { type: \"text\", text: block.text };\n continue;\n } else if (_isContentBlock(block, \"image_url\")) {\n if (_isString(block.image_url)) {\n if (block.image_url.startsWith(\"data:\")) {\n const dataUrlRegex = /^data:([^;]+);base64,(.+)$/;\n const match = block.image_url.match(dataUrlRegex);\n if (match) {\n yield { type: \"image\", data: match[2], mimeType: match[1] };\n } else {\n yield { type: \"image\", url: block.image_url };\n }\n } else {\n yield { type: \"image\", url: block.image_url };\n }\n }\n continue;\n } else if (\n _isContentBlock(block, \"media\") &&\n _isString(block.mimeType) &&\n _isString(block.data)\n ) {\n yield { type: \"file\", mimeType: block.mimeType, data: block.data };\n continue;\n }\n yield { type: \"non_standard\", value: block };\n }\n }\n return Array.from(iterateContent());\n}\n\nexport const ChatVertexTranslator: StandardContentBlockTranslator = {\n translateContent: convertToV1FromChatVertexMessage,\n translateContentChunk: convertToV1FromChatVertexMessage,\n};\n"],"mappings":";;;AAKA,SAAS,iCACPA,SAC8B;CAE9B,UAAU,iBAAkD;EAC1D,MAAM,UACJ,OAAO,QAAQ,YAAY,WACvB,CAAC;GAAE,MAAM;GAAQ,MAAM,QAAQ;EAAS,CAAC,IACzC,QAAQ;AACd,OAAK,MAAM,SAAS,SAAS;AAC3B,OAAIC,8BAAgB,OAAO,YAAY,IAAIC,wBAAU,MAAM,UAAU,EAAE;IACrE,MAAM,YAAYC,mBAAK,MAAM;KAC3B,MAAM,iBAAiB,QAAQ,QAAQ,MAAM;AAC7C,SACEC,uBAAS,QAAQ,mBAAmB,WAAW,IAC/C,kBAAkB,EAElB,QAAO,QAAQ,kBAAkB,WAAW,GAAG,eAAe;AAEhE,YAAO;IACR,EAAC;AACF,QAAIF,wBAAU,UAAU,EACtB,MAAM;KACJ,MAAM;KACN,WAAW,MAAM;KACjB;IACD;SAED,MAAM;KACJ,MAAM;KACN,WAAW,MAAM;IAClB;AAEH;GACD,WAAUD,8BAAgB,OAAO,OAAO,IAAIC,wBAAU,MAAM,KAAK,EAAE;IAClE,MAAM;KAAE,MAAM;KAAQ,MAAM,MAAM;IAAM;AACxC;GACD,WAAUD,8BAAgB,OAAO,YAAY,EAAE;AAC9C,QAAIC,wBAAU,MAAM,UAAU,CAC5B,KAAI,MAAM,UAAU,WAAW,QAAQ,EAAE;KACvC,MAAM,eAAe;KACrB,MAAM,QAAQ,MAAM,UAAU,MAAM,aAAa;AACjD,SAAI,OACF,MAAM;MAAE,MAAM;MAAS,MAAM,MAAM;MAAI,UAAU,MAAM;KAAI;UAE3D,MAAM;MAAE,MAAM;MAAS,KAAK,MAAM;KAAW;IAEhD,OACC,MAAM;KAAE,MAAM;KAAS,KAAK,MAAM;IAAW;AAGjD;GACD,WACCD,8BAAgB,OAAO,QAAQ,IAC/BC,wBAAU,MAAM,SAAS,IACzBA,wBAAU,MAAM,KAAK,EACrB;IACA,MAAM;KAAE,MAAM;KAAQ,UAAU,MAAM;KAAU,MAAM,MAAM;IAAM;AAClE;GACD;GACD,MAAM;IAAE,MAAM;IAAgB,OAAO;GAAO;EAC7C;CACF;AACD,QAAO,MAAM,KAAK,gBAAgB,CAAC;AACpC;AAED,MAAaG,uBAAuD;CAClE,kBAAkB;CAClB,uBAAuB;AACxB"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { _isArray, _isContentBlock, _isString, iife } from "./utils.js";
|
|
2
|
+
|
|
3
|
+
//#region src/messages/block_translators/google_vertexai.ts
|
|
4
|
+
function convertToV1FromChatVertexMessage(message) {
|
|
5
|
+
function* iterateContent() {
|
|
6
|
+
const content = typeof message.content === "string" ? [{
|
|
7
|
+
type: "text",
|
|
8
|
+
text: message.content
|
|
9
|
+
}] : message.content;
|
|
10
|
+
for (const block of content) {
|
|
11
|
+
if (_isContentBlock(block, "reasoning") && _isString(block.reasoning)) {
|
|
12
|
+
const signature = iife(() => {
|
|
13
|
+
const reasoningIndex = content.indexOf(block);
|
|
14
|
+
if (_isArray(message.additional_kwargs?.signatures) && reasoningIndex >= 0) return message.additional_kwargs.signatures.at(reasoningIndex);
|
|
15
|
+
return void 0;
|
|
16
|
+
});
|
|
17
|
+
if (_isString(signature)) yield {
|
|
18
|
+
type: "reasoning",
|
|
19
|
+
reasoning: block.reasoning,
|
|
20
|
+
signature
|
|
21
|
+
};
|
|
22
|
+
else yield {
|
|
23
|
+
type: "reasoning",
|
|
24
|
+
reasoning: block.reasoning
|
|
25
|
+
};
|
|
26
|
+
continue;
|
|
27
|
+
} else if (_isContentBlock(block, "text") && _isString(block.text)) {
|
|
28
|
+
yield {
|
|
29
|
+
type: "text",
|
|
30
|
+
text: block.text
|
|
31
|
+
};
|
|
32
|
+
continue;
|
|
33
|
+
} else if (_isContentBlock(block, "image_url")) {
|
|
34
|
+
if (_isString(block.image_url)) if (block.image_url.startsWith("data:")) {
|
|
35
|
+
const dataUrlRegex = /^data:([^;]+);base64,(.+)$/;
|
|
36
|
+
const match = block.image_url.match(dataUrlRegex);
|
|
37
|
+
if (match) yield {
|
|
38
|
+
type: "image",
|
|
39
|
+
data: match[2],
|
|
40
|
+
mimeType: match[1]
|
|
41
|
+
};
|
|
42
|
+
else yield {
|
|
43
|
+
type: "image",
|
|
44
|
+
url: block.image_url
|
|
45
|
+
};
|
|
46
|
+
} else yield {
|
|
47
|
+
type: "image",
|
|
48
|
+
url: block.image_url
|
|
49
|
+
};
|
|
50
|
+
continue;
|
|
51
|
+
} else if (_isContentBlock(block, "media") && _isString(block.mimeType) && _isString(block.data)) {
|
|
52
|
+
yield {
|
|
53
|
+
type: "file",
|
|
54
|
+
mimeType: block.mimeType,
|
|
55
|
+
data: block.data
|
|
56
|
+
};
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
yield {
|
|
60
|
+
type: "non_standard",
|
|
61
|
+
value: block
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return Array.from(iterateContent());
|
|
66
|
+
}
|
|
67
|
+
const ChatVertexTranslator = {
|
|
68
|
+
translateContent: convertToV1FromChatVertexMessage,
|
|
69
|
+
translateContentChunk: convertToV1FromChatVertexMessage
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
//#endregion
|
|
73
|
+
export { ChatVertexTranslator };
|
|
74
|
+
//# sourceMappingURL=google_vertexai.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"google_vertexai.js","names":["message: AIMessage","ChatVertexTranslator: StandardContentBlockTranslator"],"sources":["../../../src/messages/block_translators/google_vertexai.ts"],"sourcesContent":["import { AIMessage } from \"../ai.js\";\nimport { ContentBlock } from \"../content/index.js\";\nimport type { StandardContentBlockTranslator } from \"./index.js\";\nimport { _isArray, _isContentBlock, _isString, iife } from \"./utils.js\";\n\nfunction convertToV1FromChatVertexMessage(\n message: AIMessage\n): Array<ContentBlock.Standard> {\n // see `/libs/providers/langchain-google-common/src/utils/gemini.ts:partsToMessageContent`\n function* iterateContent(): Iterable<ContentBlock.Standard> {\n const content =\n typeof message.content === \"string\"\n ? [{ type: \"text\", text: message.content }]\n : message.content;\n for (const block of content) {\n if (_isContentBlock(block, \"reasoning\") && _isString(block.reasoning)) {\n const signature = iife(() => {\n const reasoningIndex = content.indexOf(block);\n if (\n _isArray(message.additional_kwargs?.signatures) &&\n reasoningIndex >= 0\n ) {\n return message.additional_kwargs.signatures.at(reasoningIndex);\n }\n return undefined;\n });\n if (_isString(signature)) {\n yield {\n type: \"reasoning\",\n reasoning: block.reasoning,\n signature,\n };\n } else {\n yield {\n type: \"reasoning\",\n reasoning: block.reasoning,\n };\n }\n continue;\n } else if (_isContentBlock(block, \"text\") && _isString(block.text)) {\n yield { type: \"text\", text: block.text };\n continue;\n } else if (_isContentBlock(block, \"image_url\")) {\n if (_isString(block.image_url)) {\n if (block.image_url.startsWith(\"data:\")) {\n const dataUrlRegex = /^data:([^;]+);base64,(.+)$/;\n const match = block.image_url.match(dataUrlRegex);\n if (match) {\n yield { type: \"image\", data: match[2], mimeType: match[1] };\n } else {\n yield { type: \"image\", url: block.image_url };\n }\n } else {\n yield { type: \"image\", url: block.image_url };\n }\n }\n continue;\n } else if (\n _isContentBlock(block, \"media\") &&\n _isString(block.mimeType) &&\n _isString(block.data)\n ) {\n yield { type: \"file\", mimeType: block.mimeType, data: block.data };\n continue;\n }\n yield { type: \"non_standard\", value: block };\n }\n }\n return Array.from(iterateContent());\n}\n\nexport const ChatVertexTranslator: StandardContentBlockTranslator = {\n translateContent: convertToV1FromChatVertexMessage,\n translateContentChunk: convertToV1FromChatVertexMessage,\n};\n"],"mappings":";;;AAKA,SAAS,iCACPA,SAC8B;CAE9B,UAAU,iBAAkD;EAC1D,MAAM,UACJ,OAAO,QAAQ,YAAY,WACvB,CAAC;GAAE,MAAM;GAAQ,MAAM,QAAQ;EAAS,CAAC,IACzC,QAAQ;AACd,OAAK,MAAM,SAAS,SAAS;AAC3B,OAAI,gBAAgB,OAAO,YAAY,IAAI,UAAU,MAAM,UAAU,EAAE;IACrE,MAAM,YAAY,KAAK,MAAM;KAC3B,MAAM,iBAAiB,QAAQ,QAAQ,MAAM;AAC7C,SACE,SAAS,QAAQ,mBAAmB,WAAW,IAC/C,kBAAkB,EAElB,QAAO,QAAQ,kBAAkB,WAAW,GAAG,eAAe;AAEhE,YAAO;IACR,EAAC;AACF,QAAI,UAAU,UAAU,EACtB,MAAM;KACJ,MAAM;KACN,WAAW,MAAM;KACjB;IACD;SAED,MAAM;KACJ,MAAM;KACN,WAAW,MAAM;IAClB;AAEH;GACD,WAAU,gBAAgB,OAAO,OAAO,IAAI,UAAU,MAAM,KAAK,EAAE;IAClE,MAAM;KAAE,MAAM;KAAQ,MAAM,MAAM;IAAM;AACxC;GACD,WAAU,gBAAgB,OAAO,YAAY,EAAE;AAC9C,QAAI,UAAU,MAAM,UAAU,CAC5B,KAAI,MAAM,UAAU,WAAW,QAAQ,EAAE;KACvC,MAAM,eAAe;KACrB,MAAM,QAAQ,MAAM,UAAU,MAAM,aAAa;AACjD,SAAI,OACF,MAAM;MAAE,MAAM;MAAS,MAAM,MAAM;MAAI,UAAU,MAAM;KAAI;UAE3D,MAAM;MAAE,MAAM;MAAS,KAAK,MAAM;KAAW;IAEhD,OACC,MAAM;KAAE,MAAM;KAAS,KAAK,MAAM;IAAW;AAGjD;GACD,WACC,gBAAgB,OAAO,QAAQ,IAC/B,UAAU,MAAM,SAAS,IACzB,UAAU,MAAM,KAAK,EACrB;IACA,MAAM;KAAE,MAAM;KAAQ,UAAU,MAAM;KAAU,MAAM,MAAM;IAAM;AAClE;GACD;GACD,MAAM;IAAE,MAAM;IAAgB,OAAO;GAAO;EAC7C;CACF;AACD,QAAO,MAAM,KAAK,gBAAgB,CAAC;AACpC;AAED,MAAaC,uBAAuD;CAClE,kBAAkB;CAClB,uBAAuB;AACxB"}
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
const require_anthropic = require('./anthropic.cjs');
|
|
2
2
|
const require_openai = require('./openai.cjs');
|
|
3
|
+
const require_bedrock_converse = require('./bedrock_converse.cjs');
|
|
4
|
+
const require_google_genai = require('./google_genai.cjs');
|
|
5
|
+
const require_google_vertexai = require('./google_vertexai.cjs');
|
|
3
6
|
|
|
4
7
|
//#region src/messages/block_translators/index.ts
|
|
5
|
-
globalThis.lc_block_translators_registry ??= new Map([
|
|
8
|
+
globalThis.lc_block_translators_registry ??= new Map([
|
|
9
|
+
["anthropic", require_anthropic.anthropicTranslator],
|
|
10
|
+
["bedrock-converse", require_bedrock_converse.ChatBedrockConverseTranslator],
|
|
11
|
+
["google-genai", require_google_genai.ChatGoogleGenAITranslator],
|
|
12
|
+
["google-vertexai", require_google_vertexai.ChatVertexTranslator],
|
|
13
|
+
["openai", require_openai.openaiTranslator]
|
|
14
|
+
]);
|
|
6
15
|
function getTranslator(modelProvider) {
|
|
7
16
|
return globalThis.lc_block_translators_registry.get(modelProvider);
|
|
8
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["anthropicTranslator","openaiTranslator","modelProvider: string"],"sources":["../../../src/messages/block_translators/index.ts"],"sourcesContent":["import type { AIMessage, AIMessageChunk } from \"../ai.js\";\nimport type { ContentBlock } from \"../content/index.js\";\n\nimport { anthropicTranslator } from \"./anthropic.js\";\nimport { openaiTranslator } from \"./openai.js\";\n\nexport interface StandardContentBlockTranslator {\n translateContent(message: AIMessage): Array<ContentBlock.Standard>;\n translateContentChunk(chunk: AIMessageChunk): Array<ContentBlock.Standard>;\n}\n\ntype TranslatorRegistry = Map<string, StandardContentBlockTranslator>;\n\ndeclare global {\n
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["anthropicTranslator","ChatBedrockConverseTranslator","ChatGoogleGenAITranslator","ChatVertexTranslator","openaiTranslator","modelProvider: string"],"sources":["../../../src/messages/block_translators/index.ts"],"sourcesContent":["import type { AIMessage, AIMessageChunk } from \"../ai.js\";\nimport type { ContentBlock } from \"../content/index.js\";\n\nimport { anthropicTranslator } from \"./anthropic.js\";\nimport { ChatBedrockConverseTranslator } from \"./bedrock_converse.js\";\nimport { ChatGoogleGenAITranslator } from \"./google_genai.js\";\nimport { ChatVertexTranslator } from \"./google_vertexai.js\";\nimport { openaiTranslator } from \"./openai.js\";\n\nexport interface StandardContentBlockTranslator {\n translateContent(message: AIMessage): Array<ContentBlock.Standard>;\n translateContentChunk(chunk: AIMessageChunk): Array<ContentBlock.Standard>;\n}\n\ntype TranslatorRegistry = Map<string, StandardContentBlockTranslator>;\n\ndeclare global {\n var lc_block_translators_registry: TranslatorRegistry;\n}\n\nglobalThis.lc_block_translators_registry ??= new Map([\n [\"anthropic\", anthropicTranslator],\n [\"bedrock-converse\", ChatBedrockConverseTranslator],\n [\"google-genai\", ChatGoogleGenAITranslator],\n [\"google-vertexai\", ChatVertexTranslator],\n [\"openai\", openaiTranslator],\n]);\n\nexport function registerTranslator(\n modelProvider: string,\n translator: StandardContentBlockTranslator\n) {\n globalThis.lc_block_translators_registry.set(modelProvider, translator);\n}\n\nexport function getTranslator(\n modelProvider: string\n): StandardContentBlockTranslator | undefined {\n return globalThis.lc_block_translators_registry.get(modelProvider);\n}\n"],"mappings":";;;;;;;AAoBA,WAAW,kCAAkC,IAAI,IAAI;CACnD,CAAC,aAAaA,qCAAoB;CAClC,CAAC,oBAAoBC,sDAA8B;CACnD,CAAC,gBAAgBC,8CAA0B;CAC3C,CAAC,mBAAmBC,4CAAqB;CACzC,CAAC,UAAUC,+BAAiB;AAC7B;AASD,SAAgB,cACdC,eAC4C;AAC5C,QAAO,WAAW,8BAA8B,IAAI,cAAc;AACnE"}
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
import { anthropicTranslator } from "./anthropic.js";
|
|
2
2
|
import { openaiTranslator } from "./openai.js";
|
|
3
|
+
import { ChatBedrockConverseTranslator } from "./bedrock_converse.js";
|
|
4
|
+
import { ChatGoogleGenAITranslator } from "./google_genai.js";
|
|
5
|
+
import { ChatVertexTranslator } from "./google_vertexai.js";
|
|
3
6
|
|
|
4
7
|
//#region src/messages/block_translators/index.ts
|
|
5
|
-
globalThis.lc_block_translators_registry ??= new Map([
|
|
8
|
+
globalThis.lc_block_translators_registry ??= new Map([
|
|
9
|
+
["anthropic", anthropicTranslator],
|
|
10
|
+
["bedrock-converse", ChatBedrockConverseTranslator],
|
|
11
|
+
["google-genai", ChatGoogleGenAITranslator],
|
|
12
|
+
["google-vertexai", ChatVertexTranslator],
|
|
13
|
+
["openai", openaiTranslator]
|
|
14
|
+
]);
|
|
6
15
|
function getTranslator(modelProvider) {
|
|
7
16
|
return globalThis.lc_block_translators_registry.get(modelProvider);
|
|
8
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["modelProvider: string"],"sources":["../../../src/messages/block_translators/index.ts"],"sourcesContent":["import type { AIMessage, AIMessageChunk } from \"../ai.js\";\nimport type { ContentBlock } from \"../content/index.js\";\n\nimport { anthropicTranslator } from \"./anthropic.js\";\nimport { openaiTranslator } from \"./openai.js\";\n\nexport interface StandardContentBlockTranslator {\n translateContent(message: AIMessage): Array<ContentBlock.Standard>;\n translateContentChunk(chunk: AIMessageChunk): Array<ContentBlock.Standard>;\n}\n\ntype TranslatorRegistry = Map<string, StandardContentBlockTranslator>;\n\ndeclare global {\n
|
|
1
|
+
{"version":3,"file":"index.js","names":["modelProvider: string"],"sources":["../../../src/messages/block_translators/index.ts"],"sourcesContent":["import type { AIMessage, AIMessageChunk } from \"../ai.js\";\nimport type { ContentBlock } from \"../content/index.js\";\n\nimport { anthropicTranslator } from \"./anthropic.js\";\nimport { ChatBedrockConverseTranslator } from \"./bedrock_converse.js\";\nimport { ChatGoogleGenAITranslator } from \"./google_genai.js\";\nimport { ChatVertexTranslator } from \"./google_vertexai.js\";\nimport { openaiTranslator } from \"./openai.js\";\n\nexport interface StandardContentBlockTranslator {\n translateContent(message: AIMessage): Array<ContentBlock.Standard>;\n translateContentChunk(chunk: AIMessageChunk): Array<ContentBlock.Standard>;\n}\n\ntype TranslatorRegistry = Map<string, StandardContentBlockTranslator>;\n\ndeclare global {\n var lc_block_translators_registry: TranslatorRegistry;\n}\n\nglobalThis.lc_block_translators_registry ??= new Map([\n [\"anthropic\", anthropicTranslator],\n [\"bedrock-converse\", ChatBedrockConverseTranslator],\n [\"google-genai\", ChatGoogleGenAITranslator],\n [\"google-vertexai\", ChatVertexTranslator],\n [\"openai\", openaiTranslator],\n]);\n\nexport function registerTranslator(\n modelProvider: string,\n translator: StandardContentBlockTranslator\n) {\n globalThis.lc_block_translators_registry.set(modelProvider, translator);\n}\n\nexport function getTranslator(\n modelProvider: string\n): StandardContentBlockTranslator | undefined {\n return globalThis.lc_block_translators_registry.get(modelProvider);\n}\n"],"mappings":";;;;;;;AAoBA,WAAW,kCAAkC,IAAI,IAAI;CACnD,CAAC,aAAa,mBAAoB;CAClC,CAAC,oBAAoB,6BAA8B;CACnD,CAAC,gBAAgB,yBAA0B;CAC3C,CAAC,mBAAmB,oBAAqB;CACzC,CAAC,UAAU,gBAAiB;AAC7B;AASD,SAAgB,cACdA,eAC4C;AAC5C,QAAO,WAAW,8BAA8B,IAAI,cAAc;AACnE"}
|
|
@@ -15,6 +15,9 @@ function _isString(value) {
|
|
|
15
15
|
function _isNumber(value) {
|
|
16
16
|
return typeof value === "number";
|
|
17
17
|
}
|
|
18
|
+
function _isBytesArray(value) {
|
|
19
|
+
return value instanceof Uint8Array;
|
|
20
|
+
}
|
|
18
21
|
function safeParseJson(value) {
|
|
19
22
|
try {
|
|
20
23
|
return JSON.parse(value);
|
|
@@ -26,6 +29,7 @@ const iife = (fn) => fn();
|
|
|
26
29
|
|
|
27
30
|
//#endregion
|
|
28
31
|
exports._isArray = _isArray;
|
|
32
|
+
exports._isBytesArray = _isBytesArray;
|
|
29
33
|
exports._isContentBlock = _isContentBlock;
|
|
30
34
|
exports._isNumber = _isNumber;
|
|
31
35
|
exports._isObject = _isObject;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.cjs","names":["block: unknown","type: T","value: unknown","value: string","fn: () => T"],"sources":["../../../src/messages/block_translators/utils.ts"],"sourcesContent":["import type { ContentBlock } from \"../content/index.js\";\n\nexport function _isContentBlock<T extends string>(\n block: unknown,\n type: T\n): block is ContentBlock & { type: T } {\n return _isObject(block) && block.type === type;\n}\n\nexport function _isObject(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null;\n}\n\nexport function _isArray<T>(value: unknown): value is T[] {\n return Array.isArray(value);\n}\n\nexport function _isString(value: unknown): value is string {\n return typeof value === \"string\";\n}\n\nexport function _isNumber(value: unknown): value is number {\n return typeof value === \"number\";\n}\n\nexport function safeParseJson<T = unknown>(value: string): T | undefined {\n try {\n return JSON.parse(value);\n } catch {\n return undefined;\n }\n}\n\nexport const iife = <T>(fn: () => T): T => fn();\n"],"mappings":";;AAEA,SAAgB,gBACdA,OACAC,MACqC;AACrC,QAAO,UAAU,MAAM,IAAI,MAAM,SAAS;AAC3C;AAED,SAAgB,UAAUC,OAAkD;AAC1E,QAAO,OAAO,UAAU,YAAY,UAAU;AAC/C;AAED,SAAgB,SAAYA,OAA8B;AACxD,QAAO,MAAM,QAAQ,MAAM;AAC5B;AAED,SAAgB,UAAUA,OAAiC;AACzD,QAAO,OAAO,UAAU;AACzB;AAED,SAAgB,UAAUA,OAAiC;AACzD,QAAO,OAAO,UAAU;AACzB;AAED,SAAgB,cAA2BC,OAA8B;AACvE,KAAI;AACF,SAAO,KAAK,MAAM,MAAM;CACzB,QAAO;AACN,SAAO;CACR;AACF;AAED,MAAa,OAAO,CAAIC,OAAmB,IAAI"}
|
|
1
|
+
{"version":3,"file":"utils.cjs","names":["block: unknown","type: T","value: unknown","value: string","fn: () => T"],"sources":["../../../src/messages/block_translators/utils.ts"],"sourcesContent":["import type { ContentBlock } from \"../content/index.js\";\n\nexport function _isContentBlock<T extends string>(\n block: unknown,\n type: T\n): block is ContentBlock & { type: T } {\n return _isObject(block) && block.type === type;\n}\n\nexport function _isObject(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null;\n}\n\nexport function _isArray<T>(value: unknown): value is T[] {\n return Array.isArray(value);\n}\n\nexport function _isString(value: unknown): value is string {\n return typeof value === \"string\";\n}\n\nexport function _isNumber(value: unknown): value is number {\n return typeof value === \"number\";\n}\n\nexport function _isBytesArray(value: unknown): value is Uint8Array {\n // eslint-disable-next-line no-instanceof/no-instanceof\n return value instanceof Uint8Array;\n}\n\nexport function safeParseJson<T = unknown>(value: string): T | undefined {\n try {\n return JSON.parse(value);\n } catch {\n return undefined;\n }\n}\n\nexport const iife = <T>(fn: () => T): T => fn();\n"],"mappings":";;AAEA,SAAgB,gBACdA,OACAC,MACqC;AACrC,QAAO,UAAU,MAAM,IAAI,MAAM,SAAS;AAC3C;AAED,SAAgB,UAAUC,OAAkD;AAC1E,QAAO,OAAO,UAAU,YAAY,UAAU;AAC/C;AAED,SAAgB,SAAYA,OAA8B;AACxD,QAAO,MAAM,QAAQ,MAAM;AAC5B;AAED,SAAgB,UAAUA,OAAiC;AACzD,QAAO,OAAO,UAAU;AACzB;AAED,SAAgB,UAAUA,OAAiC;AACzD,QAAO,OAAO,UAAU;AACzB;AAED,SAAgB,cAAcA,OAAqC;AAEjE,QAAO,iBAAiB;AACzB;AAED,SAAgB,cAA2BC,OAA8B;AACvE,KAAI;AACF,SAAO,KAAK,MAAM,MAAM;CACzB,QAAO;AACN,SAAO;CACR;AACF;AAED,MAAa,OAAO,CAAIC,OAAmB,IAAI"}
|
|
@@ -14,6 +14,9 @@ function _isString(value) {
|
|
|
14
14
|
function _isNumber(value) {
|
|
15
15
|
return typeof value === "number";
|
|
16
16
|
}
|
|
17
|
+
function _isBytesArray(value) {
|
|
18
|
+
return value instanceof Uint8Array;
|
|
19
|
+
}
|
|
17
20
|
function safeParseJson(value) {
|
|
18
21
|
try {
|
|
19
22
|
return JSON.parse(value);
|
|
@@ -24,5 +27,5 @@ function safeParseJson(value) {
|
|
|
24
27
|
const iife = (fn) => fn();
|
|
25
28
|
|
|
26
29
|
//#endregion
|
|
27
|
-
export { _isArray, _isContentBlock, _isNumber, _isObject, _isString, iife, safeParseJson };
|
|
30
|
+
export { _isArray, _isBytesArray, _isContentBlock, _isNumber, _isObject, _isString, iife, safeParseJson };
|
|
28
31
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":["block: unknown","type: T","value: unknown","value: string","fn: () => T"],"sources":["../../../src/messages/block_translators/utils.ts"],"sourcesContent":["import type { ContentBlock } from \"../content/index.js\";\n\nexport function _isContentBlock<T extends string>(\n block: unknown,\n type: T\n): block is ContentBlock & { type: T } {\n return _isObject(block) && block.type === type;\n}\n\nexport function _isObject(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null;\n}\n\nexport function _isArray<T>(value: unknown): value is T[] {\n return Array.isArray(value);\n}\n\nexport function _isString(value: unknown): value is string {\n return typeof value === \"string\";\n}\n\nexport function _isNumber(value: unknown): value is number {\n return typeof value === \"number\";\n}\n\nexport function safeParseJson<T = unknown>(value: string): T | undefined {\n try {\n return JSON.parse(value);\n } catch {\n return undefined;\n }\n}\n\nexport const iife = <T>(fn: () => T): T => fn();\n"],"mappings":";AAEA,SAAgB,gBACdA,OACAC,MACqC;AACrC,QAAO,UAAU,MAAM,IAAI,MAAM,SAAS;AAC3C;AAED,SAAgB,UAAUC,OAAkD;AAC1E,QAAO,OAAO,UAAU,YAAY,UAAU;AAC/C;AAED,SAAgB,SAAYA,OAA8B;AACxD,QAAO,MAAM,QAAQ,MAAM;AAC5B;AAED,SAAgB,UAAUA,OAAiC;AACzD,QAAO,OAAO,UAAU;AACzB;AAED,SAAgB,UAAUA,OAAiC;AACzD,QAAO,OAAO,UAAU;AACzB;AAED,SAAgB,cAA2BC,OAA8B;AACvE,KAAI;AACF,SAAO,KAAK,MAAM,MAAM;CACzB,QAAO;AACN,SAAO;CACR;AACF;AAED,MAAa,OAAO,CAAIC,OAAmB,IAAI"}
|
|
1
|
+
{"version":3,"file":"utils.js","names":["block: unknown","type: T","value: unknown","value: string","fn: () => T"],"sources":["../../../src/messages/block_translators/utils.ts"],"sourcesContent":["import type { ContentBlock } from \"../content/index.js\";\n\nexport function _isContentBlock<T extends string>(\n block: unknown,\n type: T\n): block is ContentBlock & { type: T } {\n return _isObject(block) && block.type === type;\n}\n\nexport function _isObject(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null;\n}\n\nexport function _isArray<T>(value: unknown): value is T[] {\n return Array.isArray(value);\n}\n\nexport function _isString(value: unknown): value is string {\n return typeof value === \"string\";\n}\n\nexport function _isNumber(value: unknown): value is number {\n return typeof value === \"number\";\n}\n\nexport function _isBytesArray(value: unknown): value is Uint8Array {\n // eslint-disable-next-line no-instanceof/no-instanceof\n return value instanceof Uint8Array;\n}\n\nexport function safeParseJson<T = unknown>(value: string): T | undefined {\n try {\n return JSON.parse(value);\n } catch {\n return undefined;\n }\n}\n\nexport const iife = <T>(fn: () => T): T => fn();\n"],"mappings":";AAEA,SAAgB,gBACdA,OACAC,MACqC;AACrC,QAAO,UAAU,MAAM,IAAI,MAAM,SAAS;AAC3C;AAED,SAAgB,UAAUC,OAAkD;AAC1E,QAAO,OAAO,UAAU,YAAY,UAAU;AAC/C;AAED,SAAgB,SAAYA,OAA8B;AACxD,QAAO,MAAM,QAAQ,MAAM;AAC5B;AAED,SAAgB,UAAUA,OAAiC;AACzD,QAAO,OAAO,UAAU;AACzB;AAED,SAAgB,UAAUA,OAAiC;AACzD,QAAO,OAAO,UAAU;AACzB;AAED,SAAgB,cAAcA,OAAqC;AAEjE,QAAO,iBAAiB;AACzB;AAED,SAAgB,cAA2BC,OAA8B;AACvE,KAAI;AACF,SAAO,KAAK,MAAM,MAAM;CACzB,QAAO;AACN,SAAO;CACR;AACF;AAED,MAAa,OAAO,CAAIC,OAAmB,IAAI"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["KNOWN_BLOCK_TYPES","KNOWN_TOOL_BLOCK_TYPES","KNOWN_MULTIMODAL_BLOCK_TYPES"],"sources":["../../../src/messages/content/index.ts"],"sourcesContent":["import type { BaseContentBlock } from \"./base.js\";\nimport {\n KNOWN_BLOCK_TYPES as KNOWN_TOOL_BLOCK_TYPES,\n type Tools,\n} from \"./tools.js\";\nimport {\n KNOWN_BLOCK_TYPES as KNOWN_MULTIMODAL_BLOCK_TYPES,\n type Multimodal,\n} from \"./multimodal.js\";\nimport { type Data } from \"./data.js\";\n\nexport interface ContentBlock extends BaseContentBlock {}\n\nexport const KNOWN_BLOCK_TYPES = [\n \"text\",\n \"reasoning\",\n ...KNOWN_TOOL_BLOCK_TYPES,\n ...KNOWN_MULTIMODAL_BLOCK_TYPES,\n];\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport declare namespace ContentBlock {\n /**\n * Annotation for citing data from a document.\n */\n export interface Citation {\n /**\n * Type of the content block\n */\n readonly type: \"citation\";\n /**\n * Source type for the citation.\n */\n source?: string;\n /**\n * URL of the document source\n */\n url?: string;\n /**\n * Source document title.\n *\n * For example, the page title for a web page or the title of a paper.\n */\n title?: string;\n /**\n * Start index of the **response text** for which the annotation applies.\n *\n * @see {Text}\n */\n startIndex?: number;\n /**\n * End index of the **response text** for which the annotation applies.\n *\n * @see {Text}\n */\n endIndex?: number;\n /**\n * Excerpt of source text being cited.\n */\n citedText?: string;\n }\n\n /**\n * Text output from a LLM.\n *\n * This typically represents the main text content of a message, such as the response\n * from a language model or the text of a user message.\n */\n export interface Text extends ContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"text\";\n /**\n * Block text.\n */\n text: string;\n /**\n * Index of block in aggregate response. Used during streaming.\n */\n index?: number;\n /**\n * Citations and other annotations.\n */\n annotations?: Array<Citation | BaseContentBlock>;\n }\n\n /**\n * Reasoning output from a LLM.\n */\n export interface Reasoning extends ContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"reasoning\";\n /**\n * Reasoning text.\n *\n * Either the thought summary or the raw reasoning text itself.\n * This is often parsed from `<think>` tags in the model's response.\n */\n reasoning: string;\n /**\n * Index of block in aggregate response. Used during streaming.\n */\n index?: number;\n }\n\n export { Tools };\n export { Multimodal };\n export { Data };\n\n export type Standard =\n | Text\n | Reasoning\n | Tools.Standard\n | Multimodal.Standard;\n}\n"],"mappings":";;;;AAaA,MAAaA,sBAAoB;CAC/B;CACA;CACA,GAAGC;CACH,GAAGC;AACJ"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["KNOWN_BLOCK_TYPES","KNOWN_TOOL_BLOCK_TYPES","KNOWN_MULTIMODAL_BLOCK_TYPES"],"sources":["../../../src/messages/content/index.ts"],"sourcesContent":["import type { BaseContentBlock } from \"./base.js\";\nimport {\n KNOWN_BLOCK_TYPES as KNOWN_TOOL_BLOCK_TYPES,\n type Tools,\n} from \"./tools.js\";\nimport {\n KNOWN_BLOCK_TYPES as KNOWN_MULTIMODAL_BLOCK_TYPES,\n type Multimodal,\n} from \"./multimodal.js\";\nimport { type Data } from \"./data.js\";\n\nexport interface ContentBlock extends BaseContentBlock {}\n\nexport const KNOWN_BLOCK_TYPES = [\n \"text\",\n \"reasoning\",\n ...KNOWN_TOOL_BLOCK_TYPES,\n ...KNOWN_MULTIMODAL_BLOCK_TYPES,\n];\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport declare namespace ContentBlock {\n /**\n * Annotation for citing data from a document.\n */\n export interface Citation {\n /**\n * Type of the content block\n */\n readonly type: \"citation\";\n /**\n * Source type for the citation.\n */\n source?: string;\n /**\n * URL of the document source\n */\n url?: string;\n /**\n * Source document title.\n *\n * For example, the page title for a web page or the title of a paper.\n */\n title?: string;\n /**\n * Start index of the **response text** for which the annotation applies.\n *\n * @see {Text}\n */\n startIndex?: number;\n /**\n * End index of the **response text** for which the annotation applies.\n *\n * @see {Text}\n */\n endIndex?: number;\n /**\n * Excerpt of source text being cited.\n */\n citedText?: string;\n }\n\n /**\n * Text output from a LLM.\n *\n * This typically represents the main text content of a message, such as the response\n * from a language model or the text of a user message.\n */\n export interface Text extends ContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"text\";\n /**\n * Block text.\n */\n text: string;\n /**\n * Index of block in aggregate response. Used during streaming.\n */\n index?: number;\n /**\n * Citations and other annotations.\n */\n annotations?: Array<Citation | BaseContentBlock>;\n }\n\n /**\n * Reasoning output from a LLM.\n */\n export interface Reasoning extends ContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"reasoning\";\n /**\n * Reasoning text.\n *\n * Either the thought summary or the raw reasoning text itself.\n * This is often parsed from `<think>` tags in the model's response.\n */\n reasoning: string;\n /**\n * Index of block in aggregate response. Used during streaming.\n */\n index?: number;\n }\n\n /**\n * Provider-specific content block.\n *\n * This is used to represent content blocks that are not part of the standard LangChain content model.\n * If a provider's non-standard output includes reasoning and tool calls, it should be\n * the adapter's job to parse that payload and emit the corresponding standard reasoning and tool call blocks.\n */\n export interface NonStandard<\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n TValue extends Record<string, any> = Record<string, any>\n > extends ContentBlock {\n /**\n * Type of the content block\n */\n type: \"non_standard\";\n /**\n * Provider-specific data\n */\n value: TValue;\n }\n\n export { Tools };\n export { Multimodal };\n export { Data };\n\n export type Standard =\n | Text\n | Reasoning\n | NonStandard\n | Tools.Standard\n | Multimodal.Standard;\n}\n"],"mappings":";;;;AAaA,MAAaA,sBAAoB;CAC/B;CACA;CACA,GAAGC;CACH,GAAGC;AACJ"}
|
|
@@ -91,10 +91,29 @@ declare namespace ContentBlock {
|
|
|
91
91
|
*/
|
|
92
92
|
index?: number;
|
|
93
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* Provider-specific content block.
|
|
96
|
+
*
|
|
97
|
+
* This is used to represent content blocks that are not part of the standard LangChain content model.
|
|
98
|
+
* If a provider's non-standard output includes reasoning and tool calls, it should be
|
|
99
|
+
* the adapter's job to parse that payload and emit the corresponding standard reasoning and tool call blocks.
|
|
100
|
+
*/
|
|
101
|
+
export interface NonStandard<
|
|
102
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
103
|
+
TValue extends Record<string, any> = Record<string, any>> extends ContentBlock {
|
|
104
|
+
/**
|
|
105
|
+
* Type of the content block
|
|
106
|
+
*/
|
|
107
|
+
type: "non_standard";
|
|
108
|
+
/**
|
|
109
|
+
* Provider-specific data
|
|
110
|
+
*/
|
|
111
|
+
value: TValue;
|
|
112
|
+
}
|
|
94
113
|
export { Tools };
|
|
95
114
|
export { Multimodal };
|
|
96
115
|
export { Data };
|
|
97
|
-
export type Standard = Text | Reasoning | Tools.Standard | Multimodal.Standard;
|
|
116
|
+
export type Standard = Text | Reasoning | NonStandard | Tools.Standard | Multimodal.Standard;
|
|
98
117
|
}
|
|
99
118
|
//#endregion
|
|
100
119
|
export { ContentBlock, KNOWN_BLOCK_TYPES };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":["BaseContentBlock","Tools","Multimodal","Data","ContentBlock","KNOWN_BLOCK_TYPES","Citation","Array","Text","Reasoning","Standard"],"sources":["../../../src/messages/content/index.d.ts"],"sourcesContent":["import type { BaseContentBlock } from \"./base.js\";\nimport { type Tools } from \"./tools.js\";\nimport { type Multimodal } from \"./multimodal.js\";\nimport { type Data } from \"./data.js\";\nexport interface ContentBlock extends BaseContentBlock {\n}\nexport declare const KNOWN_BLOCK_TYPES: string[];\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport declare namespace ContentBlock {\n /**\n * Annotation for citing data from a document.\n */\n export interface Citation {\n /**\n * Type of the content block\n */\n readonly type: \"citation\";\n /**\n * Source type for the citation.\n */\n source?: string;\n /**\n * URL of the document source\n */\n url?: string;\n /**\n * Source document title.\n *\n * For example, the page title for a web page or the title of a paper.\n */\n title?: string;\n /**\n * Start index of the **response text** for which the annotation applies.\n *\n * @see {Text}\n */\n startIndex?: number;\n /**\n * End index of the **response text** for which the annotation applies.\n *\n * @see {Text}\n */\n endIndex?: number;\n /**\n * Excerpt of source text being cited.\n */\n citedText?: string;\n }\n /**\n * Text output from a LLM.\n *\n * This typically represents the main text content of a message, such as the response\n * from a language model or the text of a user message.\n */\n export interface Text extends ContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"text\";\n /**\n * Block text.\n */\n text: string;\n /**\n * Index of block in aggregate response. Used during streaming.\n */\n index?: number;\n /**\n * Citations and other annotations.\n */\n annotations?: Array<Citation | BaseContentBlock>;\n }\n /**\n * Reasoning output from a LLM.\n */\n export interface Reasoning extends ContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"reasoning\";\n /**\n * Reasoning text.\n *\n * Either the thought summary or the raw reasoning text itself.\n * This is often parsed from `<think>` tags in the model's response.\n */\n reasoning: string;\n /**\n * Index of block in aggregate response. Used during streaming.\n */\n index?: number;\n }\n export { Tools };\n export { Multimodal };\n export { Data };\n export type Standard = Text | Reasoning | Tools.Standard | Multimodal.Standard;\n}\n"],"mappings":";;;;;;UAIiBI,YAAAA,SAAqBJ;AAArBI,cAEIC,iBAFiBL,EAAAA,MAAAA,EAAgB;AAEtD;AAEyBI,kBAAAA,YAAAA,CAAY;EAAA;;;EA8DkB,OAAjCG,UAAAA,QAAAA,CAAAA;IAhBYH;;;
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":["BaseContentBlock","Tools","Multimodal","Data","ContentBlock","KNOWN_BLOCK_TYPES","Citation","Array","Record","TValue","Text","Reasoning","NonStandard","Standard"],"sources":["../../../src/messages/content/index.d.ts"],"sourcesContent":["import type { BaseContentBlock } from \"./base.js\";\nimport { type Tools } from \"./tools.js\";\nimport { type Multimodal } from \"./multimodal.js\";\nimport { type Data } from \"./data.js\";\nexport interface ContentBlock extends BaseContentBlock {\n}\nexport declare const KNOWN_BLOCK_TYPES: string[];\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport declare namespace ContentBlock {\n /**\n * Annotation for citing data from a document.\n */\n export interface Citation {\n /**\n * Type of the content block\n */\n readonly type: \"citation\";\n /**\n * Source type for the citation.\n */\n source?: string;\n /**\n * URL of the document source\n */\n url?: string;\n /**\n * Source document title.\n *\n * For example, the page title for a web page or the title of a paper.\n */\n title?: string;\n /**\n * Start index of the **response text** for which the annotation applies.\n *\n * @see {Text}\n */\n startIndex?: number;\n /**\n * End index of the **response text** for which the annotation applies.\n *\n * @see {Text}\n */\n endIndex?: number;\n /**\n * Excerpt of source text being cited.\n */\n citedText?: string;\n }\n /**\n * Text output from a LLM.\n *\n * This typically represents the main text content of a message, such as the response\n * from a language model or the text of a user message.\n */\n export interface Text extends ContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"text\";\n /**\n * Block text.\n */\n text: string;\n /**\n * Index of block in aggregate response. Used during streaming.\n */\n index?: number;\n /**\n * Citations and other annotations.\n */\n annotations?: Array<Citation | BaseContentBlock>;\n }\n /**\n * Reasoning output from a LLM.\n */\n export interface Reasoning extends ContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"reasoning\";\n /**\n * Reasoning text.\n *\n * Either the thought summary or the raw reasoning text itself.\n * This is often parsed from `<think>` tags in the model's response.\n */\n reasoning: string;\n /**\n * Index of block in aggregate response. Used during streaming.\n */\n index?: number;\n }\n /**\n * Provider-specific content block.\n *\n * This is used to represent content blocks that are not part of the standard LangChain content model.\n * If a provider's non-standard output includes reasoning and tool calls, it should be\n * the adapter's job to parse that payload and emit the corresponding standard reasoning and tool call blocks.\n */\n export interface NonStandard<\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n TValue extends Record<string, any> = Record<string, any>> extends ContentBlock {\n /**\n * Type of the content block\n */\n type: \"non_standard\";\n /**\n * Provider-specific data\n */\n value: TValue;\n }\n export { Tools };\n export { Multimodal };\n export { Data };\n export type Standard = Text | Reasoning | NonStandard | Tools.Standard | Multimodal.Standard;\n}\n"],"mappings":";;;;;;UAIiBI,YAAAA,SAAqBJ;AAArBI,cAEIC,iBAFiBL,EAAAA,MAAAA,EAAgB;AAEtD;AAEyBI,kBAAAA,YAAAA,CAAY;EAAA;;;EA8DkB,OAAjCG,UAAAA,QAAAA,CAAAA;IAhBYH;;;IA+COI,SAAAA,IAAAA,EAAAA,UAAAA;IAQ1BC;;;IAGFP,MAAAA,CAAAA,EAAAA,MAAAA;IACAC;;;IACiCS,GAAAA,CAAAA,EAAAA,MAAAA;IAAcX;;AAAoC;;;;;;;;;;;;;;;;;;;;;;;;;;;gCA5D9DG;;;;;;;;;;;;;;;;kBAgBZG,MAAMD,WAAWN;;;;;qCAKAI;;;;;;;;;;;;;;;;;;;;;;;;;;iBA0BpBI,sBAAsBA,6BAA6BJ;;;;;;;;WAQvDK;;WAEFR;WACAC;WACAC;yBACcO,OAAOC,YAAYC,cAAcX,KAAAA,CAAMY,WAAWX,UAAAA,CAAWW"}
|
|
@@ -91,10 +91,29 @@ declare namespace ContentBlock {
|
|
|
91
91
|
*/
|
|
92
92
|
index?: number;
|
|
93
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* Provider-specific content block.
|
|
96
|
+
*
|
|
97
|
+
* This is used to represent content blocks that are not part of the standard LangChain content model.
|
|
98
|
+
* If a provider's non-standard output includes reasoning and tool calls, it should be
|
|
99
|
+
* the adapter's job to parse that payload and emit the corresponding standard reasoning and tool call blocks.
|
|
100
|
+
*/
|
|
101
|
+
export interface NonStandard<
|
|
102
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
103
|
+
TValue extends Record<string, any> = Record<string, any>> extends ContentBlock {
|
|
104
|
+
/**
|
|
105
|
+
* Type of the content block
|
|
106
|
+
*/
|
|
107
|
+
type: "non_standard";
|
|
108
|
+
/**
|
|
109
|
+
* Provider-specific data
|
|
110
|
+
*/
|
|
111
|
+
value: TValue;
|
|
112
|
+
}
|
|
94
113
|
export { Tools };
|
|
95
114
|
export { Multimodal };
|
|
96
115
|
export { Data };
|
|
97
|
-
export type Standard = Text | Reasoning | Tools.Standard | Multimodal.Standard;
|
|
116
|
+
export type Standard = Text | Reasoning | NonStandard | Tools.Standard | Multimodal.Standard;
|
|
98
117
|
}
|
|
99
118
|
//#endregion
|
|
100
119
|
export { ContentBlock, KNOWN_BLOCK_TYPES };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":["BaseContentBlock","Tools","Multimodal","Data","ContentBlock","KNOWN_BLOCK_TYPES","Citation","Array","Text","Reasoning","Standard"],"sources":["../../../src/messages/content/index.d.ts"],"sourcesContent":["import type { BaseContentBlock } from \"./base.js\";\nimport { type Tools } from \"./tools.js\";\nimport { type Multimodal } from \"./multimodal.js\";\nimport { type Data } from \"./data.js\";\nexport interface ContentBlock extends BaseContentBlock {\n}\nexport declare const KNOWN_BLOCK_TYPES: string[];\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport declare namespace ContentBlock {\n /**\n * Annotation for citing data from a document.\n */\n export interface Citation {\n /**\n * Type of the content block\n */\n readonly type: \"citation\";\n /**\n * Source type for the citation.\n */\n source?: string;\n /**\n * URL of the document source\n */\n url?: string;\n /**\n * Source document title.\n *\n * For example, the page title for a web page or the title of a paper.\n */\n title?: string;\n /**\n * Start index of the **response text** for which the annotation applies.\n *\n * @see {Text}\n */\n startIndex?: number;\n /**\n * End index of the **response text** for which the annotation applies.\n *\n * @see {Text}\n */\n endIndex?: number;\n /**\n * Excerpt of source text being cited.\n */\n citedText?: string;\n }\n /**\n * Text output from a LLM.\n *\n * This typically represents the main text content of a message, such as the response\n * from a language model or the text of a user message.\n */\n export interface Text extends ContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"text\";\n /**\n * Block text.\n */\n text: string;\n /**\n * Index of block in aggregate response. Used during streaming.\n */\n index?: number;\n /**\n * Citations and other annotations.\n */\n annotations?: Array<Citation | BaseContentBlock>;\n }\n /**\n * Reasoning output from a LLM.\n */\n export interface Reasoning extends ContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"reasoning\";\n /**\n * Reasoning text.\n *\n * Either the thought summary or the raw reasoning text itself.\n * This is often parsed from `<think>` tags in the model's response.\n */\n reasoning: string;\n /**\n * Index of block in aggregate response. Used during streaming.\n */\n index?: number;\n }\n export { Tools };\n export { Multimodal };\n export { Data };\n export type Standard = Text | Reasoning | Tools.Standard | Multimodal.Standard;\n}\n"],"mappings":";;;;;;UAIiBI,YAAAA,SAAqBJ;AAArBI,cAEIC,iBAFiBL,EAAAA,MAAAA,EAAgB;AAEtD;AAEyBI,kBAAAA,YAAAA,CAAY;EAAA;;;EA8DkB,OAAjCG,UAAAA,QAAAA,CAAAA;IAhBYH;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":["BaseContentBlock","Tools","Multimodal","Data","ContentBlock","KNOWN_BLOCK_TYPES","Citation","Array","Record","TValue","Text","Reasoning","NonStandard","Standard"],"sources":["../../../src/messages/content/index.d.ts"],"sourcesContent":["import type { BaseContentBlock } from \"./base.js\";\nimport { type Tools } from \"./tools.js\";\nimport { type Multimodal } from \"./multimodal.js\";\nimport { type Data } from \"./data.js\";\nexport interface ContentBlock extends BaseContentBlock {\n}\nexport declare const KNOWN_BLOCK_TYPES: string[];\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport declare namespace ContentBlock {\n /**\n * Annotation for citing data from a document.\n */\n export interface Citation {\n /**\n * Type of the content block\n */\n readonly type: \"citation\";\n /**\n * Source type for the citation.\n */\n source?: string;\n /**\n * URL of the document source\n */\n url?: string;\n /**\n * Source document title.\n *\n * For example, the page title for a web page or the title of a paper.\n */\n title?: string;\n /**\n * Start index of the **response text** for which the annotation applies.\n *\n * @see {Text}\n */\n startIndex?: number;\n /**\n * End index of the **response text** for which the annotation applies.\n *\n * @see {Text}\n */\n endIndex?: number;\n /**\n * Excerpt of source text being cited.\n */\n citedText?: string;\n }\n /**\n * Text output from a LLM.\n *\n * This typically represents the main text content of a message, such as the response\n * from a language model or the text of a user message.\n */\n export interface Text extends ContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"text\";\n /**\n * Block text.\n */\n text: string;\n /**\n * Index of block in aggregate response. Used during streaming.\n */\n index?: number;\n /**\n * Citations and other annotations.\n */\n annotations?: Array<Citation | BaseContentBlock>;\n }\n /**\n * Reasoning output from a LLM.\n */\n export interface Reasoning extends ContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"reasoning\";\n /**\n * Reasoning text.\n *\n * Either the thought summary or the raw reasoning text itself.\n * This is often parsed from `<think>` tags in the model's response.\n */\n reasoning: string;\n /**\n * Index of block in aggregate response. Used during streaming.\n */\n index?: number;\n }\n /**\n * Provider-specific content block.\n *\n * This is used to represent content blocks that are not part of the standard LangChain content model.\n * If a provider's non-standard output includes reasoning and tool calls, it should be\n * the adapter's job to parse that payload and emit the corresponding standard reasoning and tool call blocks.\n */\n export interface NonStandard<\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n TValue extends Record<string, any> = Record<string, any>> extends ContentBlock {\n /**\n * Type of the content block\n */\n type: \"non_standard\";\n /**\n * Provider-specific data\n */\n value: TValue;\n }\n export { Tools };\n export { Multimodal };\n export { Data };\n export type Standard = Text | Reasoning | NonStandard | Tools.Standard | Multimodal.Standard;\n}\n"],"mappings":";;;;;;UAIiBI,YAAAA,SAAqBJ;AAArBI,cAEIC,iBAFiBL,EAAAA,MAAAA,EAAgB;AAEtD;AAEyBI,kBAAAA,YAAAA,CAAY;EAAA;;;EA8DkB,OAAjCG,UAAAA,QAAAA,CAAAA;IAhBYH;;;IA+COI,SAAAA,IAAAA,EAAAA,UAAAA;IAQ1BC;;;IAGFP,MAAAA,CAAAA,EAAAA,MAAAA;IACAC;;;IACiCS,GAAAA,CAAAA,EAAAA,MAAAA;IAAcX;;AAAoC;;;;;;;;;;;;;;;;;;;;;;;;;;;gCA5D9DG;;;;;;;;;;;;;;;;kBAgBZG,MAAMD,WAAWN;;;;;qCAKAI;;;;;;;;;;;;;;;;;;;;;;;;;;iBA0BpBI,sBAAsBA,6BAA6BJ;;;;;;;;WAQvDK;;WAEFR;WACAC;WACAC;yBACcO,OAAOC,YAAYC,cAAcX,KAAAA,CAAMY,WAAWX,UAAAA,CAAWW"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["KNOWN_BLOCK_TYPES","KNOWN_TOOL_BLOCK_TYPES","KNOWN_MULTIMODAL_BLOCK_TYPES"],"sources":["../../../src/messages/content/index.ts"],"sourcesContent":["import type { BaseContentBlock } from \"./base.js\";\nimport {\n KNOWN_BLOCK_TYPES as KNOWN_TOOL_BLOCK_TYPES,\n type Tools,\n} from \"./tools.js\";\nimport {\n KNOWN_BLOCK_TYPES as KNOWN_MULTIMODAL_BLOCK_TYPES,\n type Multimodal,\n} from \"./multimodal.js\";\nimport { type Data } from \"./data.js\";\n\nexport interface ContentBlock extends BaseContentBlock {}\n\nexport const KNOWN_BLOCK_TYPES = [\n \"text\",\n \"reasoning\",\n ...KNOWN_TOOL_BLOCK_TYPES,\n ...KNOWN_MULTIMODAL_BLOCK_TYPES,\n];\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport declare namespace ContentBlock {\n /**\n * Annotation for citing data from a document.\n */\n export interface Citation {\n /**\n * Type of the content block\n */\n readonly type: \"citation\";\n /**\n * Source type for the citation.\n */\n source?: string;\n /**\n * URL of the document source\n */\n url?: string;\n /**\n * Source document title.\n *\n * For example, the page title for a web page or the title of a paper.\n */\n title?: string;\n /**\n * Start index of the **response text** for which the annotation applies.\n *\n * @see {Text}\n */\n startIndex?: number;\n /**\n * End index of the **response text** for which the annotation applies.\n *\n * @see {Text}\n */\n endIndex?: number;\n /**\n * Excerpt of source text being cited.\n */\n citedText?: string;\n }\n\n /**\n * Text output from a LLM.\n *\n * This typically represents the main text content of a message, such as the response\n * from a language model or the text of a user message.\n */\n export interface Text extends ContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"text\";\n /**\n * Block text.\n */\n text: string;\n /**\n * Index of block in aggregate response. Used during streaming.\n */\n index?: number;\n /**\n * Citations and other annotations.\n */\n annotations?: Array<Citation | BaseContentBlock>;\n }\n\n /**\n * Reasoning output from a LLM.\n */\n export interface Reasoning extends ContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"reasoning\";\n /**\n * Reasoning text.\n *\n * Either the thought summary or the raw reasoning text itself.\n * This is often parsed from `<think>` tags in the model's response.\n */\n reasoning: string;\n /**\n * Index of block in aggregate response. Used during streaming.\n */\n index?: number;\n }\n\n export { Tools };\n export { Multimodal };\n export { Data };\n\n export type Standard =\n | Text\n | Reasoning\n | Tools.Standard\n | Multimodal.Standard;\n}\n"],"mappings":";;;;AAaA,MAAaA,sBAAoB;CAC/B;CACA;CACA,GAAGC;CACH,GAAGC;AACJ"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["KNOWN_BLOCK_TYPES","KNOWN_TOOL_BLOCK_TYPES","KNOWN_MULTIMODAL_BLOCK_TYPES"],"sources":["../../../src/messages/content/index.ts"],"sourcesContent":["import type { BaseContentBlock } from \"./base.js\";\nimport {\n KNOWN_BLOCK_TYPES as KNOWN_TOOL_BLOCK_TYPES,\n type Tools,\n} from \"./tools.js\";\nimport {\n KNOWN_BLOCK_TYPES as KNOWN_MULTIMODAL_BLOCK_TYPES,\n type Multimodal,\n} from \"./multimodal.js\";\nimport { type Data } from \"./data.js\";\n\nexport interface ContentBlock extends BaseContentBlock {}\n\nexport const KNOWN_BLOCK_TYPES = [\n \"text\",\n \"reasoning\",\n ...KNOWN_TOOL_BLOCK_TYPES,\n ...KNOWN_MULTIMODAL_BLOCK_TYPES,\n];\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport declare namespace ContentBlock {\n /**\n * Annotation for citing data from a document.\n */\n export interface Citation {\n /**\n * Type of the content block\n */\n readonly type: \"citation\";\n /**\n * Source type for the citation.\n */\n source?: string;\n /**\n * URL of the document source\n */\n url?: string;\n /**\n * Source document title.\n *\n * For example, the page title for a web page or the title of a paper.\n */\n title?: string;\n /**\n * Start index of the **response text** for which the annotation applies.\n *\n * @see {Text}\n */\n startIndex?: number;\n /**\n * End index of the **response text** for which the annotation applies.\n *\n * @see {Text}\n */\n endIndex?: number;\n /**\n * Excerpt of source text being cited.\n */\n citedText?: string;\n }\n\n /**\n * Text output from a LLM.\n *\n * This typically represents the main text content of a message, such as the response\n * from a language model or the text of a user message.\n */\n export interface Text extends ContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"text\";\n /**\n * Block text.\n */\n text: string;\n /**\n * Index of block in aggregate response. Used during streaming.\n */\n index?: number;\n /**\n * Citations and other annotations.\n */\n annotations?: Array<Citation | BaseContentBlock>;\n }\n\n /**\n * Reasoning output from a LLM.\n */\n export interface Reasoning extends ContentBlock {\n /**\n * Type of the content block\n */\n readonly type: \"reasoning\";\n /**\n * Reasoning text.\n *\n * Either the thought summary or the raw reasoning text itself.\n * This is often parsed from `<think>` tags in the model's response.\n */\n reasoning: string;\n /**\n * Index of block in aggregate response. Used during streaming.\n */\n index?: number;\n }\n\n /**\n * Provider-specific content block.\n *\n * This is used to represent content blocks that are not part of the standard LangChain content model.\n * If a provider's non-standard output includes reasoning and tool calls, it should be\n * the adapter's job to parse that payload and emit the corresponding standard reasoning and tool call blocks.\n */\n export interface NonStandard<\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n TValue extends Record<string, any> = Record<string, any>\n > extends ContentBlock {\n /**\n * Type of the content block\n */\n type: \"non_standard\";\n /**\n * Provider-specific data\n */\n value: TValue;\n }\n\n export { Tools };\n export { Multimodal };\n export { Data };\n\n export type Standard =\n | Text\n | Reasoning\n | NonStandard\n | Tools.Standard\n | Multimodal.Standard;\n}\n"],"mappings":";;;;AAaA,MAAaA,sBAAoB;CAC/B;CACA;CACA,GAAGC;CACH,GAAGC;AACJ"}
|