@langchain/google-genai 0.0.11 → 0.0.12

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.
@@ -44,7 +44,7 @@ class ChatGoogleGenerativeAI extends chat_models_1.BaseChatModel {
44
44
  };
45
45
  }
46
46
  get _isMultimodalModel() {
47
- return this.model.includes("vision");
47
+ return this.model.includes("vision") || this.model.startsWith("gemini-1.5");
48
48
  }
49
49
  constructor(fields) {
50
50
  super(fields ?? {});
@@ -41,7 +41,7 @@ export class ChatGoogleGenerativeAI extends BaseChatModel {
41
41
  };
42
42
  }
43
43
  get _isMultimodalModel() {
44
- return this.model.includes("vision");
44
+ return this.model.includes("vision") || this.model.startsWith("gemini-1.5");
45
45
  }
46
46
  constructor(fields) {
47
47
  super(fields ?? {});
package/dist/utils.cjs CHANGED
@@ -48,10 +48,17 @@ function convertMessageContentToParts(content, isMultimodalModel) {
48
48
  if (!isMultimodalModel) {
49
49
  throw new Error(`This model does not support images`);
50
50
  }
51
- if (typeof c.image_url !== "string") {
51
+ let source;
52
+ if (typeof c.image_url === "string") {
53
+ source = c.image_url;
54
+ }
55
+ else if (typeof c.image_url === "object" && "url" in c.image_url) {
56
+ source = c.image_url.url;
57
+ }
58
+ else {
52
59
  throw new Error("Please provide image as base64 encoded data URL");
53
60
  }
54
- const [dm, data] = c.image_url.split(",");
61
+ const [dm, data] = source.split(",");
55
62
  if (!dm.startsWith("data:")) {
56
63
  throw new Error("Please provide image as base64 encoded data URL");
57
64
  }
package/dist/utils.js CHANGED
@@ -43,10 +43,17 @@ export function convertMessageContentToParts(content, isMultimodalModel) {
43
43
  if (!isMultimodalModel) {
44
44
  throw new Error(`This model does not support images`);
45
45
  }
46
- if (typeof c.image_url !== "string") {
46
+ let source;
47
+ if (typeof c.image_url === "string") {
48
+ source = c.image_url;
49
+ }
50
+ else if (typeof c.image_url === "object" && "url" in c.image_url) {
51
+ source = c.image_url.url;
52
+ }
53
+ else {
47
54
  throw new Error("Please provide image as base64 encoded data URL");
48
55
  }
49
- const [dm, data] = c.image_url.split(",");
56
+ const [dm, data] = source.split(",");
50
57
  if (!dm.startsWith("data:")) {
51
58
  throw new Error("Please provide image as base64 encoded data URL");
52
59
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langchain/google-genai",
3
- "version": "0.0.11",
3
+ "version": "0.0.12",
4
4
  "description": "Sample integration for LangChain.js",
5
5
  "type": "module",
6
6
  "engines": {
@@ -39,7 +39,7 @@
39
39
  "author": "LangChain",
40
40
  "license": "MIT",
41
41
  "dependencies": {
42
- "@google/generative-ai": "^0.1.3",
42
+ "@google/generative-ai": "^0.7.0",
43
43
  "@langchain/core": "~0.1.5"
44
44
  },
45
45
  "devDependencies": {
@@ -58,7 +58,7 @@
58
58
  "eslint-plugin-import": "^2.27.5",
59
59
  "eslint-plugin-no-instanceof": "^1.0.1",
60
60
  "eslint-plugin-prettier": "^4.2.1",
61
- "hnswlib-node": "^1.4.2",
61
+ "hnswlib-node": "^3.0.0",
62
62
  "jest": "^29.5.0",
63
63
  "jest-environment-node": "^29.6.4",
64
64
  "prettier": "^2.8.3",