Skip to content

Commit 4881781

Browse files
committed
docs(google): add JSON mode documentation to ChatVertexAI and ChatGoogleGenerativeAI
- Add JSON mode examples to both ChatVertexAI and ChatGoogleGenerativeAI documentation - Update JSDoc comments to mention JSON mode support - Reflects the fix for responseMimeType and function calling mode compatibility
1 parent 16b6aae commit 4881781

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

libs/langchain-google-genai/src/chat_models.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,8 @@ export interface GoogleGenerativeAIChatInput
201201

202202
/**
203203
* Google Generative AI chat model integration.
204+
*
205+
* Supports JSON mode, structured output, function calling, and multimodal inputs.
204206
*
205207
* Setup:
206208
* Install `@langchain/google-genai` and set an environment variable named `GOOGLE_API_KEY`.
@@ -455,6 +457,28 @@ export interface GoogleGenerativeAIChatInput
455457
* <br />
456458
*
457459
* <details>
460+
* <summary><strong>JSON Mode</strong></summary>
461+
*
462+
* ```typescript
463+
* const jsonLlm = llm.withConfig({
464+
* responseMimeType: "application/json"
465+
* });
466+
* const jsonResponse = await jsonLlm.invoke(
467+
* "Return a JSON object with key 'randomInts' and a value of 10 random integers between 0-99"
468+
* );
469+
* console.log(jsonResponse.content);
470+
* ```
471+
*
472+
* ```txt
473+
* {
474+
* "randomInts": [23, 87, 45, 12, 78, 34, 56, 90, 11, 67]
475+
* }
476+
* ```
477+
* </details>
478+
*
479+
* <br />
480+
*
481+
* <details>
458482
* <summary><strong>Multimodal</strong></summary>
459483
*
460484
* ```typescript

libs/langchain-google-vertexai/src/chat_models.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ export interface ChatVertexAIInput extends ChatGoogleInput {}
77

88
/**
99
* Integration with Google Vertex AI chat models.
10+
*
11+
* Supports JSON mode, structured output, function calling, and multimodal inputs.
1012
*
1113
* Setup:
1214
* Install `@langchain/google-vertexai` and set your stringified
@@ -249,6 +251,28 @@ export interface ChatVertexAIInput extends ChatGoogleInput {}
249251
* <br />
250252
*
251253
* <details>
254+
* <summary><strong>JSON Mode</strong></summary>
255+
*
256+
* ```typescript
257+
* const jsonLlm = llm.withConfig({
258+
* responseMimeType: "application/json"
259+
* });
260+
* const jsonResponse = await jsonLlm.invoke(
261+
* "Return a JSON object with key 'randomInts' and a value of 10 random integers between 0-99"
262+
* );
263+
* console.log(jsonResponse.content);
264+
* ```
265+
*
266+
* ```txt
267+
* {
268+
* "randomInts": [23, 87, 45, 12, 78, 34, 56, 90, 11, 67]
269+
* }
270+
* ```
271+
* </details>
272+
*
273+
* <br />
274+
*
275+
* <details>
252276
* <summary><strong>Usage Metadata</strong></summary>
253277
*
254278
* ```typescript

0 commit comments

Comments
 (0)