@langchain/google-genai 0.0.12 → 0.0.13
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/utils.cjs +14 -0
- package/dist/utils.js +14 -0
- package/package.json +2 -2
package/dist/utils.cjs
CHANGED
|
@@ -34,6 +34,17 @@ function convertAuthorToRole(author) {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
exports.convertAuthorToRole = convertAuthorToRole;
|
|
37
|
+
function messageContentMedia(content) {
|
|
38
|
+
if ("mimeType" in content && "data" in content) {
|
|
39
|
+
return {
|
|
40
|
+
inlineData: {
|
|
41
|
+
mimeType: content.mimeType,
|
|
42
|
+
data: content.data,
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
throw new Error("Invalid media content");
|
|
47
|
+
}
|
|
37
48
|
function convertMessageContentToParts(content, isMultimodalModel) {
|
|
38
49
|
if (typeof content === "string") {
|
|
39
50
|
return [{ text: content }];
|
|
@@ -73,6 +84,9 @@ function convertMessageContentToParts(content, isMultimodalModel) {
|
|
|
73
84
|
},
|
|
74
85
|
};
|
|
75
86
|
}
|
|
87
|
+
else if (c.type === "media") {
|
|
88
|
+
return messageContentMedia(c);
|
|
89
|
+
}
|
|
76
90
|
throw new Error(`Unknown content type ${c.type}`);
|
|
77
91
|
});
|
|
78
92
|
}
|
package/dist/utils.js
CHANGED
|
@@ -29,6 +29,17 @@ export function convertAuthorToRole(author) {
|
|
|
29
29
|
throw new Error(`Unknown / unsupported author: ${author}`);
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
+
function messageContentMedia(content) {
|
|
33
|
+
if ("mimeType" in content && "data" in content) {
|
|
34
|
+
return {
|
|
35
|
+
inlineData: {
|
|
36
|
+
mimeType: content.mimeType,
|
|
37
|
+
data: content.data,
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
throw new Error("Invalid media content");
|
|
42
|
+
}
|
|
32
43
|
export function convertMessageContentToParts(content, isMultimodalModel) {
|
|
33
44
|
if (typeof content === "string") {
|
|
34
45
|
return [{ text: content }];
|
|
@@ -68,6 +79,9 @@ export function convertMessageContentToParts(content, isMultimodalModel) {
|
|
|
68
79
|
},
|
|
69
80
|
};
|
|
70
81
|
}
|
|
82
|
+
else if (c.type === "media") {
|
|
83
|
+
return messageContentMedia(c);
|
|
84
|
+
}
|
|
71
85
|
throw new Error(`Unknown content type ${c.type}`);
|
|
72
86
|
});
|
|
73
87
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@langchain/google-genai",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13",
|
|
4
4
|
"description": "Sample integration for LangChain.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"license": "MIT",
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@google/generative-ai": "^0.7.0",
|
|
43
|
-
"@langchain/core": "
|
|
43
|
+
"@langchain/core": "<0.3.0 || >0.1.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@jest/globals": "^29.5.0",
|