@langchain/google-vertexai 2.0.5-dev-1765433794876 → 2.1.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @langchain/google-vertexai
2
2
 
3
+ ## 2.1.0
4
+
5
+ ### Patch Changes
6
+
7
+ - [#8951](https://github.com/langchain-ai/langchainjs/pull/8951) [`a2a0088`](https://github.com/langchain-ai/langchainjs/commit/a2a00880b80119eb926de05e9c556a44fd56632e) Thanks [@christian-bromann](https://github.com/christian-bromann)! - fix(google-common): handle unsupported Zod schema features for Gemini tools
8
+
9
+ - Updated dependencies []:
10
+ - @langchain/google-gauth@2.1.0
11
+
3
12
  ## 2.0.4
4
13
 
5
14
  ### Patch Changes
package/README.md CHANGED
@@ -8,17 +8,15 @@ environment it is running on.
8
8
 
9
9
  If you are running this on a platform where the credentials cannot
10
10
  be provided this way, consider using the @langchain/google-vertexai-web
11
- package *instead*. You do not need to use both packages. See the
11
+ package _instead_. You do not need to use both packages. See the
12
12
  section on **Authorization** below.
13
13
 
14
-
15
14
  ## Installation
16
15
 
17
16
  ```bash
18
17
  $ pnpm install @langchain/google-vertexai
19
18
  ```
20
19
 
21
-
22
20
  ## Authorization
23
21
 
24
22
  Authorization is done through a Google Cloud Service Account.
@@ -32,9 +30,68 @@ credentials from the first of the following that apply:
32
30
  2. Credentials that are passed to the constructor using the `authInfo` attribute
33
31
  3. An API Key that is set in the environment variable `API_KEY`
34
32
  4. The Service Account credentials that are saved in a file. The path to
35
- this file is set in the `GOOGLE_APPLICATION_CREDENTIALS` environment
33
+ this file is set in the `GOOGLE_APPLICATION_CREDENTIALS` environment
36
34
  variable.
37
35
  5. If you are running on a Google Cloud Platform resource, or if you have
38
36
  logged in using `gcloud auth application-default login`, then the
39
37
  default credentials.
40
38
 
39
+ ## Tool Schema Limitations
40
+
41
+ When using tools with Gemini models through Vertex AI, be aware of the following Zod schema limitations:
42
+
43
+ ### Unsupported Schema Features
44
+
45
+ 1. **Discriminated Unions** - `.discriminatedUnion()` is not supported
46
+
47
+ ```typescript
48
+ // ❌ This will throw an error
49
+ z.discriminatedUnion("type", [
50
+ z.object({ type: z.literal("a"), value: z.string() }),
51
+ z.object({ type: z.literal("b"), value: z.number() }),
52
+ ]);
53
+
54
+ // ✅ Use a flat object with optional fields instead
55
+ z.object({
56
+ type: z.enum(["a", "b"]),
57
+ stringValue: z.string().optional(),
58
+ numberValue: z.number().optional(),
59
+ });
60
+ ```
61
+
62
+ 2. **Union Types** - `z.union()` is not supported
63
+
64
+ ```typescript
65
+ // ❌ This will throw an error
66
+ z.union([z.string(), z.number()]);
67
+
68
+ // ✅ Consider using separate optional fields
69
+ z.object({
70
+ stringValue: z.string().optional(),
71
+ numberValue: z.number().optional(),
72
+ });
73
+ ```
74
+
75
+ 3. **Positive Refinement** - `.positive()` is automatically converted
76
+
77
+ ```typescript
78
+ // ⚠️ This is automatically converted to .min(0.01)
79
+ z.number().positive();
80
+
81
+ // ✅ Prefer using .min() directly
82
+ z.number().min(0.01);
83
+ ```
84
+
85
+ ### Error Messages
86
+
87
+ If you use unsupported schema features, you'll receive descriptive error messages:
88
+
89
+ - For union types: `"Gemini cannot handle union types (discriminatedUnion, anyOf, oneOf)"`
90
+ - For tool conversion failures: `"Failed to convert tool '[toolName]' schema for Gemini"`
91
+
92
+ ### Best Practices
93
+
94
+ 1. Use simple, flat object structures when possible
95
+ 2. Replace discriminated unions with enums and optional fields
96
+ 3. Use `.min()` instead of `.positive()` for number constraints
97
+ 4. Test your tool schemas before deploying to production
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langchain/google-vertexai",
3
- "version": "2.0.5-dev-1765433794876",
3
+ "version": "2.1.0",
4
4
  "description": "LangChain.js support for Google Vertex AI",
5
5
  "author": "LangChain",
6
6
  "license": "MIT",
@@ -14,7 +14,7 @@
14
14
  },
15
15
  "homepage": "https://github.com/langchain-ai/langchainjs/tree/main/libs/langchain-google-vertexai/",
16
16
  "dependencies": {
17
- "@langchain/google-gauth": "2.0.5-dev-1765433794876"
17
+ "@langchain/google-gauth": "2.1.0"
18
18
  },
19
19
  "devDependencies": {
20
20
  "@jest/globals": "^29.5.0",
@@ -32,8 +32,8 @@
32
32
  "typescript": "~5.8.3",
33
33
  "zod": "^3.25.76",
34
34
  "@langchain/eslint": "0.1.1",
35
- "@langchain/google-common": "2.0.5-dev-1765433794876",
36
- "@langchain/standard-tests": "0.0.8-dev-1765433794876",
35
+ "@langchain/google-common": "2.1.0",
36
+ "@langchain/standard-tests": "0.0.8",
37
37
  "@langchain/tsconfig": "0.0.1"
38
38
  },
39
39
  "publishConfig": {
package/types.cjs ADDED
@@ -0,0 +1 @@
1
+ module.exports = require("./dist/types.cjs");
package/types.d.cts ADDED
@@ -0,0 +1 @@
1
+ export * from "./dist/types.js";
package/types.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "./dist/types.js";
package/types.js ADDED
@@ -0,0 +1 @@
1
+ export * from "./dist/types.js";
package/utils.cjs ADDED
@@ -0,0 +1 @@
1
+ module.exports = require("./dist/utils.cjs");
package/utils.d.cts ADDED
@@ -0,0 +1 @@
1
+ export * from "./dist/utils.js";
package/utils.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "./dist/utils.js";
package/utils.js ADDED
@@ -0,0 +1 @@
1
+ export * from "./dist/utils.js";