@langchain/google-common 0.0.19 → 0.0.20

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.
@@ -5,7 +5,7 @@ import { ChatGenerationChunk, ChatResult } from "@langchain/core/outputs";
5
5
  import { AIMessageChunk } from "@langchain/core/messages";
6
6
  import { BaseLanguageModelInput, StructuredOutputMethodOptions, ToolDefinition } from "@langchain/core/language_models/base";
7
7
  import type { z } from "zod";
8
- import { Runnable } from "@langchain/core/runnables";
8
+ import { Runnable, RunnableToolLike } from "@langchain/core/runnables";
9
9
  import { AsyncCaller } from "@langchain/core/utils/async_caller";
10
10
  import { StructuredToolInterface } from "@langchain/core/tools";
11
11
  import { GoogleAIBaseLLMInput, GoogleAIModelParams, GoogleAISafetySetting, GoogleConnectionParams, GooglePlatformType, GeminiContent, GoogleAIBaseLanguageModelCallOptions } from "./types.js";
@@ -55,7 +55,7 @@ export declare abstract class ChatGoogleBase<AuthOptions> extends BaseChatModel<
55
55
  buildClient(fields?: GoogleAIBaseLLMInput<AuthOptions>): GoogleAbstractedClient;
56
56
  buildConnection(fields: GoogleBaseLLMInput<AuthOptions>, client: GoogleAbstractedClient): void;
57
57
  get platform(): GooglePlatformType;
58
- bindTools(tools: (StructuredToolInterface | Record<string, unknown> | ToolDefinition)[], kwargs?: Partial<GoogleAIBaseLanguageModelCallOptions>): Runnable<BaseLanguageModelInput, AIMessageChunk, GoogleAIBaseLanguageModelCallOptions>;
58
+ bindTools(tools: (StructuredToolInterface | Record<string, unknown> | ToolDefinition | RunnableToolLike)[], kwargs?: Partial<GoogleAIBaseLanguageModelCallOptions>): Runnable<BaseLanguageModelInput, AIMessageChunk, GoogleAIBaseLanguageModelCallOptions>;
59
59
  _llmType(): string;
60
60
  /**
61
61
  * Get the parameters used to invoke the model
@@ -481,6 +481,7 @@ function responseToChatGenerations(response) {
481
481
  args: toolCall.function.arguments,
482
482
  id: toolCall.id,
483
483
  index: i,
484
+ type: "tool_call_chunk",
484
485
  }));
485
486
  let usageMetadata;
486
487
  if ("usageMetadata" in response.data) {
@@ -527,6 +528,7 @@ function partsToBaseMessageFields(parts) {
527
528
  name: tool.function.name,
528
529
  args: JSON.parse(tool.function.arguments),
529
530
  id: tool.id,
531
+ type: "tool_call",
530
532
  });
531
533
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
532
534
  }
@@ -536,6 +538,7 @@ function partsToBaseMessageFields(parts) {
536
538
  args: JSON.parse(tool.function.arguments),
537
539
  id: tool.id,
538
540
  error: e.message,
541
+ type: "invalid_tool_call",
539
542
  });
540
543
  }
541
544
  }
@@ -572,8 +575,8 @@ function validateGeminiParams(params) {
572
575
  throw new Error("`maxOutputTokens` must be a positive integer");
573
576
  }
574
577
  if (params.temperature &&
575
- (params.temperature < 0 || params.temperature > 1)) {
576
- throw new Error("`temperature` must be in the range of [0.0,1.0]");
578
+ (params.temperature < 0 || params.temperature > 2)) {
579
+ throw new Error("`temperature` must be in the range of [0.0,2.0]");
577
580
  }
578
581
  if (params.topP && (params.topP < 0 || params.topP > 1)) {
579
582
  throw new Error("`topP` must be in the range of [0.0,1.0]");
@@ -460,6 +460,7 @@ export function responseToChatGenerations(response) {
460
460
  args: toolCall.function.arguments,
461
461
  id: toolCall.id,
462
462
  index: i,
463
+ type: "tool_call_chunk",
463
464
  }));
464
465
  let usageMetadata;
465
466
  if ("usageMetadata" in response.data) {
@@ -504,6 +505,7 @@ export function partsToBaseMessageFields(parts) {
504
505
  name: tool.function.name,
505
506
  args: JSON.parse(tool.function.arguments),
506
507
  id: tool.id,
508
+ type: "tool_call",
507
509
  });
508
510
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
509
511
  }
@@ -513,6 +515,7 @@ export function partsToBaseMessageFields(parts) {
513
515
  args: JSON.parse(tool.function.arguments),
514
516
  id: tool.id,
515
517
  error: e.message,
518
+ type: "invalid_tool_call",
516
519
  });
517
520
  }
518
521
  }
@@ -544,8 +547,8 @@ export function validateGeminiParams(params) {
544
547
  throw new Error("`maxOutputTokens` must be a positive integer");
545
548
  }
546
549
  if (params.temperature &&
547
- (params.temperature < 0 || params.temperature > 1)) {
548
- throw new Error("`temperature` must be in the range of [0.0,1.0]");
550
+ (params.temperature < 0 || params.temperature > 2)) {
551
+ throw new Error("`temperature` must be in the range of [0.0,2.0]");
549
552
  }
550
553
  if (params.topP && (params.topP < 0 || params.topP > 1)) {
551
554
  throw new Error("`topP` must be in the range of [0.0,1.0]");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langchain/google-common",
3
- "version": "0.0.19",
3
+ "version": "0.0.20",
4
4
  "description": "Core types and classes for Google services.",
5
5
  "type": "module",
6
6
  "engines": {
@@ -40,8 +40,8 @@
40
40
  "author": "LangChain",
41
41
  "license": "MIT",
42
42
  "dependencies": {
43
- "@langchain/core": ">=0.2.9 <0.3.0",
44
- "uuid": "^9.0.0",
43
+ "@langchain/core": ">=0.2.16 <0.3.0",
44
+ "uuid": "^10.0.0",
45
45
  "zod-to-json-schema": "^3.22.4"
46
46
  },
47
47
  "devDependencies": {