@langchain/google 0.2.1 → 0.2.2

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.
Files changed (74) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/chat_models/base.cjs +11 -3
  3. package/dist/chat_models/base.cjs.map +1 -1
  4. package/dist/chat_models/base.d.cts +1 -3
  5. package/dist/chat_models/base.d.ts +1 -3
  6. package/dist/chat_models/base.js +11 -4
  7. package/dist/chat_models/base.js.map +1 -1
  8. package/dist/chat_models/index.cjs.map +1 -1
  9. package/dist/chat_models/index.d.cts +0 -1
  10. package/dist/chat_models/index.d.ts +0 -1
  11. package/dist/chat_models/index.js.map +1 -1
  12. package/dist/chat_models/node.cjs +1 -1
  13. package/dist/chat_models/node.cjs.map +1 -1
  14. package/dist/chat_models/node.d.cts +1 -2
  15. package/dist/chat_models/node.d.ts +1 -2
  16. package/dist/chat_models/node.js +1 -1
  17. package/dist/chat_models/node.js.map +1 -1
  18. package/dist/chat_models/profiles.cjs.map +1 -1
  19. package/dist/chat_models/profiles.js.map +1 -1
  20. package/dist/chat_models/types.cjs.map +1 -1
  21. package/dist/chat_models/types.d.cts +1 -2
  22. package/dist/chat_models/types.d.ts +1 -2
  23. package/dist/chat_models/types.js.map +1 -1
  24. package/dist/clients/index.cjs +1 -0
  25. package/dist/clients/index.cjs.map +1 -1
  26. package/dist/clients/index.js +1 -0
  27. package/dist/clients/index.js.map +1 -1
  28. package/dist/clients/node.cjs +1 -0
  29. package/dist/clients/node.cjs.map +1 -1
  30. package/dist/clients/node.d.cts +0 -1
  31. package/dist/clients/node.d.ts +0 -1
  32. package/dist/clients/node.js +1 -0
  33. package/dist/clients/node.js.map +1 -1
  34. package/dist/const.cjs.map +1 -1
  35. package/dist/const.js.map +1 -1
  36. package/dist/converters/messages.cjs +2 -0
  37. package/dist/converters/messages.cjs.map +1 -1
  38. package/dist/converters/messages.js +1 -1
  39. package/dist/converters/messages.js.map +1 -1
  40. package/dist/converters/params.cjs +5 -0
  41. package/dist/converters/params.cjs.map +1 -1
  42. package/dist/converters/params.js +1 -1
  43. package/dist/converters/params.js.map +1 -1
  44. package/dist/converters/tools.cjs +1 -0
  45. package/dist/converters/tools.cjs.map +1 -1
  46. package/dist/converters/tools.js +1 -1
  47. package/dist/converters/tools.js.map +1 -1
  48. package/dist/node.cjs +1 -1
  49. package/dist/node.d.cts +2 -2
  50. package/dist/node.d.ts +2 -2
  51. package/dist/node.js +1 -1
  52. package/dist/utils/errors.cjs +27 -10
  53. package/dist/utils/errors.cjs.map +1 -1
  54. package/dist/utils/errors.js +28 -12
  55. package/dist/utils/errors.js.map +1 -1
  56. package/dist/utils/gcp-auth.cjs +2 -0
  57. package/dist/utils/gcp-auth.cjs.map +1 -1
  58. package/dist/utils/gcp-auth.js +1 -1
  59. package/dist/utils/gcp-auth.js.map +1 -1
  60. package/dist/utils/handler.cjs.map +1 -1
  61. package/dist/utils/handler.d.cts +0 -1
  62. package/dist/utils/handler.d.ts +0 -1
  63. package/dist/utils/handler.js.map +1 -1
  64. package/dist/utils/metadata.cjs.map +1 -1
  65. package/dist/utils/metadata.js.map +1 -1
  66. package/dist/utils/misc.cjs.map +1 -1
  67. package/dist/utils/misc.d.cts +1 -1
  68. package/dist/utils/misc.d.ts +1 -1
  69. package/dist/utils/misc.js.map +1 -1
  70. package/dist/utils/stream.cjs.map +1 -1
  71. package/dist/utils/stream.js.map +1 -1
  72. package/dist/utils/stream_events.cjs.map +1 -1
  73. package/dist/utils/stream_events.js.map +1 -1
  74. package/package.json +6 -6
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["BaseChatGoogle","getGoogleChatModelParams","WebApiClient"],"sources":["../../src/chat_models/index.ts"],"sourcesContent":["import { getEnvironmentVariable } from \"@langchain/core/utils/env\";\nimport { WebApiClient } from \"../clients/index.js\";\nimport {\n BaseChatGoogle,\n BaseChatGoogleCallOptions,\n BaseChatGoogleParams,\n getGoogleChatModelParams,\n} from \"./base.js\";\n\n/**\n * Configuration parameters for the ChatGoogle model.\n *\n * This interface extends the base Google chat model parameters and adds\n * specific configuration options for the Generative AI API.\n */\nexport interface ChatGoogleParams extends BaseChatGoogleParams {\n /**\n * Google API key for authentication with the Generative AI API.\n *\n * If not provided, the model will attempt to use the `GOOGLE_API_KEY`\n * environment variable. You can obtain an API key from the\n * [Google AI Studio](https://makersuite.google.com/app/apikey).\n */\n apiKey?: string;\n\n /** @deprecated Import from `@langchain/google/node` to configure google auth options */\n authOptions?: never;\n}\n\n/**\n * Call options for the ChatGoogle model.\n *\n * This interface extends the base Google chat model call options and provides\n * configuration for individual model invocations. These options can be passed\n * when calling methods like `invoke()`, `stream()`, or `batch()` to customize\n * the behavior of a specific request.\n */\nexport interface ChatGoogleCallOptions extends BaseChatGoogleCallOptions {}\n\nexport class ChatGoogle extends BaseChatGoogle<ChatGoogleCallOptions> {\n apiKey?: string;\n\n constructor(model: string, params?: Omit<ChatGoogleParams, \"model\">);\n constructor(params: ChatGoogleParams);\n constructor(\n modelOrParams: string | ChatGoogleParams,\n paramsArg?: Omit<ChatGoogleParams, \"model\">\n ) {\n const params = getGoogleChatModelParams(modelOrParams, paramsArg);\n params.apiKey = params?.apiKey ?? getEnvironmentVariable(\"GOOGLE_API_KEY\");\n const apiClient = params?.apiClient ?? new WebApiClient(params);\n super({ ...params, apiClient });\n\n this.apiKey = params.apiKey;\n }\n}\n"],"mappings":";;;;AAuCA,IAAa,aAAb,cAAgCA,aAAAA,eAAsC;CACpE;CAIA,YACE,eACA,WACA;EACA,MAAM,SAASC,aAAAA,yBAAyB,eAAe,UAAU;AACjE,SAAO,SAAS,QAAQ,WAAA,GAAA,0BAAA,wBAAiC,iBAAiB;EAC1E,MAAM,YAAY,QAAQ,aAAa,IAAIC,cAAAA,aAAa,OAAO;AAC/D,QAAM;GAAE,GAAG;GAAQ;GAAW,CAAC;AAE/B,OAAK,SAAS,OAAO"}
1
+ {"version":3,"file":"index.cjs","names":["BaseChatGoogle","getGoogleChatModelParams","WebApiClient"],"sources":["../../src/chat_models/index.ts"],"sourcesContent":["import { getEnvironmentVariable } from \"@langchain/core/utils/env\";\nimport { WebApiClient } from \"../clients/index.js\";\nimport {\n BaseChatGoogle,\n BaseChatGoogleCallOptions,\n BaseChatGoogleParams,\n getGoogleChatModelParams,\n} from \"./base.js\";\n\n/**\n * Configuration parameters for the ChatGoogle model.\n *\n * This interface extends the base Google chat model parameters and adds\n * specific configuration options for the Generative AI API.\n */\nexport interface ChatGoogleParams extends BaseChatGoogleParams {\n /**\n * Google API key for authentication with the Generative AI API.\n *\n * If not provided, the model will attempt to use the `GOOGLE_API_KEY`\n * environment variable. You can obtain an API key from the\n * [Google AI Studio](https://makersuite.google.com/app/apikey).\n */\n apiKey?: string;\n\n /** @deprecated Import from `@langchain/google/node` to configure google auth options */\n authOptions?: never;\n}\n\n/**\n * Call options for the ChatGoogle model.\n *\n * This interface extends the base Google chat model call options and provides\n * configuration for individual model invocations. These options can be passed\n * when calling methods like `invoke()`, `stream()`, or `batch()` to customize\n * the behavior of a specific request.\n */\nexport interface ChatGoogleCallOptions extends BaseChatGoogleCallOptions {}\n\nexport class ChatGoogle extends BaseChatGoogle<ChatGoogleCallOptions> {\n apiKey?: string;\n\n constructor(model: string, params?: Omit<ChatGoogleParams, \"model\">);\n constructor(params: ChatGoogleParams);\n constructor(\n modelOrParams: string | ChatGoogleParams,\n paramsArg?: Omit<ChatGoogleParams, \"model\">\n ) {\n const params = getGoogleChatModelParams(modelOrParams, paramsArg);\n params.apiKey = params?.apiKey ?? getEnvironmentVariable(\"GOOGLE_API_KEY\");\n const apiClient = params?.apiClient ?? new WebApiClient(params);\n super({ ...params, apiClient });\n\n this.apiKey = params.apiKey;\n }\n}\n"],"mappings":";;;;AAuCA,IAAa,aAAb,cAAgCA,aAAAA,eAAsC;CACpE;CAIA,YACE,eACA,WACA;EACA,MAAM,SAASC,aAAAA,yBAAyB,eAAe,SAAS;EAChE,OAAO,SAAS,QAAQ,WAAA,GAAA,0BAAA,uBAAA,CAAiC,gBAAgB;EACzE,MAAM,YAAY,QAAQ,aAAa,IAAIC,cAAAA,aAAa,MAAM;EAC9D,MAAM;GAAE,GAAG;GAAQ;EAAU,CAAC;EAE9B,KAAK,SAAS,OAAO;CACvB;AACF"}
@@ -1,5 +1,4 @@
1
1
  import { BaseChatGoogle, BaseChatGoogleCallOptions, BaseChatGoogleParams } from "./base.cjs";
2
-
3
2
  //#region src/chat_models/index.d.ts
4
3
  /**
5
4
  * Configuration parameters for the ChatGoogle model.
@@ -1,5 +1,4 @@
1
1
  import { BaseChatGoogle, BaseChatGoogleCallOptions, BaseChatGoogleParams } from "./base.js";
2
-
3
2
  //#region src/chat_models/index.d.ts
4
3
  /**
5
4
  * Configuration parameters for the ChatGoogle model.
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/chat_models/index.ts"],"sourcesContent":["import { getEnvironmentVariable } from \"@langchain/core/utils/env\";\nimport { WebApiClient } from \"../clients/index.js\";\nimport {\n BaseChatGoogle,\n BaseChatGoogleCallOptions,\n BaseChatGoogleParams,\n getGoogleChatModelParams,\n} from \"./base.js\";\n\n/**\n * Configuration parameters for the ChatGoogle model.\n *\n * This interface extends the base Google chat model parameters and adds\n * specific configuration options for the Generative AI API.\n */\nexport interface ChatGoogleParams extends BaseChatGoogleParams {\n /**\n * Google API key for authentication with the Generative AI API.\n *\n * If not provided, the model will attempt to use the `GOOGLE_API_KEY`\n * environment variable. You can obtain an API key from the\n * [Google AI Studio](https://makersuite.google.com/app/apikey).\n */\n apiKey?: string;\n\n /** @deprecated Import from `@langchain/google/node` to configure google auth options */\n authOptions?: never;\n}\n\n/**\n * Call options for the ChatGoogle model.\n *\n * This interface extends the base Google chat model call options and provides\n * configuration for individual model invocations. These options can be passed\n * when calling methods like `invoke()`, `stream()`, or `batch()` to customize\n * the behavior of a specific request.\n */\nexport interface ChatGoogleCallOptions extends BaseChatGoogleCallOptions {}\n\nexport class ChatGoogle extends BaseChatGoogle<ChatGoogleCallOptions> {\n apiKey?: string;\n\n constructor(model: string, params?: Omit<ChatGoogleParams, \"model\">);\n constructor(params: ChatGoogleParams);\n constructor(\n modelOrParams: string | ChatGoogleParams,\n paramsArg?: Omit<ChatGoogleParams, \"model\">\n ) {\n const params = getGoogleChatModelParams(modelOrParams, paramsArg);\n params.apiKey = params?.apiKey ?? getEnvironmentVariable(\"GOOGLE_API_KEY\");\n const apiClient = params?.apiClient ?? new WebApiClient(params);\n super({ ...params, apiClient });\n\n this.apiKey = params.apiKey;\n }\n}\n"],"mappings":";;;;AAuCA,IAAa,aAAb,cAAgC,eAAsC;CACpE;CAIA,YACE,eACA,WACA;EACA,MAAM,SAAS,yBAAyB,eAAe,UAAU;AACjE,SAAO,SAAS,QAAQ,UAAU,uBAAuB,iBAAiB;EAC1E,MAAM,YAAY,QAAQ,aAAa,IAAI,aAAa,OAAO;AAC/D,QAAM;GAAE,GAAG;GAAQ;GAAW,CAAC;AAE/B,OAAK,SAAS,OAAO"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/chat_models/index.ts"],"sourcesContent":["import { getEnvironmentVariable } from \"@langchain/core/utils/env\";\nimport { WebApiClient } from \"../clients/index.js\";\nimport {\n BaseChatGoogle,\n BaseChatGoogleCallOptions,\n BaseChatGoogleParams,\n getGoogleChatModelParams,\n} from \"./base.js\";\n\n/**\n * Configuration parameters for the ChatGoogle model.\n *\n * This interface extends the base Google chat model parameters and adds\n * specific configuration options for the Generative AI API.\n */\nexport interface ChatGoogleParams extends BaseChatGoogleParams {\n /**\n * Google API key for authentication with the Generative AI API.\n *\n * If not provided, the model will attempt to use the `GOOGLE_API_KEY`\n * environment variable. You can obtain an API key from the\n * [Google AI Studio](https://makersuite.google.com/app/apikey).\n */\n apiKey?: string;\n\n /** @deprecated Import from `@langchain/google/node` to configure google auth options */\n authOptions?: never;\n}\n\n/**\n * Call options for the ChatGoogle model.\n *\n * This interface extends the base Google chat model call options and provides\n * configuration for individual model invocations. These options can be passed\n * when calling methods like `invoke()`, `stream()`, or `batch()` to customize\n * the behavior of a specific request.\n */\nexport interface ChatGoogleCallOptions extends BaseChatGoogleCallOptions {}\n\nexport class ChatGoogle extends BaseChatGoogle<ChatGoogleCallOptions> {\n apiKey?: string;\n\n constructor(model: string, params?: Omit<ChatGoogleParams, \"model\">);\n constructor(params: ChatGoogleParams);\n constructor(\n modelOrParams: string | ChatGoogleParams,\n paramsArg?: Omit<ChatGoogleParams, \"model\">\n ) {\n const params = getGoogleChatModelParams(modelOrParams, paramsArg);\n params.apiKey = params?.apiKey ?? getEnvironmentVariable(\"GOOGLE_API_KEY\");\n const apiClient = params?.apiClient ?? new WebApiClient(params);\n super({ ...params, apiClient });\n\n this.apiKey = params.apiKey;\n }\n}\n"],"mappings":";;;;AAuCA,IAAa,aAAb,cAAgC,eAAsC;CACpE;CAIA,YACE,eACA,WACA;EACA,MAAM,SAAS,yBAAyB,eAAe,SAAS;EAChE,OAAO,SAAS,QAAQ,UAAU,uBAAuB,gBAAgB;EACzE,MAAM,YAAY,QAAQ,aAAa,IAAI,aAAa,MAAM;EAC9D,MAAM;GAAE,GAAG;GAAQ;EAAU,CAAC;EAE9B,KAAK,SAAS,OAAO;CACvB;AACF"}
@@ -26,6 +26,6 @@ function getRequiredAuthScopes(params) {
26
26
  }
27
27
  }
28
28
  //#endregion
29
- exports.ChatGoogleNode = ChatGoogleNode;
29
+ exports.ChatGoogle = ChatGoogleNode;
30
30
 
31
31
  //# sourceMappingURL=node.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"node.cjs","names":["BaseChatGoogle","getGoogleChatModelParams","ensureAuthScopes","NodeApiClient","getPlatformType","convertParamsToPlatformType","GENERATIVE_AI_AUTH_SCOPES","VERTEX_AI_AUTH_SCOPES"],"sources":["../../src/chat_models/node.ts"],"sourcesContent":["import { getEnvironmentVariable } from \"@langchain/core/utils/env\";\nimport { ChatGoogleParams } from \"./index.js\";\nimport {\n BaseChatGoogle,\n getGoogleChatModelParams,\n getPlatformType,\n} from \"./base.js\";\nimport { GENERATIVE_AI_AUTH_SCOPES, VERTEX_AI_AUTH_SCOPES } from \"../const.js\";\nimport {\n ensureAuthScopes,\n NodeApiClient,\n NodeApiClientParams,\n} from \"../clients/node.js\";\nimport { convertParamsToPlatformType } from \"../converters/params.js\";\n\ninterface ChatGoogleNodeParams extends NodeApiClientParams, ChatGoogleParams {}\n\nclass ChatGoogleNode extends BaseChatGoogle {\n constructor(model: string, params?: Omit<ChatGoogleNodeParams, \"model\">);\n constructor(params: ChatGoogleNodeParams);\n constructor(\n modelOrParams: string | ChatGoogleNodeParams,\n paramsArg?: Omit<ChatGoogleNodeParams, \"model\">\n ) {\n const params = getGoogleChatModelParams(modelOrParams, paramsArg);\n if (!params.googleAuthOptions) {\n params.apiKey = params.apiKey ?? getEnvironmentVariable(\"GOOGLE_API_KEY\");\n }\n const requiredScopes: string[] = getRequiredAuthScopes(params);\n if (params.googleAuthOptions) {\n params.googleAuthOptions = ensureAuthScopes(\n params.googleAuthOptions,\n requiredScopes\n );\n }\n const apiClient = params?.apiClient ?? new NodeApiClient(params);\n super({ ...params, apiClient });\n }\n}\n\nfunction getRequiredAuthScopes(params: ChatGoogleNodeParams): string[] {\n const hasApiKey = typeof params.apiKey !== \"undefined\";\n const platformType = convertParamsToPlatformType(params);\n const platform = getPlatformType(platformType, hasApiKey);\n switch (platform) {\n case \"gai\":\n return GENERATIVE_AI_AUTH_SCOPES;\n case \"gcp\":\n return VERTEX_AI_AUTH_SCOPES;\n default:\n return VERTEX_AI_AUTH_SCOPES;\n }\n}\n\nexport {\n type ChatGoogleNodeParams as ChatGoogleParams,\n ChatGoogleNode as ChatGoogle,\n};\n"],"mappings":";;;;;;AAiBA,IAAM,iBAAN,cAA6BA,aAAAA,eAAe;CAG1C,YACE,eACA,WACA;EACA,MAAM,SAASC,aAAAA,yBAAyB,eAAe,UAAU;AACjE,MAAI,CAAC,OAAO,kBACV,QAAO,SAAS,OAAO,WAAA,GAAA,0BAAA,wBAAiC,iBAAiB;EAE3E,MAAM,iBAA2B,sBAAsB,OAAO;AAC9D,MAAI,OAAO,kBACT,QAAO,oBAAoBC,aAAAA,iBACzB,OAAO,mBACP,eACD;EAEH,MAAM,YAAY,QAAQ,aAAa,IAAIC,aAAAA,cAAc,OAAO;AAChE,QAAM;GAAE,GAAG;GAAQ;GAAW,CAAC;;;AAInC,SAAS,sBAAsB,QAAwC;CACrE,MAAM,YAAY,OAAO,OAAO,WAAW;AAG3C,SADiBC,aAAAA,gBADIC,eAAAA,4BAA4B,OACJ,EAAE,UAC/B,EAAhB;EACE,KAAK,MACH,QAAOC,cAAAA;EACT,KAAK,MACH,QAAOC,cAAAA;EACT,QACE,QAAOA,cAAAA"}
1
+ {"version":3,"file":"node.cjs","names":["BaseChatGoogle","getGoogleChatModelParams","ensureAuthScopes","NodeApiClient","getPlatformType","convertParamsToPlatformType","GENERATIVE_AI_AUTH_SCOPES","VERTEX_AI_AUTH_SCOPES"],"sources":["../../src/chat_models/node.ts"],"sourcesContent":["import { getEnvironmentVariable } from \"@langchain/core/utils/env\";\nimport { ChatGoogleParams } from \"./index.js\";\nimport {\n BaseChatGoogle,\n getGoogleChatModelParams,\n getPlatformType,\n} from \"./base.js\";\nimport { GENERATIVE_AI_AUTH_SCOPES, VERTEX_AI_AUTH_SCOPES } from \"../const.js\";\nimport {\n ensureAuthScopes,\n NodeApiClient,\n NodeApiClientParams,\n} from \"../clients/node.js\";\nimport { convertParamsToPlatformType } from \"../converters/params.js\";\n\ninterface ChatGoogleNodeParams extends NodeApiClientParams, ChatGoogleParams {}\n\nclass ChatGoogleNode extends BaseChatGoogle {\n constructor(model: string, params?: Omit<ChatGoogleNodeParams, \"model\">);\n constructor(params: ChatGoogleNodeParams);\n constructor(\n modelOrParams: string | ChatGoogleNodeParams,\n paramsArg?: Omit<ChatGoogleNodeParams, \"model\">\n ) {\n const params = getGoogleChatModelParams(modelOrParams, paramsArg);\n if (!params.googleAuthOptions) {\n params.apiKey = params.apiKey ?? getEnvironmentVariable(\"GOOGLE_API_KEY\");\n }\n const requiredScopes: string[] = getRequiredAuthScopes(params);\n if (params.googleAuthOptions) {\n params.googleAuthOptions = ensureAuthScopes(\n params.googleAuthOptions,\n requiredScopes\n );\n }\n const apiClient = params?.apiClient ?? new NodeApiClient(params);\n super({ ...params, apiClient });\n }\n}\n\nfunction getRequiredAuthScopes(params: ChatGoogleNodeParams): string[] {\n const hasApiKey = typeof params.apiKey !== \"undefined\";\n const platformType = convertParamsToPlatformType(params);\n const platform = getPlatformType(platformType, hasApiKey);\n switch (platform) {\n case \"gai\":\n return GENERATIVE_AI_AUTH_SCOPES;\n case \"gcp\":\n return VERTEX_AI_AUTH_SCOPES;\n default:\n return VERTEX_AI_AUTH_SCOPES;\n }\n}\n\nexport {\n type ChatGoogleNodeParams as ChatGoogleParams,\n ChatGoogleNode as ChatGoogle,\n};\n"],"mappings":";;;;;;AAiBA,IAAM,iBAAN,cAA6BA,aAAAA,eAAe;CAG1C,YACE,eACA,WACA;EACA,MAAM,SAASC,aAAAA,yBAAyB,eAAe,SAAS;EAChE,IAAI,CAAC,OAAO,mBACV,OAAO,SAAS,OAAO,WAAA,GAAA,0BAAA,uBAAA,CAAiC,gBAAgB;EAE1E,MAAM,iBAA2B,sBAAsB,MAAM;EAC7D,IAAI,OAAO,mBACT,OAAO,oBAAoBC,aAAAA,iBACzB,OAAO,mBACP,cACF;EAEF,MAAM,YAAY,QAAQ,aAAa,IAAIC,aAAAA,cAAc,MAAM;EAC/D,MAAM;GAAE,GAAG;GAAQ;EAAU,CAAC;CAChC;AACF;AAEA,SAAS,sBAAsB,QAAwC;CACrE,MAAM,YAAY,OAAO,OAAO,WAAW;CAG3C,QADiBC,aAAAA,gBADIC,eAAAA,4BAA4B,MACL,GAAG,SAChC,GAAf;EACE,KAAK,OACH,OAAOC,cAAAA;EACT,KAAK,OACH,OAAOC,cAAAA;EACT,SACE,OAAOA,cAAAA;CACX;AACF"}
@@ -1,7 +1,6 @@
1
1
  import { BaseChatGoogle } from "./base.cjs";
2
2
  import { ChatGoogleParams } from "./index.cjs";
3
3
  import { NodeApiClientParams } from "../clients/node.cjs";
4
-
5
4
  //#region src/chat_models/node.d.ts
6
5
  interface ChatGoogleNodeParams extends NodeApiClientParams, ChatGoogleParams {}
7
6
  declare class ChatGoogleNode extends BaseChatGoogle {
@@ -9,5 +8,5 @@ declare class ChatGoogleNode extends BaseChatGoogle {
9
8
  constructor(params: ChatGoogleNodeParams);
10
9
  }
11
10
  //#endregion
12
- export { ChatGoogleNode, ChatGoogleNodeParams };
11
+ export { ChatGoogleNode as ChatGoogle, type ChatGoogleNodeParams as ChatGoogleParams };
13
12
  //# sourceMappingURL=node.d.cts.map
@@ -1,7 +1,6 @@
1
1
  import { BaseChatGoogle } from "./base.js";
2
2
  import { ChatGoogleParams } from "./index.js";
3
3
  import { NodeApiClientParams } from "../clients/node.js";
4
-
5
4
  //#region src/chat_models/node.d.ts
6
5
  interface ChatGoogleNodeParams extends NodeApiClientParams, ChatGoogleParams {}
7
6
  declare class ChatGoogleNode extends BaseChatGoogle {
@@ -9,5 +8,5 @@ declare class ChatGoogleNode extends BaseChatGoogle {
9
8
  constructor(params: ChatGoogleNodeParams);
10
9
  }
11
10
  //#endregion
12
- export { ChatGoogleNode, ChatGoogleNodeParams };
11
+ export { ChatGoogleNode as ChatGoogle, type ChatGoogleNodeParams as ChatGoogleParams };
13
12
  //# sourceMappingURL=node.d.ts.map
@@ -26,6 +26,6 @@ function getRequiredAuthScopes(params) {
26
26
  }
27
27
  }
28
28
  //#endregion
29
- export { ChatGoogleNode };
29
+ export { ChatGoogleNode as ChatGoogle };
30
30
 
31
31
  //# sourceMappingURL=node.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"node.js","names":[],"sources":["../../src/chat_models/node.ts"],"sourcesContent":["import { getEnvironmentVariable } from \"@langchain/core/utils/env\";\nimport { ChatGoogleParams } from \"./index.js\";\nimport {\n BaseChatGoogle,\n getGoogleChatModelParams,\n getPlatformType,\n} from \"./base.js\";\nimport { GENERATIVE_AI_AUTH_SCOPES, VERTEX_AI_AUTH_SCOPES } from \"../const.js\";\nimport {\n ensureAuthScopes,\n NodeApiClient,\n NodeApiClientParams,\n} from \"../clients/node.js\";\nimport { convertParamsToPlatformType } from \"../converters/params.js\";\n\ninterface ChatGoogleNodeParams extends NodeApiClientParams, ChatGoogleParams {}\n\nclass ChatGoogleNode extends BaseChatGoogle {\n constructor(model: string, params?: Omit<ChatGoogleNodeParams, \"model\">);\n constructor(params: ChatGoogleNodeParams);\n constructor(\n modelOrParams: string | ChatGoogleNodeParams,\n paramsArg?: Omit<ChatGoogleNodeParams, \"model\">\n ) {\n const params = getGoogleChatModelParams(modelOrParams, paramsArg);\n if (!params.googleAuthOptions) {\n params.apiKey = params.apiKey ?? getEnvironmentVariable(\"GOOGLE_API_KEY\");\n }\n const requiredScopes: string[] = getRequiredAuthScopes(params);\n if (params.googleAuthOptions) {\n params.googleAuthOptions = ensureAuthScopes(\n params.googleAuthOptions,\n requiredScopes\n );\n }\n const apiClient = params?.apiClient ?? new NodeApiClient(params);\n super({ ...params, apiClient });\n }\n}\n\nfunction getRequiredAuthScopes(params: ChatGoogleNodeParams): string[] {\n const hasApiKey = typeof params.apiKey !== \"undefined\";\n const platformType = convertParamsToPlatformType(params);\n const platform = getPlatformType(platformType, hasApiKey);\n switch (platform) {\n case \"gai\":\n return GENERATIVE_AI_AUTH_SCOPES;\n case \"gcp\":\n return VERTEX_AI_AUTH_SCOPES;\n default:\n return VERTEX_AI_AUTH_SCOPES;\n }\n}\n\nexport {\n type ChatGoogleNodeParams as ChatGoogleParams,\n ChatGoogleNode as ChatGoogle,\n};\n"],"mappings":";;;;;;AAiBA,IAAM,iBAAN,cAA6B,eAAe;CAG1C,YACE,eACA,WACA;EACA,MAAM,SAAS,yBAAyB,eAAe,UAAU;AACjE,MAAI,CAAC,OAAO,kBACV,QAAO,SAAS,OAAO,UAAU,uBAAuB,iBAAiB;EAE3E,MAAM,iBAA2B,sBAAsB,OAAO;AAC9D,MAAI,OAAO,kBACT,QAAO,oBAAoB,iBACzB,OAAO,mBACP,eACD;EAEH,MAAM,YAAY,QAAQ,aAAa,IAAI,cAAc,OAAO;AAChE,QAAM;GAAE,GAAG;GAAQ;GAAW,CAAC;;;AAInC,SAAS,sBAAsB,QAAwC;CACrE,MAAM,YAAY,OAAO,OAAO,WAAW;AAG3C,SADiB,gBADI,4BAA4B,OACJ,EAAE,UAC/B,EAAhB;EACE,KAAK,MACH,QAAO;EACT,KAAK,MACH,QAAO;EACT,QACE,QAAO"}
1
+ {"version":3,"file":"node.js","names":[],"sources":["../../src/chat_models/node.ts"],"sourcesContent":["import { getEnvironmentVariable } from \"@langchain/core/utils/env\";\nimport { ChatGoogleParams } from \"./index.js\";\nimport {\n BaseChatGoogle,\n getGoogleChatModelParams,\n getPlatformType,\n} from \"./base.js\";\nimport { GENERATIVE_AI_AUTH_SCOPES, VERTEX_AI_AUTH_SCOPES } from \"../const.js\";\nimport {\n ensureAuthScopes,\n NodeApiClient,\n NodeApiClientParams,\n} from \"../clients/node.js\";\nimport { convertParamsToPlatformType } from \"../converters/params.js\";\n\ninterface ChatGoogleNodeParams extends NodeApiClientParams, ChatGoogleParams {}\n\nclass ChatGoogleNode extends BaseChatGoogle {\n constructor(model: string, params?: Omit<ChatGoogleNodeParams, \"model\">);\n constructor(params: ChatGoogleNodeParams);\n constructor(\n modelOrParams: string | ChatGoogleNodeParams,\n paramsArg?: Omit<ChatGoogleNodeParams, \"model\">\n ) {\n const params = getGoogleChatModelParams(modelOrParams, paramsArg);\n if (!params.googleAuthOptions) {\n params.apiKey = params.apiKey ?? getEnvironmentVariable(\"GOOGLE_API_KEY\");\n }\n const requiredScopes: string[] = getRequiredAuthScopes(params);\n if (params.googleAuthOptions) {\n params.googleAuthOptions = ensureAuthScopes(\n params.googleAuthOptions,\n requiredScopes\n );\n }\n const apiClient = params?.apiClient ?? new NodeApiClient(params);\n super({ ...params, apiClient });\n }\n}\n\nfunction getRequiredAuthScopes(params: ChatGoogleNodeParams): string[] {\n const hasApiKey = typeof params.apiKey !== \"undefined\";\n const platformType = convertParamsToPlatformType(params);\n const platform = getPlatformType(platformType, hasApiKey);\n switch (platform) {\n case \"gai\":\n return GENERATIVE_AI_AUTH_SCOPES;\n case \"gcp\":\n return VERTEX_AI_AUTH_SCOPES;\n default:\n return VERTEX_AI_AUTH_SCOPES;\n }\n}\n\nexport {\n type ChatGoogleNodeParams as ChatGoogleParams,\n ChatGoogleNode as ChatGoogle,\n};\n"],"mappings":";;;;;;AAiBA,IAAM,iBAAN,cAA6B,eAAe;CAG1C,YACE,eACA,WACA;EACA,MAAM,SAAS,yBAAyB,eAAe,SAAS;EAChE,IAAI,CAAC,OAAO,mBACV,OAAO,SAAS,OAAO,UAAU,uBAAuB,gBAAgB;EAE1E,MAAM,iBAA2B,sBAAsB,MAAM;EAC7D,IAAI,OAAO,mBACT,OAAO,oBAAoB,iBACzB,OAAO,mBACP,cACF;EAEF,MAAM,YAAY,QAAQ,aAAa,IAAI,cAAc,MAAM;EAC/D,MAAM;GAAE,GAAG;GAAQ;EAAU,CAAC;CAChC;AACF;AAEA,SAAS,sBAAsB,QAAwC;CACrE,MAAM,YAAY,OAAO,OAAO,WAAW;CAG3C,QADiB,gBADI,4BAA4B,MACL,GAAG,SAChC,GAAf;EACE,KAAK,OACH,OAAO;EACT,KAAK,OACH,OAAO;EACT,SACE,OAAO;CACX;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"profiles.cjs","names":[],"sources":["../../src/chat_models/profiles.ts"],"sourcesContent":["/**\n * This file was automatically generated by an automated script. Do not edit manually.\n */\nimport type { ModelProfile } from \"@langchain/core/language_models/profile\";\nconst PROFILES: Record<string, ModelProfile> = {\n \"gemini-embedding-001\": {\n maxInputTokens: 2048,\n imageInputs: false,\n audioInputs: false,\n pdfInputs: false,\n videoInputs: false,\n maxOutputTokens: 3072,\n reasoningOutput: false,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: false,\n structuredOutput: false,\n },\n \"gemini-2.5-flash-lite-preview-09-2025\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 65536,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: true,\n },\n \"gemini-2.5-pro-preview-06-05\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 65536,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: true,\n },\n \"gemini-2.5-flash-preview-04-17\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 65536,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: false,\n },\n \"gemini-2.5-flash-preview-09-2025\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 65536,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: true,\n },\n \"gemini-2.5-pro-preview-05-06\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 65536,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: true,\n },\n \"gemini-2.5-flash-preview-05-20\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 65536,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: true,\n },\n \"gemini-2.5-flash\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 65536,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: true,\n },\n \"gemini-live-2.5-flash\": {\n maxInputTokens: 128000,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: false,\n videoInputs: true,\n maxOutputTokens: 8000,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: true,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: false,\n },\n \"gemini-3-flash-preview\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 65536,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: true,\n },\n \"gemini-live-2.5-flash-preview-native-audio\": {\n maxInputTokens: 131072,\n imageInputs: false,\n audioInputs: true,\n pdfInputs: false,\n videoInputs: true,\n maxOutputTokens: 65536,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: true,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: false,\n },\n \"gemini-2.5-flash-lite\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 65536,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: true,\n },\n \"gemini-2.5-flash-preview-tts\": {\n maxInputTokens: 8000,\n imageInputs: false,\n audioInputs: false,\n pdfInputs: false,\n videoInputs: false,\n maxOutputTokens: 16000,\n reasoningOutput: false,\n imageOutputs: false,\n audioOutputs: true,\n videoOutputs: false,\n toolCalling: false,\n structuredOutput: false,\n },\n \"gemini-flash-latest\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 65536,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: true,\n },\n \"gemini-2.5-flash-lite-preview-06-17\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 65536,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: false,\n },\n \"gemini-2.5-flash-image\": {\n maxInputTokens: 32768,\n imageInputs: true,\n audioInputs: false,\n pdfInputs: false,\n videoInputs: false,\n maxOutputTokens: 32768,\n reasoningOutput: true,\n imageOutputs: true,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: false,\n structuredOutput: false,\n },\n \"gemini-2.5-pro-preview-tts\": {\n maxInputTokens: 8000,\n imageInputs: false,\n audioInputs: false,\n pdfInputs: false,\n videoInputs: false,\n maxOutputTokens: 16000,\n reasoningOutput: false,\n imageOutputs: false,\n audioOutputs: true,\n videoOutputs: false,\n toolCalling: false,\n structuredOutput: false,\n },\n \"gemini-2.5-flash-image-preview\": {\n maxInputTokens: 32768,\n imageInputs: true,\n audioInputs: false,\n pdfInputs: false,\n videoInputs: false,\n maxOutputTokens: 32768,\n reasoningOutput: true,\n imageOutputs: true,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: false,\n structuredOutput: false,\n },\n \"gemini-1.5-flash-8b\": {\n maxInputTokens: 1000000,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: false,\n videoInputs: true,\n maxOutputTokens: 8192,\n reasoningOutput: false,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: false,\n },\n \"gemini-3-pro-preview\": {\n maxInputTokens: 1000000,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 64000,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: true,\n },\n \"gemini-2.0-flash-lite\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 8192,\n reasoningOutput: false,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: true,\n },\n \"gemini-1.5-flash\": {\n maxInputTokens: 1000000,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: false,\n videoInputs: true,\n maxOutputTokens: 8192,\n reasoningOutput: false,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: false,\n },\n \"gemini-flash-lite-latest\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 65536,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: true,\n },\n \"gemini-2.5-pro\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 65536,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: true,\n },\n \"gemini-2.0-flash\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 8192,\n reasoningOutput: false,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: true,\n },\n \"gemini-1.5-pro\": {\n maxInputTokens: 1000000,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: false,\n videoInputs: true,\n maxOutputTokens: 8192,\n reasoningOutput: false,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: false,\n },\n};\nexport default PROFILES;\n"],"mappings":";AAIA,MAAM,WAAyC;CAC7C,wBAAwB;EACtB,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;EACnB;CACD,yCAAyC;EACvC,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;EACnB;CACD,gCAAgC;EAC9B,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;EACnB;CACD,kCAAkC;EAChC,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;EACnB;CACD,oCAAoC;EAClC,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;EACnB;CACD,gCAAgC;EAC9B,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;EACnB;CACD,kCAAkC;EAChC,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;EACnB;CACD,oBAAoB;EAClB,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;EACnB;CACD,yBAAyB;EACvB,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;EACnB;CACD,0BAA0B;EACxB,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;EACnB;CACD,8CAA8C;EAC5C,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;EACnB;CACD,yBAAyB;EACvB,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;EACnB;CACD,gCAAgC;EAC9B,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;EACnB;CACD,uBAAuB;EACrB,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;EACnB;CACD,uCAAuC;EACrC,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;EACnB;CACD,0BAA0B;EACxB,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;EACnB;CACD,8BAA8B;EAC5B,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;EACnB;CACD,kCAAkC;EAChC,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;EACnB;CACD,uBAAuB;EACrB,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;EACnB;CACD,wBAAwB;EACtB,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;EACnB;CACD,yBAAyB;EACvB,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;EACnB;CACD,oBAAoB;EAClB,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;EACnB;CACD,4BAA4B;EAC1B,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;EACnB;CACD,kBAAkB;EAChB,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;EACnB;CACD,oBAAoB;EAClB,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;EACnB;CACD,kBAAkB;EAChB,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;EACnB;CACF"}
1
+ {"version":3,"file":"profiles.cjs","names":[],"sources":["../../src/chat_models/profiles.ts"],"sourcesContent":["/**\n * This file was automatically generated by an automated script. Do not edit manually.\n */\nimport type { ModelProfile } from \"@langchain/core/language_models/profile\";\nconst PROFILES: Record<string, ModelProfile> = {\n \"gemini-embedding-001\": {\n maxInputTokens: 2048,\n imageInputs: false,\n audioInputs: false,\n pdfInputs: false,\n videoInputs: false,\n maxOutputTokens: 3072,\n reasoningOutput: false,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: false,\n structuredOutput: false,\n },\n \"gemini-2.5-flash-lite-preview-09-2025\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 65536,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: true,\n },\n \"gemini-2.5-pro-preview-06-05\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 65536,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: true,\n },\n \"gemini-2.5-flash-preview-04-17\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 65536,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: false,\n },\n \"gemini-2.5-flash-preview-09-2025\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 65536,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: true,\n },\n \"gemini-2.5-pro-preview-05-06\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 65536,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: true,\n },\n \"gemini-2.5-flash-preview-05-20\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 65536,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: true,\n },\n \"gemini-2.5-flash\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 65536,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: true,\n },\n \"gemini-live-2.5-flash\": {\n maxInputTokens: 128000,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: false,\n videoInputs: true,\n maxOutputTokens: 8000,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: true,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: false,\n },\n \"gemini-3-flash-preview\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 65536,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: true,\n },\n \"gemini-live-2.5-flash-preview-native-audio\": {\n maxInputTokens: 131072,\n imageInputs: false,\n audioInputs: true,\n pdfInputs: false,\n videoInputs: true,\n maxOutputTokens: 65536,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: true,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: false,\n },\n \"gemini-2.5-flash-lite\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 65536,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: true,\n },\n \"gemini-2.5-flash-preview-tts\": {\n maxInputTokens: 8000,\n imageInputs: false,\n audioInputs: false,\n pdfInputs: false,\n videoInputs: false,\n maxOutputTokens: 16000,\n reasoningOutput: false,\n imageOutputs: false,\n audioOutputs: true,\n videoOutputs: false,\n toolCalling: false,\n structuredOutput: false,\n },\n \"gemini-flash-latest\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 65536,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: true,\n },\n \"gemini-2.5-flash-lite-preview-06-17\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 65536,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: false,\n },\n \"gemini-2.5-flash-image\": {\n maxInputTokens: 32768,\n imageInputs: true,\n audioInputs: false,\n pdfInputs: false,\n videoInputs: false,\n maxOutputTokens: 32768,\n reasoningOutput: true,\n imageOutputs: true,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: false,\n structuredOutput: false,\n },\n \"gemini-2.5-pro-preview-tts\": {\n maxInputTokens: 8000,\n imageInputs: false,\n audioInputs: false,\n pdfInputs: false,\n videoInputs: false,\n maxOutputTokens: 16000,\n reasoningOutput: false,\n imageOutputs: false,\n audioOutputs: true,\n videoOutputs: false,\n toolCalling: false,\n structuredOutput: false,\n },\n \"gemini-2.5-flash-image-preview\": {\n maxInputTokens: 32768,\n imageInputs: true,\n audioInputs: false,\n pdfInputs: false,\n videoInputs: false,\n maxOutputTokens: 32768,\n reasoningOutput: true,\n imageOutputs: true,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: false,\n structuredOutput: false,\n },\n \"gemini-1.5-flash-8b\": {\n maxInputTokens: 1000000,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: false,\n videoInputs: true,\n maxOutputTokens: 8192,\n reasoningOutput: false,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: false,\n },\n \"gemini-3-pro-preview\": {\n maxInputTokens: 1000000,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 64000,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: true,\n },\n \"gemini-2.0-flash-lite\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 8192,\n reasoningOutput: false,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: true,\n },\n \"gemini-1.5-flash\": {\n maxInputTokens: 1000000,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: false,\n videoInputs: true,\n maxOutputTokens: 8192,\n reasoningOutput: false,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: false,\n },\n \"gemini-flash-lite-latest\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 65536,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: true,\n },\n \"gemini-2.5-pro\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 65536,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: true,\n },\n \"gemini-2.0-flash\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 8192,\n reasoningOutput: false,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: true,\n },\n \"gemini-1.5-pro\": {\n maxInputTokens: 1000000,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: false,\n videoInputs: true,\n maxOutputTokens: 8192,\n reasoningOutput: false,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: false,\n },\n};\nexport default PROFILES;\n"],"mappings":";AAIA,MAAM,WAAyC;CAC7C,wBAAwB;EACtB,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;CACpB;CACA,yCAAyC;EACvC,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;CACpB;CACA,gCAAgC;EAC9B,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;CACpB;CACA,kCAAkC;EAChC,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;CACpB;CACA,oCAAoC;EAClC,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;CACpB;CACA,gCAAgC;EAC9B,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;CACpB;CACA,kCAAkC;EAChC,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;CACpB;CACA,oBAAoB;EAClB,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;CACpB;CACA,yBAAyB;EACvB,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;CACpB;CACA,0BAA0B;EACxB,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;CACpB;CACA,8CAA8C;EAC5C,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;CACpB;CACA,yBAAyB;EACvB,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;CACpB;CACA,gCAAgC;EAC9B,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;CACpB;CACA,uBAAuB;EACrB,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;CACpB;CACA,uCAAuC;EACrC,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;CACpB;CACA,0BAA0B;EACxB,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;CACpB;CACA,8BAA8B;EAC5B,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;CACpB;CACA,kCAAkC;EAChC,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;CACpB;CACA,uBAAuB;EACrB,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;CACpB;CACA,wBAAwB;EACtB,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;CACpB;CACA,yBAAyB;EACvB,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;CACpB;CACA,oBAAoB;EAClB,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;CACpB;CACA,4BAA4B;EAC1B,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;CACpB;CACA,kBAAkB;EAChB,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;CACpB;CACA,oBAAoB;EAClB,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;CACpB;CACA,kBAAkB;EAChB,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;CACpB;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"profiles.js","names":[],"sources":["../../src/chat_models/profiles.ts"],"sourcesContent":["/**\n * This file was automatically generated by an automated script. Do not edit manually.\n */\nimport type { ModelProfile } from \"@langchain/core/language_models/profile\";\nconst PROFILES: Record<string, ModelProfile> = {\n \"gemini-embedding-001\": {\n maxInputTokens: 2048,\n imageInputs: false,\n audioInputs: false,\n pdfInputs: false,\n videoInputs: false,\n maxOutputTokens: 3072,\n reasoningOutput: false,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: false,\n structuredOutput: false,\n },\n \"gemini-2.5-flash-lite-preview-09-2025\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 65536,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: true,\n },\n \"gemini-2.5-pro-preview-06-05\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 65536,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: true,\n },\n \"gemini-2.5-flash-preview-04-17\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 65536,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: false,\n },\n \"gemini-2.5-flash-preview-09-2025\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 65536,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: true,\n },\n \"gemini-2.5-pro-preview-05-06\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 65536,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: true,\n },\n \"gemini-2.5-flash-preview-05-20\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 65536,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: true,\n },\n \"gemini-2.5-flash\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 65536,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: true,\n },\n \"gemini-live-2.5-flash\": {\n maxInputTokens: 128000,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: false,\n videoInputs: true,\n maxOutputTokens: 8000,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: true,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: false,\n },\n \"gemini-3-flash-preview\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 65536,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: true,\n },\n \"gemini-live-2.5-flash-preview-native-audio\": {\n maxInputTokens: 131072,\n imageInputs: false,\n audioInputs: true,\n pdfInputs: false,\n videoInputs: true,\n maxOutputTokens: 65536,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: true,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: false,\n },\n \"gemini-2.5-flash-lite\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 65536,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: true,\n },\n \"gemini-2.5-flash-preview-tts\": {\n maxInputTokens: 8000,\n imageInputs: false,\n audioInputs: false,\n pdfInputs: false,\n videoInputs: false,\n maxOutputTokens: 16000,\n reasoningOutput: false,\n imageOutputs: false,\n audioOutputs: true,\n videoOutputs: false,\n toolCalling: false,\n structuredOutput: false,\n },\n \"gemini-flash-latest\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 65536,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: true,\n },\n \"gemini-2.5-flash-lite-preview-06-17\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 65536,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: false,\n },\n \"gemini-2.5-flash-image\": {\n maxInputTokens: 32768,\n imageInputs: true,\n audioInputs: false,\n pdfInputs: false,\n videoInputs: false,\n maxOutputTokens: 32768,\n reasoningOutput: true,\n imageOutputs: true,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: false,\n structuredOutput: false,\n },\n \"gemini-2.5-pro-preview-tts\": {\n maxInputTokens: 8000,\n imageInputs: false,\n audioInputs: false,\n pdfInputs: false,\n videoInputs: false,\n maxOutputTokens: 16000,\n reasoningOutput: false,\n imageOutputs: false,\n audioOutputs: true,\n videoOutputs: false,\n toolCalling: false,\n structuredOutput: false,\n },\n \"gemini-2.5-flash-image-preview\": {\n maxInputTokens: 32768,\n imageInputs: true,\n audioInputs: false,\n pdfInputs: false,\n videoInputs: false,\n maxOutputTokens: 32768,\n reasoningOutput: true,\n imageOutputs: true,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: false,\n structuredOutput: false,\n },\n \"gemini-1.5-flash-8b\": {\n maxInputTokens: 1000000,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: false,\n videoInputs: true,\n maxOutputTokens: 8192,\n reasoningOutput: false,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: false,\n },\n \"gemini-3-pro-preview\": {\n maxInputTokens: 1000000,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 64000,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: true,\n },\n \"gemini-2.0-flash-lite\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 8192,\n reasoningOutput: false,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: true,\n },\n \"gemini-1.5-flash\": {\n maxInputTokens: 1000000,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: false,\n videoInputs: true,\n maxOutputTokens: 8192,\n reasoningOutput: false,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: false,\n },\n \"gemini-flash-lite-latest\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 65536,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: true,\n },\n \"gemini-2.5-pro\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 65536,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: true,\n },\n \"gemini-2.0-flash\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 8192,\n reasoningOutput: false,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: true,\n },\n \"gemini-1.5-pro\": {\n maxInputTokens: 1000000,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: false,\n videoInputs: true,\n maxOutputTokens: 8192,\n reasoningOutput: false,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: false,\n },\n};\nexport default PROFILES;\n"],"mappings":";AAIA,MAAM,WAAyC;CAC7C,wBAAwB;EACtB,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;EACnB;CACD,yCAAyC;EACvC,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;EACnB;CACD,gCAAgC;EAC9B,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;EACnB;CACD,kCAAkC;EAChC,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;EACnB;CACD,oCAAoC;EAClC,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;EACnB;CACD,gCAAgC;EAC9B,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;EACnB;CACD,kCAAkC;EAChC,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;EACnB;CACD,oBAAoB;EAClB,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;EACnB;CACD,yBAAyB;EACvB,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;EACnB;CACD,0BAA0B;EACxB,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;EACnB;CACD,8CAA8C;EAC5C,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;EACnB;CACD,yBAAyB;EACvB,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;EACnB;CACD,gCAAgC;EAC9B,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;EACnB;CACD,uBAAuB;EACrB,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;EACnB;CACD,uCAAuC;EACrC,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;EACnB;CACD,0BAA0B;EACxB,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;EACnB;CACD,8BAA8B;EAC5B,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;EACnB;CACD,kCAAkC;EAChC,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;EACnB;CACD,uBAAuB;EACrB,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;EACnB;CACD,wBAAwB;EACtB,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;EACnB;CACD,yBAAyB;EACvB,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;EACnB;CACD,oBAAoB;EAClB,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;EACnB;CACD,4BAA4B;EAC1B,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;EACnB;CACD,kBAAkB;EAChB,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;EACnB;CACD,oBAAoB;EAClB,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;EACnB;CACD,kBAAkB;EAChB,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;EACnB;CACF"}
1
+ {"version":3,"file":"profiles.js","names":[],"sources":["../../src/chat_models/profiles.ts"],"sourcesContent":["/**\n * This file was automatically generated by an automated script. Do not edit manually.\n */\nimport type { ModelProfile } from \"@langchain/core/language_models/profile\";\nconst PROFILES: Record<string, ModelProfile> = {\n \"gemini-embedding-001\": {\n maxInputTokens: 2048,\n imageInputs: false,\n audioInputs: false,\n pdfInputs: false,\n videoInputs: false,\n maxOutputTokens: 3072,\n reasoningOutput: false,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: false,\n structuredOutput: false,\n },\n \"gemini-2.5-flash-lite-preview-09-2025\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 65536,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: true,\n },\n \"gemini-2.5-pro-preview-06-05\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 65536,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: true,\n },\n \"gemini-2.5-flash-preview-04-17\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 65536,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: false,\n },\n \"gemini-2.5-flash-preview-09-2025\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 65536,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: true,\n },\n \"gemini-2.5-pro-preview-05-06\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 65536,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: true,\n },\n \"gemini-2.5-flash-preview-05-20\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 65536,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: true,\n },\n \"gemini-2.5-flash\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 65536,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: true,\n },\n \"gemini-live-2.5-flash\": {\n maxInputTokens: 128000,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: false,\n videoInputs: true,\n maxOutputTokens: 8000,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: true,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: false,\n },\n \"gemini-3-flash-preview\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 65536,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: true,\n },\n \"gemini-live-2.5-flash-preview-native-audio\": {\n maxInputTokens: 131072,\n imageInputs: false,\n audioInputs: true,\n pdfInputs: false,\n videoInputs: true,\n maxOutputTokens: 65536,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: true,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: false,\n },\n \"gemini-2.5-flash-lite\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 65536,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: true,\n },\n \"gemini-2.5-flash-preview-tts\": {\n maxInputTokens: 8000,\n imageInputs: false,\n audioInputs: false,\n pdfInputs: false,\n videoInputs: false,\n maxOutputTokens: 16000,\n reasoningOutput: false,\n imageOutputs: false,\n audioOutputs: true,\n videoOutputs: false,\n toolCalling: false,\n structuredOutput: false,\n },\n \"gemini-flash-latest\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 65536,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: true,\n },\n \"gemini-2.5-flash-lite-preview-06-17\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 65536,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: false,\n },\n \"gemini-2.5-flash-image\": {\n maxInputTokens: 32768,\n imageInputs: true,\n audioInputs: false,\n pdfInputs: false,\n videoInputs: false,\n maxOutputTokens: 32768,\n reasoningOutput: true,\n imageOutputs: true,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: false,\n structuredOutput: false,\n },\n \"gemini-2.5-pro-preview-tts\": {\n maxInputTokens: 8000,\n imageInputs: false,\n audioInputs: false,\n pdfInputs: false,\n videoInputs: false,\n maxOutputTokens: 16000,\n reasoningOutput: false,\n imageOutputs: false,\n audioOutputs: true,\n videoOutputs: false,\n toolCalling: false,\n structuredOutput: false,\n },\n \"gemini-2.5-flash-image-preview\": {\n maxInputTokens: 32768,\n imageInputs: true,\n audioInputs: false,\n pdfInputs: false,\n videoInputs: false,\n maxOutputTokens: 32768,\n reasoningOutput: true,\n imageOutputs: true,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: false,\n structuredOutput: false,\n },\n \"gemini-1.5-flash-8b\": {\n maxInputTokens: 1000000,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: false,\n videoInputs: true,\n maxOutputTokens: 8192,\n reasoningOutput: false,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: false,\n },\n \"gemini-3-pro-preview\": {\n maxInputTokens: 1000000,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 64000,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: true,\n },\n \"gemini-2.0-flash-lite\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 8192,\n reasoningOutput: false,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: true,\n },\n \"gemini-1.5-flash\": {\n maxInputTokens: 1000000,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: false,\n videoInputs: true,\n maxOutputTokens: 8192,\n reasoningOutput: false,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: false,\n },\n \"gemini-flash-lite-latest\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 65536,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: true,\n },\n \"gemini-2.5-pro\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 65536,\n reasoningOutput: true,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: true,\n },\n \"gemini-2.0-flash\": {\n maxInputTokens: 1048576,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: true,\n videoInputs: true,\n maxOutputTokens: 8192,\n reasoningOutput: false,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: true,\n },\n \"gemini-1.5-pro\": {\n maxInputTokens: 1000000,\n imageInputs: true,\n audioInputs: true,\n pdfInputs: false,\n videoInputs: true,\n maxOutputTokens: 8192,\n reasoningOutput: false,\n imageOutputs: false,\n audioOutputs: false,\n videoOutputs: false,\n toolCalling: true,\n structuredOutput: false,\n },\n};\nexport default PROFILES;\n"],"mappings":";AAIA,MAAM,WAAyC;CAC7C,wBAAwB;EACtB,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;CACpB;CACA,yCAAyC;EACvC,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;CACpB;CACA,gCAAgC;EAC9B,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;CACpB;CACA,kCAAkC;EAChC,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;CACpB;CACA,oCAAoC;EAClC,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;CACpB;CACA,gCAAgC;EAC9B,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;CACpB;CACA,kCAAkC;EAChC,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;CACpB;CACA,oBAAoB;EAClB,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;CACpB;CACA,yBAAyB;EACvB,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;CACpB;CACA,0BAA0B;EACxB,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;CACpB;CACA,8CAA8C;EAC5C,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;CACpB;CACA,yBAAyB;EACvB,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;CACpB;CACA,gCAAgC;EAC9B,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;CACpB;CACA,uBAAuB;EACrB,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;CACpB;CACA,uCAAuC;EACrC,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;CACpB;CACA,0BAA0B;EACxB,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;CACpB;CACA,8BAA8B;EAC5B,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;CACpB;CACA,kCAAkC;EAChC,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;CACpB;CACA,uBAAuB;EACrB,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;CACpB;CACA,wBAAwB;EACtB,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;CACpB;CACA,yBAAyB;EACvB,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;CACpB;CACA,oBAAoB;EAClB,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;CACpB;CACA,4BAA4B;EAC1B,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;CACpB;CACA,kBAAkB;EAChB,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;CACpB;CACA,oBAAoB;EAClB,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;CACpB;CACA,kBAAkB;EAChB,gBAAgB;EAChB,aAAa;EACb,aAAa;EACb,WAAW;EACX,aAAa;EACb,iBAAiB;EACjB,iBAAiB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,aAAa;EACb,kBAAkB;CACpB;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.cjs","names":[],"sources":["../../src/chat_models/types.ts"],"sourcesContent":["/* oxlint-disable @typescript-eslint/no-namespace */\n\nimport type { InteropZodType } from \"@langchain/core/utils/types\";\nimport type { BindToolsInput } from \"@langchain/core/language_models/chat_models\";\nimport type { Gemini as GeminiBase } from \"./api-types.js\";\nimport type { LowercaseLiteral, Prettify } from \"../utils/misc.js\";\n\nexport interface ChatGoogleFields {\n /**\n * The temperature is used for sampling during response generation, which\n * occurs when topP and topK are applied. Temperature controls the degree of\n * randomness in token selection. Lower temperatures are good for prompts that\n * require a less open-ended or creative response, while higher temperatures\n * can lead to more diverse or creative results.\n *\n * Specify a lower value for less random responses and a higher value for more\n * random responses.\n */\n temperature?: number;\n\n /**\n * Top-P changes how the model selects tokens for output. Tokens are selected\n * from the most probable to least probable until the sum of their\n * probabilities equals the top-P value.\n *\n * Specify a lower value for less random responses and a higher value for more\n * random responses.\n */\n topP?: number;\n\n /**\n * Top-K changes how the model selects tokens for output. A top-K of 1 means\n * the selected token is the most probable among all tokens in the model's\n * vocabulary (also called greedy decoding), while a top-K of 3 means that the\n * next token is selected from among the 3 most probable tokens (using\n * temperature).\n */\n topK?: number;\n\n /**\n * Maximum number of tokens that can be generated in the response. A token is\n * approximately four characters. 100 tokens correspond to roughly 60-80 words.\n * Specify a lower value for shorter responses and a higher value for\n * potentially longer responses.\n */\n maxOutputTokens?: number;\n\n /**\n * Positive values penalize tokens that already appear in the generated text,\n * increasing the probability of generating more diverse content.\n */\n presencePenalty?: number;\n\n /**\n * Positive values penalize tokens that repeatedly appear in the generated\n * text, decreasing the probability of repeating content.\n */\n frequencyPenalty?: number;\n\n /**\n * Specifies a list of strings that tells the model to stop generating text if\n * one of the strings is encountered in the response. If a string appears\n * multiple times in the response, then the response truncates where it's\n * first encountered. The strings are case-sensitive.\n */\n stopSequences?: string[];\n\n /**\n * When seed is fixed to a specific value, the model makes a best effort to\n * provide the same response for repeated requests. Deterministic output isn't\n * guaranteed. Also, changing the model or parameter settings, such as the\n * temperature, can cause variations in the response even when you use the\n * same seed value. By default, a random seed value is used.\n */\n seed?: number;\n\n /**\n * If true, returns the log probabilities of the tokens that were chosen by\n * the model at each step. By default, this parameter is set to false.\n */\n responseLogprobs?: boolean;\n\n /**\n * Returns the log probabilities of the top candidate tokens at each generation\n * step. The model's chosen token might not be the same as the top candidate\n * token at each step. Specify the number of candidates to return by using an\n * integer value in the range of 1-20.\n */\n logprobs?: number;\n\n /**\n * Per request settings for blocking unsafe content\n */\n safetySettings?: Prettify<GeminiBase.SafetySetting>[];\n\n /**\n * Configuration for the model's thinking process\n */\n thinkingConfig?: Prettify<GeminiBase.ThinkingConfig>;\n\n /**\n * The schema that the generated response should match.\n * Can be a Zod schema or a JSON Schema object.\n * When set, the response will be structured according to this schema\n * and `responseMimeType` will automatically be set to \"application/json\".\n */\n responseSchema?: InteropZodType | Record<string, unknown>;\n\n /**\n * A list of tools the model may use to generate the next response.\n * Can be LangChain tools, OpenAI tools, or Gemini function declarations.\n */\n tools?: BindToolsInput[];\n\n /**\n * The requested modalities of the response.\n * Represents the set of modalities that the model can return.\n * An empty list is equivalent to requesting only text.\n */\n responseModalities?: Prettify<GeminiBase.GenerativeLanguageModality>[];\n\n /**\n * If true, enables enhanced civic answers feature.\n */\n enableEnhancedCivicAnswers?: boolean;\n\n /**\n * Speech generation configuration.\n * You can use either Google's definition of the speech configuration,\n * or a simplified version we've defined (which can be as simple\n * as the name of a pre-defined voice).\n */\n speechConfig?: Prettify<GeminiBase.SpeechConfig> | SimplifiedSpeechConfig;\n\n /**\n * Configuration for image generation.\n */\n imageConfig?: Prettify<GeminiBase.ImageConfig>;\n\n /**\n * Media resolution for input media processing.\n *\n * This maps to `generationConfig.mediaResolution`, which is a scalar enum-like\n * string value in the Gemini API.\n */\n mediaResolution?: GeminiBase.GenerationConfig[\"mediaResolution\"];\n\n /**\n * OpenAI-compatible alias for media input detail level.\n *\n * This is mapped to `generationConfig.mediaResolution`:\n * - `\"auto\"` => default Gemini behavior (`mediaResolution` omitted)\n * - `\"low\"` => `\"MEDIA_RESOLUTION_LOW\"`\n * - `\"high\"` => `\"MEDIA_RESOLUTION_HIGH\"`\n *\n * If both `mediaResolution` and `detail` are provided, `mediaResolution` wins.\n */\n detail?: \"auto\" | \"low\" | \"high\";\n\n /**\n * The number of reasoning tokens that the model should generate.\n * If explicitly set, then the reasoning blocks will be returned.\n */\n maxReasoningTokens?: number;\n\n /**\n * An alias for `maxReasoningTokens` for compatibility.\n */\n thinkingBudget?: number;\n\n /**\n * An alias for `maxReasoningTokens` under Gemini 2.5 or\n * the primary thinking/reasoning setting for Gemini 3.\n * If explicitly set, then the reasoning blocks will be returned.\n */\n reasoningEffort?: GeminiBase.ThinkingLevel;\n\n /**\n * An alias for `reasoningEffort` for compatibility.\n */\n thinkingLevel?: GeminiBase.ThinkingLevel;\n\n /**\n * Inference service tiers.\n * \"priority\" offers highest reliability for higher rates.\n * \"flex\" offers a discount for preemptable processing.\n * Other values are treated as the standard service tier.\n */\n serviceTier?: GeminiBase.ServiceTier;\n\n /**\n * Custom / additional headers to include with every request to the API.\n * When set on both constructor params and per-invocation call options,\n * per-invocation headers take precidence for matching keys.\n */\n customHeaders?: Record<string, string>;\n}\n\nexport type GooglePlatformType = \"gai\" | \"gcp\";\n\n// These are service tiers that we specifically need to send.\n// Other values will be ignored, resulting in the default\n// or \"standard\" setting.\nexport const settableServiceTier: GeminiBase.ServiceTier[] = [\n \"flex\",\n \"priority\",\n];\n\nexport { type Gemini } from \"./api-types.js\";\n\n// There's a fair number of utilities that we need to extract from the base\n// Gemini OpenAPI types, Adding these directly to the base types\n// would pollute the typegen output, so we're adding them here instead.\ndeclare module \"./api-types.js\" {\n export namespace Gemini {\n // Gemini parts are contained as one intersecting type\n // in the spec, so we need to pick out the specific parts we need.\n export namespace Part {\n export type CodeExecutionResult = Pick<\n GeminiBase.Part,\n \"codeExecutionResult\"\n >;\n export type ExecutableCode = Pick<GeminiBase.Part, \"executableCode\">;\n export type FileData = Pick<\n GeminiBase.Part,\n \"fileData\" | \"videoMetadata\"\n >;\n export type FunctionCall = Required<\n Pick<GeminiBase.Part, \"functionCall\">\n > &\n Pick<GeminiBase.Part, \"thoughtSignature\">;\n export type FunctionResponse = Pick<GeminiBase.Part, \"functionResponse\">;\n export type InlineData = Pick<\n GeminiBase.Part,\n \"inlineData\" | \"videoMetadata\"\n >;\n export type MediaResolution = Pick<GeminiBase.Part, \"mediaResolution\">;\n export type PartMetadata = Pick<GeminiBase.Part, \"partMetadata\">;\n export type Text = Pick<GeminiBase.Part, \"text\">;\n export type Thought = Pick<GeminiBase.Part, \"thought\">;\n export type ThoughtSignature = Pick<GeminiBase.Part, \"thoughtSignature\">;\n }\n\n export namespace PrebuiltVoiceConfig {\n /**\n * The name of a prebuilt voice that can be used for speech synthesis.\n *\n * Extracted as a non-nullable type from the GeminiBase.PrebuiltVoiceConfig[\"voiceName\"] property.\n */\n export type VoiceName = NonNullable<\n GeminiBase.PrebuiltVoiceConfig[\"voiceName\"]\n >;\n }\n\n export namespace SpeakerVoiceConfig {\n /**\n * The speaker identifier for a custom or multi-speaker TTS configuration.\n *\n * Extracted as a non-nullable type from the GeminiBase.SpeakerVoiceConfig[\"speaker\"] property.\n */\n export type Speaker = NonNullable<\n GeminiBase.SpeakerVoiceConfig[\"speaker\"]\n >;\n }\n\n export namespace SpeechConfig {\n /**\n * The BCP-47 language code for speech synthesis (e.g., \"en-US\").\n *\n * Extracted as a non-nullable type from the GeminiBase.SpeechConfig[\"languageCode\"] property.\n */\n export type LanguageCode = NonNullable<\n GeminiBase.SpeechConfig[\"languageCode\"]\n >;\n }\n\n /**\n * The level of \"thinking\" or reasoning configured for the model.\n *\n * Extends GeminiBase.ThinkingConfig[\"thinkingLevel\"] to also accept\n * lowercase variants (e.g. \"high\" in addition to \"HIGH\").\n */\n export type ThinkingLevel =\n | GeminiBase.ThinkingConfig[\"thinkingLevel\"]\n | LowercaseLiteral<GeminiBase.ThinkingConfig[\"thinkingLevel\"]>;\n\n /**\n * The role of a content message. The spec types this as `string`, but\n * the API only accepts these specific values.\n */\n export type Role = \"user\" | \"model\" | \"function\";\n\n /**\n * Alias for the unwieldy generated grounding support type name.\n */\n export type GroundingSupport =\n GeminiBase.GoogleAiGenerativelanguageV1betaGroundingSupport;\n\n /**\n * Alias for the unwieldy generated segment type name.\n */\n export type Segment = GeminiBase.GoogleAiGenerativelanguageV1betaSegment;\n\n export namespace Tools {\n /**\n * The mode for function calling configuration, extracted from the\n * FunctionCallingConfig interface.\n */\n export type FunctionCallingConfigMode =\n GeminiBase.Tools.FunctionCallingConfig[\"mode\"];\n }\n\n /**\n * Legacy URL retrieval metadata (predecessor of UrlContextMetadata).\n * Not in the current OpenAPI spec but still returned by the API.\n */\n export interface UrlRetrievalMetadata {\n urlRetrievalContexts?: Array<GeminiBase.UrlMetadata>;\n }\n\n // Augment Candidate with legacy field the API still returns.\n export interface Candidate {\n /** @deprecated Use urlContextMetadata instead. */\n readonly urlRetrievalMetadata?: UrlRetrievalMetadata;\n }\n }\n}\n\n/**\n * Simplified speaker/name pair for multi-speaker config.\n * - `speaker` derived from SpeakerVoiceConfig[\"speaker\"]\n * - `name` is the prebuilt voice name\n */\nexport interface SpeechSpeakerName {\n speaker: GeminiBase.SpeakerVoiceConfig.Speaker;\n name: GeminiBase.PrebuiltVoiceConfig.VoiceName;\n}\n\n/** A voice can be a prebuilt voice name, a speaker/name pair, or an array of pairs */\nexport type SpeechVoice =\n | GeminiBase.PrebuiltVoiceConfig.VoiceName\n | SpeechSpeakerName\n | SpeechSpeakerName[];\n\n/** Voice with language code (derived from SpeechConfig's languageCode) */\nexport interface SpeechVoiceLanguage {\n voice: SpeechVoice;\n languageCode: GeminiBase.SpeechConfig.LanguageCode;\n}\n\n/** Voices with language code */\nexport interface SpeechVoicesLanguage {\n voices: SpeechVoice;\n languageCode: GeminiBase.SpeechConfig.LanguageCode;\n}\n\n/** Simplified language config (with voice or voices) */\nexport type SimplifiedSpeechLanguageConfig =\n | SpeechVoiceLanguage\n | SpeechVoicesLanguage;\n\n/** Top-level simplified config: just a voice, or voice+language */\nexport type SimplifiedSpeechConfig =\n | SpeechVoice\n | SimplifiedSpeechLanguageConfig;\n"],"mappings":";AA2MA,MAAa,sBAAgD,CAC3D,QACA,WACD"}
1
+ {"version":3,"file":"types.cjs","names":[],"sources":["../../src/chat_models/types.ts"],"sourcesContent":["/* oxlint-disable @typescript-eslint/no-namespace */\n\nimport type { InteropZodType } from \"@langchain/core/utils/types\";\nimport type { BindToolsInput } from \"@langchain/core/language_models/chat_models\";\nimport type { Gemini as GeminiBase } from \"./api-types.js\";\nimport type { LowercaseLiteral, Prettify } from \"../utils/misc.js\";\n\nexport interface ChatGoogleFields {\n /**\n * The temperature is used for sampling during response generation, which\n * occurs when topP and topK are applied. Temperature controls the degree of\n * randomness in token selection. Lower temperatures are good for prompts that\n * require a less open-ended or creative response, while higher temperatures\n * can lead to more diverse or creative results.\n *\n * Specify a lower value for less random responses and a higher value for more\n * random responses.\n */\n temperature?: number;\n\n /**\n * Top-P changes how the model selects tokens for output. Tokens are selected\n * from the most probable to least probable until the sum of their\n * probabilities equals the top-P value.\n *\n * Specify a lower value for less random responses and a higher value for more\n * random responses.\n */\n topP?: number;\n\n /**\n * Top-K changes how the model selects tokens for output. A top-K of 1 means\n * the selected token is the most probable among all tokens in the model's\n * vocabulary (also called greedy decoding), while a top-K of 3 means that the\n * next token is selected from among the 3 most probable tokens (using\n * temperature).\n */\n topK?: number;\n\n /**\n * Maximum number of tokens that can be generated in the response. A token is\n * approximately four characters. 100 tokens correspond to roughly 60-80 words.\n * Specify a lower value for shorter responses and a higher value for\n * potentially longer responses.\n */\n maxOutputTokens?: number;\n\n /**\n * Positive values penalize tokens that already appear in the generated text,\n * increasing the probability of generating more diverse content.\n */\n presencePenalty?: number;\n\n /**\n * Positive values penalize tokens that repeatedly appear in the generated\n * text, decreasing the probability of repeating content.\n */\n frequencyPenalty?: number;\n\n /**\n * Specifies a list of strings that tells the model to stop generating text if\n * one of the strings is encountered in the response. If a string appears\n * multiple times in the response, then the response truncates where it's\n * first encountered. The strings are case-sensitive.\n */\n stopSequences?: string[];\n\n /**\n * When seed is fixed to a specific value, the model makes a best effort to\n * provide the same response for repeated requests. Deterministic output isn't\n * guaranteed. Also, changing the model or parameter settings, such as the\n * temperature, can cause variations in the response even when you use the\n * same seed value. By default, a random seed value is used.\n */\n seed?: number;\n\n /**\n * If true, returns the log probabilities of the tokens that were chosen by\n * the model at each step. By default, this parameter is set to false.\n */\n responseLogprobs?: boolean;\n\n /**\n * Returns the log probabilities of the top candidate tokens at each generation\n * step. The model's chosen token might not be the same as the top candidate\n * token at each step. Specify the number of candidates to return by using an\n * integer value in the range of 1-20.\n */\n logprobs?: number;\n\n /**\n * Per request settings for blocking unsafe content\n */\n safetySettings?: Prettify<GeminiBase.SafetySetting>[];\n\n /**\n * Configuration for the model's thinking process\n */\n thinkingConfig?: Prettify<GeminiBase.ThinkingConfig>;\n\n /**\n * The schema that the generated response should match.\n * Can be a Zod schema or a JSON Schema object.\n * When set, the response will be structured according to this schema\n * and `responseMimeType` will automatically be set to \"application/json\".\n */\n responseSchema?: InteropZodType | Record<string, unknown>;\n\n /**\n * A list of tools the model may use to generate the next response.\n * Can be LangChain tools, OpenAI tools, or Gemini function declarations.\n */\n tools?: BindToolsInput[];\n\n /**\n * The requested modalities of the response.\n * Represents the set of modalities that the model can return.\n * An empty list is equivalent to requesting only text.\n */\n responseModalities?: Prettify<GeminiBase.GenerativeLanguageModality>[];\n\n /**\n * If true, enables enhanced civic answers feature.\n */\n enableEnhancedCivicAnswers?: boolean;\n\n /**\n * Speech generation configuration.\n * You can use either Google's definition of the speech configuration,\n * or a simplified version we've defined (which can be as simple\n * as the name of a pre-defined voice).\n */\n speechConfig?: Prettify<GeminiBase.SpeechConfig> | SimplifiedSpeechConfig;\n\n /**\n * Configuration for image generation.\n */\n imageConfig?: Prettify<GeminiBase.ImageConfig>;\n\n /**\n * Media resolution for input media processing.\n *\n * This maps to `generationConfig.mediaResolution`, which is a scalar enum-like\n * string value in the Gemini API.\n */\n mediaResolution?: GeminiBase.GenerationConfig[\"mediaResolution\"];\n\n /**\n * OpenAI-compatible alias for media input detail level.\n *\n * This is mapped to `generationConfig.mediaResolution`:\n * - `\"auto\"` => default Gemini behavior (`mediaResolution` omitted)\n * - `\"low\"` => `\"MEDIA_RESOLUTION_LOW\"`\n * - `\"high\"` => `\"MEDIA_RESOLUTION_HIGH\"`\n *\n * If both `mediaResolution` and `detail` are provided, `mediaResolution` wins.\n */\n detail?: \"auto\" | \"low\" | \"high\";\n\n /**\n * The number of reasoning tokens that the model should generate.\n * If explicitly set, then the reasoning blocks will be returned.\n */\n maxReasoningTokens?: number;\n\n /**\n * An alias for `maxReasoningTokens` for compatibility.\n */\n thinkingBudget?: number;\n\n /**\n * An alias for `maxReasoningTokens` under Gemini 2.5 or\n * the primary thinking/reasoning setting for Gemini 3.\n * If explicitly set, then the reasoning blocks will be returned.\n */\n reasoningEffort?: GeminiBase.ThinkingLevel;\n\n /**\n * An alias for `reasoningEffort` for compatibility.\n */\n thinkingLevel?: GeminiBase.ThinkingLevel;\n\n /**\n * Inference service tiers.\n * \"priority\" offers highest reliability for higher rates.\n * \"flex\" offers a discount for preemptable processing.\n * Other values are treated as the standard service tier.\n */\n serviceTier?: GeminiBase.ServiceTier;\n\n /**\n * Custom / additional headers to include with every request to the API.\n * When set on both constructor params and per-invocation call options,\n * per-invocation headers take precidence for matching keys.\n */\n customHeaders?: Record<string, string>;\n}\n\nexport type GooglePlatformType = \"gai\" | \"gcp\";\n\n// These are service tiers that we specifically need to send.\n// Other values will be ignored, resulting in the default\n// or \"standard\" setting.\nexport const settableServiceTier: GeminiBase.ServiceTier[] = [\n \"flex\",\n \"priority\",\n];\n\nexport { type Gemini } from \"./api-types.js\";\n\n// There's a fair number of utilities that we need to extract from the base\n// Gemini OpenAPI types, Adding these directly to the base types\n// would pollute the typegen output, so we're adding them here instead.\ndeclare module \"./api-types.js\" {\n export namespace Gemini {\n // Gemini parts are contained as one intersecting type\n // in the spec, so we need to pick out the specific parts we need.\n export namespace Part {\n export type CodeExecutionResult = Pick<\n GeminiBase.Part,\n \"codeExecutionResult\"\n >;\n export type ExecutableCode = Pick<GeminiBase.Part, \"executableCode\">;\n export type FileData = Pick<\n GeminiBase.Part,\n \"fileData\" | \"videoMetadata\"\n >;\n export type FunctionCall = Required<\n Pick<GeminiBase.Part, \"functionCall\">\n > &\n Pick<GeminiBase.Part, \"thoughtSignature\">;\n export type FunctionResponse = Pick<GeminiBase.Part, \"functionResponse\">;\n export type InlineData = Pick<\n GeminiBase.Part,\n \"inlineData\" | \"videoMetadata\"\n >;\n export type MediaResolution = Pick<GeminiBase.Part, \"mediaResolution\">;\n export type PartMetadata = Pick<GeminiBase.Part, \"partMetadata\">;\n export type Text = Pick<GeminiBase.Part, \"text\">;\n export type Thought = Pick<GeminiBase.Part, \"thought\">;\n export type ThoughtSignature = Pick<GeminiBase.Part, \"thoughtSignature\">;\n }\n\n export namespace PrebuiltVoiceConfig {\n /**\n * The name of a prebuilt voice that can be used for speech synthesis.\n *\n * Extracted as a non-nullable type from the GeminiBase.PrebuiltVoiceConfig[\"voiceName\"] property.\n */\n export type VoiceName = NonNullable<\n GeminiBase.PrebuiltVoiceConfig[\"voiceName\"]\n >;\n }\n\n export namespace SpeakerVoiceConfig {\n /**\n * The speaker identifier for a custom or multi-speaker TTS configuration.\n *\n * Extracted as a non-nullable type from the GeminiBase.SpeakerVoiceConfig[\"speaker\"] property.\n */\n export type Speaker = NonNullable<\n GeminiBase.SpeakerVoiceConfig[\"speaker\"]\n >;\n }\n\n export namespace SpeechConfig {\n /**\n * The BCP-47 language code for speech synthesis (e.g., \"en-US\").\n *\n * Extracted as a non-nullable type from the GeminiBase.SpeechConfig[\"languageCode\"] property.\n */\n export type LanguageCode = NonNullable<\n GeminiBase.SpeechConfig[\"languageCode\"]\n >;\n }\n\n /**\n * The level of \"thinking\" or reasoning configured for the model.\n *\n * Extends GeminiBase.ThinkingConfig[\"thinkingLevel\"] to also accept\n * lowercase variants (e.g. \"high\" in addition to \"HIGH\").\n */\n export type ThinkingLevel =\n | GeminiBase.ThinkingConfig[\"thinkingLevel\"]\n | LowercaseLiteral<GeminiBase.ThinkingConfig[\"thinkingLevel\"]>;\n\n /**\n * The role of a content message. The spec types this as `string`, but\n * the API only accepts these specific values.\n */\n export type Role = \"user\" | \"model\" | \"function\";\n\n /**\n * Alias for the unwieldy generated grounding support type name.\n */\n export type GroundingSupport =\n GeminiBase.GoogleAiGenerativelanguageV1betaGroundingSupport;\n\n /**\n * Alias for the unwieldy generated segment type name.\n */\n export type Segment = GeminiBase.GoogleAiGenerativelanguageV1betaSegment;\n\n export namespace Tools {\n /**\n * The mode for function calling configuration, extracted from the\n * FunctionCallingConfig interface.\n */\n export type FunctionCallingConfigMode =\n GeminiBase.Tools.FunctionCallingConfig[\"mode\"];\n }\n\n /**\n * Legacy URL retrieval metadata (predecessor of UrlContextMetadata).\n * Not in the current OpenAPI spec but still returned by the API.\n */\n export interface UrlRetrievalMetadata {\n urlRetrievalContexts?: Array<GeminiBase.UrlMetadata>;\n }\n\n // Augment Candidate with legacy field the API still returns.\n export interface Candidate {\n /** @deprecated Use urlContextMetadata instead. */\n readonly urlRetrievalMetadata?: UrlRetrievalMetadata;\n }\n }\n}\n\n/**\n * Simplified speaker/name pair for multi-speaker config.\n * - `speaker` derived from SpeakerVoiceConfig[\"speaker\"]\n * - `name` is the prebuilt voice name\n */\nexport interface SpeechSpeakerName {\n speaker: GeminiBase.SpeakerVoiceConfig.Speaker;\n name: GeminiBase.PrebuiltVoiceConfig.VoiceName;\n}\n\n/** A voice can be a prebuilt voice name, a speaker/name pair, or an array of pairs */\nexport type SpeechVoice =\n | GeminiBase.PrebuiltVoiceConfig.VoiceName\n | SpeechSpeakerName\n | SpeechSpeakerName[];\n\n/** Voice with language code (derived from SpeechConfig's languageCode) */\nexport interface SpeechVoiceLanguage {\n voice: SpeechVoice;\n languageCode: GeminiBase.SpeechConfig.LanguageCode;\n}\n\n/** Voices with language code */\nexport interface SpeechVoicesLanguage {\n voices: SpeechVoice;\n languageCode: GeminiBase.SpeechConfig.LanguageCode;\n}\n\n/** Simplified language config (with voice or voices) */\nexport type SimplifiedSpeechLanguageConfig =\n | SpeechVoiceLanguage\n | SpeechVoicesLanguage;\n\n/** Top-level simplified config: just a voice, or voice+language */\nexport type SimplifiedSpeechConfig =\n | SpeechVoice\n | SimplifiedSpeechLanguageConfig;\n"],"mappings":";AA2MA,MAAa,sBAAgD,CAC3D,QACA,UACF"}
@@ -2,7 +2,6 @@ import { LowercaseLiteral, Prettify } from "../utils/misc.cjs";
2
2
  import { Gemini } from "./api-types.cjs";
3
3
  import { BindToolsInput } from "@langchain/core/language_models/chat_models";
4
4
  import { InteropZodType } from "@langchain/core/utils/types";
5
-
6
5
  //#region src/chat_models/types.d.ts
7
6
  interface ChatGoogleFields {
8
7
  /**
@@ -274,5 +273,5 @@ type SimplifiedSpeechLanguageConfig = SpeechVoiceLanguage | SpeechVoicesLanguage
274
273
  /** Top-level simplified config: just a voice, or voice+language */
275
274
  type SimplifiedSpeechConfig = SpeechVoice | SimplifiedSpeechLanguageConfig;
276
275
  //#endregion
277
- export { ChatGoogleFields };
276
+ export { ChatGoogleFields, SimplifiedSpeechConfig, SimplifiedSpeechLanguageConfig, SpeechSpeakerName, SpeechVoice, SpeechVoiceLanguage, SpeechVoicesLanguage };
278
277
  //# sourceMappingURL=types.d.cts.map
@@ -2,7 +2,6 @@ import { LowercaseLiteral, Prettify } from "../utils/misc.js";
2
2
  import { Gemini } from "./api-types.js";
3
3
  import { BindToolsInput } from "@langchain/core/language_models/chat_models";
4
4
  import { InteropZodType } from "@langchain/core/utils/types";
5
-
6
5
  //#region src/chat_models/types.d.ts
7
6
  interface ChatGoogleFields {
8
7
  /**
@@ -274,5 +273,5 @@ type SimplifiedSpeechLanguageConfig = SpeechVoiceLanguage | SpeechVoicesLanguage
274
273
  /** Top-level simplified config: just a voice, or voice+language */
275
274
  type SimplifiedSpeechConfig = SpeechVoice | SimplifiedSpeechLanguageConfig;
276
275
  //#endregion
277
- export { ChatGoogleFields };
276
+ export { ChatGoogleFields, SimplifiedSpeechConfig, SimplifiedSpeechLanguageConfig, SpeechSpeakerName, SpeechVoice, SpeechVoiceLanguage, SpeechVoicesLanguage };
278
277
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../src/chat_models/types.ts"],"sourcesContent":["/* oxlint-disable @typescript-eslint/no-namespace */\n\nimport type { InteropZodType } from \"@langchain/core/utils/types\";\nimport type { BindToolsInput } from \"@langchain/core/language_models/chat_models\";\nimport type { Gemini as GeminiBase } from \"./api-types.js\";\nimport type { LowercaseLiteral, Prettify } from \"../utils/misc.js\";\n\nexport interface ChatGoogleFields {\n /**\n * The temperature is used for sampling during response generation, which\n * occurs when topP and topK are applied. Temperature controls the degree of\n * randomness in token selection. Lower temperatures are good for prompts that\n * require a less open-ended or creative response, while higher temperatures\n * can lead to more diverse or creative results.\n *\n * Specify a lower value for less random responses and a higher value for more\n * random responses.\n */\n temperature?: number;\n\n /**\n * Top-P changes how the model selects tokens for output. Tokens are selected\n * from the most probable to least probable until the sum of their\n * probabilities equals the top-P value.\n *\n * Specify a lower value for less random responses and a higher value for more\n * random responses.\n */\n topP?: number;\n\n /**\n * Top-K changes how the model selects tokens for output. A top-K of 1 means\n * the selected token is the most probable among all tokens in the model's\n * vocabulary (also called greedy decoding), while a top-K of 3 means that the\n * next token is selected from among the 3 most probable tokens (using\n * temperature).\n */\n topK?: number;\n\n /**\n * Maximum number of tokens that can be generated in the response. A token is\n * approximately four characters. 100 tokens correspond to roughly 60-80 words.\n * Specify a lower value for shorter responses and a higher value for\n * potentially longer responses.\n */\n maxOutputTokens?: number;\n\n /**\n * Positive values penalize tokens that already appear in the generated text,\n * increasing the probability of generating more diverse content.\n */\n presencePenalty?: number;\n\n /**\n * Positive values penalize tokens that repeatedly appear in the generated\n * text, decreasing the probability of repeating content.\n */\n frequencyPenalty?: number;\n\n /**\n * Specifies a list of strings that tells the model to stop generating text if\n * one of the strings is encountered in the response. If a string appears\n * multiple times in the response, then the response truncates where it's\n * first encountered. The strings are case-sensitive.\n */\n stopSequences?: string[];\n\n /**\n * When seed is fixed to a specific value, the model makes a best effort to\n * provide the same response for repeated requests. Deterministic output isn't\n * guaranteed. Also, changing the model or parameter settings, such as the\n * temperature, can cause variations in the response even when you use the\n * same seed value. By default, a random seed value is used.\n */\n seed?: number;\n\n /**\n * If true, returns the log probabilities of the tokens that were chosen by\n * the model at each step. By default, this parameter is set to false.\n */\n responseLogprobs?: boolean;\n\n /**\n * Returns the log probabilities of the top candidate tokens at each generation\n * step. The model's chosen token might not be the same as the top candidate\n * token at each step. Specify the number of candidates to return by using an\n * integer value in the range of 1-20.\n */\n logprobs?: number;\n\n /**\n * Per request settings for blocking unsafe content\n */\n safetySettings?: Prettify<GeminiBase.SafetySetting>[];\n\n /**\n * Configuration for the model's thinking process\n */\n thinkingConfig?: Prettify<GeminiBase.ThinkingConfig>;\n\n /**\n * The schema that the generated response should match.\n * Can be a Zod schema or a JSON Schema object.\n * When set, the response will be structured according to this schema\n * and `responseMimeType` will automatically be set to \"application/json\".\n */\n responseSchema?: InteropZodType | Record<string, unknown>;\n\n /**\n * A list of tools the model may use to generate the next response.\n * Can be LangChain tools, OpenAI tools, or Gemini function declarations.\n */\n tools?: BindToolsInput[];\n\n /**\n * The requested modalities of the response.\n * Represents the set of modalities that the model can return.\n * An empty list is equivalent to requesting only text.\n */\n responseModalities?: Prettify<GeminiBase.GenerativeLanguageModality>[];\n\n /**\n * If true, enables enhanced civic answers feature.\n */\n enableEnhancedCivicAnswers?: boolean;\n\n /**\n * Speech generation configuration.\n * You can use either Google's definition of the speech configuration,\n * or a simplified version we've defined (which can be as simple\n * as the name of a pre-defined voice).\n */\n speechConfig?: Prettify<GeminiBase.SpeechConfig> | SimplifiedSpeechConfig;\n\n /**\n * Configuration for image generation.\n */\n imageConfig?: Prettify<GeminiBase.ImageConfig>;\n\n /**\n * Media resolution for input media processing.\n *\n * This maps to `generationConfig.mediaResolution`, which is a scalar enum-like\n * string value in the Gemini API.\n */\n mediaResolution?: GeminiBase.GenerationConfig[\"mediaResolution\"];\n\n /**\n * OpenAI-compatible alias for media input detail level.\n *\n * This is mapped to `generationConfig.mediaResolution`:\n * - `\"auto\"` => default Gemini behavior (`mediaResolution` omitted)\n * - `\"low\"` => `\"MEDIA_RESOLUTION_LOW\"`\n * - `\"high\"` => `\"MEDIA_RESOLUTION_HIGH\"`\n *\n * If both `mediaResolution` and `detail` are provided, `mediaResolution` wins.\n */\n detail?: \"auto\" | \"low\" | \"high\";\n\n /**\n * The number of reasoning tokens that the model should generate.\n * If explicitly set, then the reasoning blocks will be returned.\n */\n maxReasoningTokens?: number;\n\n /**\n * An alias for `maxReasoningTokens` for compatibility.\n */\n thinkingBudget?: number;\n\n /**\n * An alias for `maxReasoningTokens` under Gemini 2.5 or\n * the primary thinking/reasoning setting for Gemini 3.\n * If explicitly set, then the reasoning blocks will be returned.\n */\n reasoningEffort?: GeminiBase.ThinkingLevel;\n\n /**\n * An alias for `reasoningEffort` for compatibility.\n */\n thinkingLevel?: GeminiBase.ThinkingLevel;\n\n /**\n * Inference service tiers.\n * \"priority\" offers highest reliability for higher rates.\n * \"flex\" offers a discount for preemptable processing.\n * Other values are treated as the standard service tier.\n */\n serviceTier?: GeminiBase.ServiceTier;\n\n /**\n * Custom / additional headers to include with every request to the API.\n * When set on both constructor params and per-invocation call options,\n * per-invocation headers take precidence for matching keys.\n */\n customHeaders?: Record<string, string>;\n}\n\nexport type GooglePlatformType = \"gai\" | \"gcp\";\n\n// These are service tiers that we specifically need to send.\n// Other values will be ignored, resulting in the default\n// or \"standard\" setting.\nexport const settableServiceTier: GeminiBase.ServiceTier[] = [\n \"flex\",\n \"priority\",\n];\n\nexport { type Gemini } from \"./api-types.js\";\n\n// There's a fair number of utilities that we need to extract from the base\n// Gemini OpenAPI types, Adding these directly to the base types\n// would pollute the typegen output, so we're adding them here instead.\ndeclare module \"./api-types.js\" {\n export namespace Gemini {\n // Gemini parts are contained as one intersecting type\n // in the spec, so we need to pick out the specific parts we need.\n export namespace Part {\n export type CodeExecutionResult = Pick<\n GeminiBase.Part,\n \"codeExecutionResult\"\n >;\n export type ExecutableCode = Pick<GeminiBase.Part, \"executableCode\">;\n export type FileData = Pick<\n GeminiBase.Part,\n \"fileData\" | \"videoMetadata\"\n >;\n export type FunctionCall = Required<\n Pick<GeminiBase.Part, \"functionCall\">\n > &\n Pick<GeminiBase.Part, \"thoughtSignature\">;\n export type FunctionResponse = Pick<GeminiBase.Part, \"functionResponse\">;\n export type InlineData = Pick<\n GeminiBase.Part,\n \"inlineData\" | \"videoMetadata\"\n >;\n export type MediaResolution = Pick<GeminiBase.Part, \"mediaResolution\">;\n export type PartMetadata = Pick<GeminiBase.Part, \"partMetadata\">;\n export type Text = Pick<GeminiBase.Part, \"text\">;\n export type Thought = Pick<GeminiBase.Part, \"thought\">;\n export type ThoughtSignature = Pick<GeminiBase.Part, \"thoughtSignature\">;\n }\n\n export namespace PrebuiltVoiceConfig {\n /**\n * The name of a prebuilt voice that can be used for speech synthesis.\n *\n * Extracted as a non-nullable type from the GeminiBase.PrebuiltVoiceConfig[\"voiceName\"] property.\n */\n export type VoiceName = NonNullable<\n GeminiBase.PrebuiltVoiceConfig[\"voiceName\"]\n >;\n }\n\n export namespace SpeakerVoiceConfig {\n /**\n * The speaker identifier for a custom or multi-speaker TTS configuration.\n *\n * Extracted as a non-nullable type from the GeminiBase.SpeakerVoiceConfig[\"speaker\"] property.\n */\n export type Speaker = NonNullable<\n GeminiBase.SpeakerVoiceConfig[\"speaker\"]\n >;\n }\n\n export namespace SpeechConfig {\n /**\n * The BCP-47 language code for speech synthesis (e.g., \"en-US\").\n *\n * Extracted as a non-nullable type from the GeminiBase.SpeechConfig[\"languageCode\"] property.\n */\n export type LanguageCode = NonNullable<\n GeminiBase.SpeechConfig[\"languageCode\"]\n >;\n }\n\n /**\n * The level of \"thinking\" or reasoning configured for the model.\n *\n * Extends GeminiBase.ThinkingConfig[\"thinkingLevel\"] to also accept\n * lowercase variants (e.g. \"high\" in addition to \"HIGH\").\n */\n export type ThinkingLevel =\n | GeminiBase.ThinkingConfig[\"thinkingLevel\"]\n | LowercaseLiteral<GeminiBase.ThinkingConfig[\"thinkingLevel\"]>;\n\n /**\n * The role of a content message. The spec types this as `string`, but\n * the API only accepts these specific values.\n */\n export type Role = \"user\" | \"model\" | \"function\";\n\n /**\n * Alias for the unwieldy generated grounding support type name.\n */\n export type GroundingSupport =\n GeminiBase.GoogleAiGenerativelanguageV1betaGroundingSupport;\n\n /**\n * Alias for the unwieldy generated segment type name.\n */\n export type Segment = GeminiBase.GoogleAiGenerativelanguageV1betaSegment;\n\n export namespace Tools {\n /**\n * The mode for function calling configuration, extracted from the\n * FunctionCallingConfig interface.\n */\n export type FunctionCallingConfigMode =\n GeminiBase.Tools.FunctionCallingConfig[\"mode\"];\n }\n\n /**\n * Legacy URL retrieval metadata (predecessor of UrlContextMetadata).\n * Not in the current OpenAPI spec but still returned by the API.\n */\n export interface UrlRetrievalMetadata {\n urlRetrievalContexts?: Array<GeminiBase.UrlMetadata>;\n }\n\n // Augment Candidate with legacy field the API still returns.\n export interface Candidate {\n /** @deprecated Use urlContextMetadata instead. */\n readonly urlRetrievalMetadata?: UrlRetrievalMetadata;\n }\n }\n}\n\n/**\n * Simplified speaker/name pair for multi-speaker config.\n * - `speaker` derived from SpeakerVoiceConfig[\"speaker\"]\n * - `name` is the prebuilt voice name\n */\nexport interface SpeechSpeakerName {\n speaker: GeminiBase.SpeakerVoiceConfig.Speaker;\n name: GeminiBase.PrebuiltVoiceConfig.VoiceName;\n}\n\n/** A voice can be a prebuilt voice name, a speaker/name pair, or an array of pairs */\nexport type SpeechVoice =\n | GeminiBase.PrebuiltVoiceConfig.VoiceName\n | SpeechSpeakerName\n | SpeechSpeakerName[];\n\n/** Voice with language code (derived from SpeechConfig's languageCode) */\nexport interface SpeechVoiceLanguage {\n voice: SpeechVoice;\n languageCode: GeminiBase.SpeechConfig.LanguageCode;\n}\n\n/** Voices with language code */\nexport interface SpeechVoicesLanguage {\n voices: SpeechVoice;\n languageCode: GeminiBase.SpeechConfig.LanguageCode;\n}\n\n/** Simplified language config (with voice or voices) */\nexport type SimplifiedSpeechLanguageConfig =\n | SpeechVoiceLanguage\n | SpeechVoicesLanguage;\n\n/** Top-level simplified config: just a voice, or voice+language */\nexport type SimplifiedSpeechConfig =\n | SpeechVoice\n | SimplifiedSpeechLanguageConfig;\n"],"mappings":";AA2MA,MAAa,sBAAgD,CAC3D,QACA,WACD"}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../src/chat_models/types.ts"],"sourcesContent":["/* oxlint-disable @typescript-eslint/no-namespace */\n\nimport type { InteropZodType } from \"@langchain/core/utils/types\";\nimport type { BindToolsInput } from \"@langchain/core/language_models/chat_models\";\nimport type { Gemini as GeminiBase } from \"./api-types.js\";\nimport type { LowercaseLiteral, Prettify } from \"../utils/misc.js\";\n\nexport interface ChatGoogleFields {\n /**\n * The temperature is used for sampling during response generation, which\n * occurs when topP and topK are applied. Temperature controls the degree of\n * randomness in token selection. Lower temperatures are good for prompts that\n * require a less open-ended or creative response, while higher temperatures\n * can lead to more diverse or creative results.\n *\n * Specify a lower value for less random responses and a higher value for more\n * random responses.\n */\n temperature?: number;\n\n /**\n * Top-P changes how the model selects tokens for output. Tokens are selected\n * from the most probable to least probable until the sum of their\n * probabilities equals the top-P value.\n *\n * Specify a lower value for less random responses and a higher value for more\n * random responses.\n */\n topP?: number;\n\n /**\n * Top-K changes how the model selects tokens for output. A top-K of 1 means\n * the selected token is the most probable among all tokens in the model's\n * vocabulary (also called greedy decoding), while a top-K of 3 means that the\n * next token is selected from among the 3 most probable tokens (using\n * temperature).\n */\n topK?: number;\n\n /**\n * Maximum number of tokens that can be generated in the response. A token is\n * approximately four characters. 100 tokens correspond to roughly 60-80 words.\n * Specify a lower value for shorter responses and a higher value for\n * potentially longer responses.\n */\n maxOutputTokens?: number;\n\n /**\n * Positive values penalize tokens that already appear in the generated text,\n * increasing the probability of generating more diverse content.\n */\n presencePenalty?: number;\n\n /**\n * Positive values penalize tokens that repeatedly appear in the generated\n * text, decreasing the probability of repeating content.\n */\n frequencyPenalty?: number;\n\n /**\n * Specifies a list of strings that tells the model to stop generating text if\n * one of the strings is encountered in the response. If a string appears\n * multiple times in the response, then the response truncates where it's\n * first encountered. The strings are case-sensitive.\n */\n stopSequences?: string[];\n\n /**\n * When seed is fixed to a specific value, the model makes a best effort to\n * provide the same response for repeated requests. Deterministic output isn't\n * guaranteed. Also, changing the model or parameter settings, such as the\n * temperature, can cause variations in the response even when you use the\n * same seed value. By default, a random seed value is used.\n */\n seed?: number;\n\n /**\n * If true, returns the log probabilities of the tokens that were chosen by\n * the model at each step. By default, this parameter is set to false.\n */\n responseLogprobs?: boolean;\n\n /**\n * Returns the log probabilities of the top candidate tokens at each generation\n * step. The model's chosen token might not be the same as the top candidate\n * token at each step. Specify the number of candidates to return by using an\n * integer value in the range of 1-20.\n */\n logprobs?: number;\n\n /**\n * Per request settings for blocking unsafe content\n */\n safetySettings?: Prettify<GeminiBase.SafetySetting>[];\n\n /**\n * Configuration for the model's thinking process\n */\n thinkingConfig?: Prettify<GeminiBase.ThinkingConfig>;\n\n /**\n * The schema that the generated response should match.\n * Can be a Zod schema or a JSON Schema object.\n * When set, the response will be structured according to this schema\n * and `responseMimeType` will automatically be set to \"application/json\".\n */\n responseSchema?: InteropZodType | Record<string, unknown>;\n\n /**\n * A list of tools the model may use to generate the next response.\n * Can be LangChain tools, OpenAI tools, or Gemini function declarations.\n */\n tools?: BindToolsInput[];\n\n /**\n * The requested modalities of the response.\n * Represents the set of modalities that the model can return.\n * An empty list is equivalent to requesting only text.\n */\n responseModalities?: Prettify<GeminiBase.GenerativeLanguageModality>[];\n\n /**\n * If true, enables enhanced civic answers feature.\n */\n enableEnhancedCivicAnswers?: boolean;\n\n /**\n * Speech generation configuration.\n * You can use either Google's definition of the speech configuration,\n * or a simplified version we've defined (which can be as simple\n * as the name of a pre-defined voice).\n */\n speechConfig?: Prettify<GeminiBase.SpeechConfig> | SimplifiedSpeechConfig;\n\n /**\n * Configuration for image generation.\n */\n imageConfig?: Prettify<GeminiBase.ImageConfig>;\n\n /**\n * Media resolution for input media processing.\n *\n * This maps to `generationConfig.mediaResolution`, which is a scalar enum-like\n * string value in the Gemini API.\n */\n mediaResolution?: GeminiBase.GenerationConfig[\"mediaResolution\"];\n\n /**\n * OpenAI-compatible alias for media input detail level.\n *\n * This is mapped to `generationConfig.mediaResolution`:\n * - `\"auto\"` => default Gemini behavior (`mediaResolution` omitted)\n * - `\"low\"` => `\"MEDIA_RESOLUTION_LOW\"`\n * - `\"high\"` => `\"MEDIA_RESOLUTION_HIGH\"`\n *\n * If both `mediaResolution` and `detail` are provided, `mediaResolution` wins.\n */\n detail?: \"auto\" | \"low\" | \"high\";\n\n /**\n * The number of reasoning tokens that the model should generate.\n * If explicitly set, then the reasoning blocks will be returned.\n */\n maxReasoningTokens?: number;\n\n /**\n * An alias for `maxReasoningTokens` for compatibility.\n */\n thinkingBudget?: number;\n\n /**\n * An alias for `maxReasoningTokens` under Gemini 2.5 or\n * the primary thinking/reasoning setting for Gemini 3.\n * If explicitly set, then the reasoning blocks will be returned.\n */\n reasoningEffort?: GeminiBase.ThinkingLevel;\n\n /**\n * An alias for `reasoningEffort` for compatibility.\n */\n thinkingLevel?: GeminiBase.ThinkingLevel;\n\n /**\n * Inference service tiers.\n * \"priority\" offers highest reliability for higher rates.\n * \"flex\" offers a discount for preemptable processing.\n * Other values are treated as the standard service tier.\n */\n serviceTier?: GeminiBase.ServiceTier;\n\n /**\n * Custom / additional headers to include with every request to the API.\n * When set on both constructor params and per-invocation call options,\n * per-invocation headers take precidence for matching keys.\n */\n customHeaders?: Record<string, string>;\n}\n\nexport type GooglePlatformType = \"gai\" | \"gcp\";\n\n// These are service tiers that we specifically need to send.\n// Other values will be ignored, resulting in the default\n// or \"standard\" setting.\nexport const settableServiceTier: GeminiBase.ServiceTier[] = [\n \"flex\",\n \"priority\",\n];\n\nexport { type Gemini } from \"./api-types.js\";\n\n// There's a fair number of utilities that we need to extract from the base\n// Gemini OpenAPI types, Adding these directly to the base types\n// would pollute the typegen output, so we're adding them here instead.\ndeclare module \"./api-types.js\" {\n export namespace Gemini {\n // Gemini parts are contained as one intersecting type\n // in the spec, so we need to pick out the specific parts we need.\n export namespace Part {\n export type CodeExecutionResult = Pick<\n GeminiBase.Part,\n \"codeExecutionResult\"\n >;\n export type ExecutableCode = Pick<GeminiBase.Part, \"executableCode\">;\n export type FileData = Pick<\n GeminiBase.Part,\n \"fileData\" | \"videoMetadata\"\n >;\n export type FunctionCall = Required<\n Pick<GeminiBase.Part, \"functionCall\">\n > &\n Pick<GeminiBase.Part, \"thoughtSignature\">;\n export type FunctionResponse = Pick<GeminiBase.Part, \"functionResponse\">;\n export type InlineData = Pick<\n GeminiBase.Part,\n \"inlineData\" | \"videoMetadata\"\n >;\n export type MediaResolution = Pick<GeminiBase.Part, \"mediaResolution\">;\n export type PartMetadata = Pick<GeminiBase.Part, \"partMetadata\">;\n export type Text = Pick<GeminiBase.Part, \"text\">;\n export type Thought = Pick<GeminiBase.Part, \"thought\">;\n export type ThoughtSignature = Pick<GeminiBase.Part, \"thoughtSignature\">;\n }\n\n export namespace PrebuiltVoiceConfig {\n /**\n * The name of a prebuilt voice that can be used for speech synthesis.\n *\n * Extracted as a non-nullable type from the GeminiBase.PrebuiltVoiceConfig[\"voiceName\"] property.\n */\n export type VoiceName = NonNullable<\n GeminiBase.PrebuiltVoiceConfig[\"voiceName\"]\n >;\n }\n\n export namespace SpeakerVoiceConfig {\n /**\n * The speaker identifier for a custom or multi-speaker TTS configuration.\n *\n * Extracted as a non-nullable type from the GeminiBase.SpeakerVoiceConfig[\"speaker\"] property.\n */\n export type Speaker = NonNullable<\n GeminiBase.SpeakerVoiceConfig[\"speaker\"]\n >;\n }\n\n export namespace SpeechConfig {\n /**\n * The BCP-47 language code for speech synthesis (e.g., \"en-US\").\n *\n * Extracted as a non-nullable type from the GeminiBase.SpeechConfig[\"languageCode\"] property.\n */\n export type LanguageCode = NonNullable<\n GeminiBase.SpeechConfig[\"languageCode\"]\n >;\n }\n\n /**\n * The level of \"thinking\" or reasoning configured for the model.\n *\n * Extends GeminiBase.ThinkingConfig[\"thinkingLevel\"] to also accept\n * lowercase variants (e.g. \"high\" in addition to \"HIGH\").\n */\n export type ThinkingLevel =\n | GeminiBase.ThinkingConfig[\"thinkingLevel\"]\n | LowercaseLiteral<GeminiBase.ThinkingConfig[\"thinkingLevel\"]>;\n\n /**\n * The role of a content message. The spec types this as `string`, but\n * the API only accepts these specific values.\n */\n export type Role = \"user\" | \"model\" | \"function\";\n\n /**\n * Alias for the unwieldy generated grounding support type name.\n */\n export type GroundingSupport =\n GeminiBase.GoogleAiGenerativelanguageV1betaGroundingSupport;\n\n /**\n * Alias for the unwieldy generated segment type name.\n */\n export type Segment = GeminiBase.GoogleAiGenerativelanguageV1betaSegment;\n\n export namespace Tools {\n /**\n * The mode for function calling configuration, extracted from the\n * FunctionCallingConfig interface.\n */\n export type FunctionCallingConfigMode =\n GeminiBase.Tools.FunctionCallingConfig[\"mode\"];\n }\n\n /**\n * Legacy URL retrieval metadata (predecessor of UrlContextMetadata).\n * Not in the current OpenAPI spec but still returned by the API.\n */\n export interface UrlRetrievalMetadata {\n urlRetrievalContexts?: Array<GeminiBase.UrlMetadata>;\n }\n\n // Augment Candidate with legacy field the API still returns.\n export interface Candidate {\n /** @deprecated Use urlContextMetadata instead. */\n readonly urlRetrievalMetadata?: UrlRetrievalMetadata;\n }\n }\n}\n\n/**\n * Simplified speaker/name pair for multi-speaker config.\n * - `speaker` derived from SpeakerVoiceConfig[\"speaker\"]\n * - `name` is the prebuilt voice name\n */\nexport interface SpeechSpeakerName {\n speaker: GeminiBase.SpeakerVoiceConfig.Speaker;\n name: GeminiBase.PrebuiltVoiceConfig.VoiceName;\n}\n\n/** A voice can be a prebuilt voice name, a speaker/name pair, or an array of pairs */\nexport type SpeechVoice =\n | GeminiBase.PrebuiltVoiceConfig.VoiceName\n | SpeechSpeakerName\n | SpeechSpeakerName[];\n\n/** Voice with language code (derived from SpeechConfig's languageCode) */\nexport interface SpeechVoiceLanguage {\n voice: SpeechVoice;\n languageCode: GeminiBase.SpeechConfig.LanguageCode;\n}\n\n/** Voices with language code */\nexport interface SpeechVoicesLanguage {\n voices: SpeechVoice;\n languageCode: GeminiBase.SpeechConfig.LanguageCode;\n}\n\n/** Simplified language config (with voice or voices) */\nexport type SimplifiedSpeechLanguageConfig =\n | SpeechVoiceLanguage\n | SpeechVoicesLanguage;\n\n/** Top-level simplified config: just a voice, or voice+language */\nexport type SimplifiedSpeechConfig =\n | SpeechVoice\n | SimplifiedSpeechLanguageConfig;\n"],"mappings":";AA2MA,MAAa,sBAAgD,CAC3D,QACA,UACF"}
@@ -95,6 +95,7 @@ var ApiClient = class {
95
95
  * @see {@link GCPCredentials} for service account credential structure
96
96
  */
97
97
  var WebApiClient = class extends ApiClient {
98
+ params;
98
99
  hasApiKey() {
99
100
  return typeof this.apiKey === "string" && this.apiKey !== "";
100
101
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["iife","normalizeGCPCredentials","AuthError","GOOGLE_API_KEY_HEADER","GCP_API_KEY_HEADER","getGCPCredentialsAccessToken"],"sources":["../../src/clients/index.ts"],"sourcesContent":["import { getEnvironmentVariable } from \"@langchain/core/utils/env\";\nimport { GCP_API_KEY_HEADER, GOOGLE_API_KEY_HEADER } from \"../const.js\";\nimport {\n GCPCredentials,\n getGCPCredentialsAccessToken,\n normalizeGCPCredentials,\n} from \"../utils/gcp-auth.js\";\nimport { AuthError } from \"../utils/errors.js\";\nimport { iife } from \"../utils/misc.js\";\n\n/**\n * Abstract base class for API clients that interact with Google services.\n *\n * This class defines the contract for API clients, requiring implementations\n * to provide a fetch method that handles HTTP requests with appropriate\n * authentication headers. Concrete implementations should handle different\n * authentication strategies (API keys, service account credentials, etc.)\n * based on the runtime environment.\n *\n * @abstract\n *\n * @example\n * ```typescript\n * class MyApiClient extends ApiClient {\n * async fetch(request: Request): Promise<Response> {\n * // Add authentication headers\n * request.headers.set('Authorization', 'Bearer token');\n * return fetch(request);\n * }\n * }\n * ```\n */\nexport abstract class ApiClient {\n /**\n * Has an API Key been set for this client?\n */\n abstract hasApiKey(): boolean;\n\n /**\n * For some credential methods, we know what the project ID is.\n * This is necessary for OAuth-based access to Vertex\n */\n async getProjectId(): Promise<string> {\n return \"unknown-project-id\";\n }\n\n /**\n * Executes an HTTP request with appropriate authentication.\n *\n * Implementations should add necessary authentication headers to the request\n * before forwarding it to the underlying fetch implementation.\n *\n * @param request - The HTTP request to execute\n * @returns A Promise that resolves to the HTTP response\n *\n * @abstract\n */\n abstract fetch(request: Request): Promise<Response>;\n}\n\n/**\n * Configuration parameters for the WebApiClient.\n *\n * This interface defines the authentication options available for web-based\n * API clients. Authentication can be provided via an API key or GCP service\n * account credentials. The client will automatically check environment variables\n * if explicit values are not provided.\n *\n * @interface\n */\nexport interface WebApiClientParams {\n /**\n * Google API key for authentication.\n *\n * If not provided, the client will attempt to read from the\n * `GOOGLE_API_KEY` environment variable.\n *\n * @see https://cloud.google.com/docs/authentication/api-keys\n */\n apiKey?: string;\n\n /**\n * GCP service account credentials for authentication.\n *\n * Can be provided as either:\n * - A JSON string containing the service account key\n * - A GCPCredentials object\n *\n * If not provided, the client will attempt to read from the\n * `GOOGLE_CLOUD_CREDENTIALS` environment variable.\n *\n * @see https://cloud.google.com/iam/docs/creating-managing-service-account-keys\n */\n credentials?: string | GCPCredentials;\n\n /**\n * Google Auth options configuration.\n *\n * @deprecated This option is not supported in web environments.\n * Import from `@langchain/google/node` to configure google auth options\n * using the NodeApiClient instead.\n */\n googleAuthOptions?: never;\n}\n\n/**\n * Web-compatible API client for Google services.\n *\n * This client provides authentication for Google API requests in web environments\n * (browsers, edge functions, etc.) where the google-auth-library is not available.\n * It supports two authentication methods:\n *\n * 1. **API Key Authentication**: Simple key-based authentication suitable for\n * public APIs and client-side applications.\n *\n * 2. **Service Account Credentials**: OAuth2-based authentication using GCP\n * service account keys. The client automatically handles token generation\n * and caching.\n *\n * The client follows this authentication priority:\n * 1. Explicit `apiKey` parameter\n * 2. `GOOGLE_API_KEY` environment variable\n * 3. Explicit `credentials` parameter\n * 4. `GOOGLE_CLOUD_CREDENTIALS` environment variable\n *\n * @extends ApiClient\n *\n * @example\n * ```typescript\n * // Using API key\n * const client = new WebApiClient({\n * apiKey: 'your-api-key'\n * });\n *\n * // Using service account credentials\n * const client = new WebApiClient({\n * credentials: {\n * type: \"service_account\",\n * project_id: \"my-project\",\n * private_key_id: \"key-id\",\n * private_key: \"-----BEGIN PRIVATE KEY-----\\n...\",\n * client_email: \"service-account@project.iam.gserviceaccount.com\",\n * // ... other required fields\n * }\n * });\n *\n * // Using environment variables\n * // Set GOOGLE_API_KEY or GOOGLE_CLOUD_CREDENTIALS\n * const client = new WebApiClient({});\n *\n * // Make authenticated requests\n * const request = new Request('https://api.google.com/...');\n * const response = await client.fetch(request);\n * ```\n *\n * @remarks\n * - API keys are added via the `X-Goog-Api-Key` header\n * - Service account tokens are added via the `Authorization` header with Bearer scheme\n * - Tokens are automatically cached and refreshed as needed\n * - For Node.js environments with advanced auth requirements, use NodeApiClient instead\n *\n * @see {@link NodeApiClient} for Node.js-specific authentication options\n * @see {@link GCPCredentials} for service account credential structure\n */\nexport class WebApiClient extends ApiClient {\n hasApiKey(): boolean {\n return typeof this.apiKey === \"string\" && this.apiKey !== \"\";\n }\n\n async getProjectId(): Promise<string> {\n if (typeof this.credentials !== \"undefined\") {\n return this.credentials.project_id;\n } else {\n return super.getProjectId();\n }\n }\n\n /**\n * The Google API key used for authentication, if provided.\n *\n * This value is resolved from either the constructor parameter or the\n * `GOOGLE_API_KEY` environment variable.\n *\n * @protected\n */\n protected apiKey?: string;\n\n /**\n * The normalized GCP service account credentials, if provided.\n *\n * This value is resolved from either the constructor parameter or the\n * `GOOGLE_CLOUD_CREDENTIALS` environment variable, and is normalized\n * to ensure immutability.\n *\n * @protected\n */\n protected credentials?: GCPCredentials;\n\n /**\n * Creates a new WebApiClient instance.\n *\n * The constructor initializes authentication credentials by checking:\n * 1. Explicit parameters passed to the constructor\n * 2. Environment variables (`GOOGLE_API_KEY`, `GOOGLE_CLOUD_CREDENTIALS`)\n *\n * Credentials are normalized and frozen to prevent accidental modification.\n *\n * @param params - Configuration parameters for the client\n *\n * @example\n * ```typescript\n * // Minimal configuration (uses environment variables)\n * const client = new WebApiClient({});\n *\n * // With explicit API key\n * const client = new WebApiClient({\n * apiKey: 'your-api-key'\n * });\n *\n * // With service account credentials as JSON string\n * const client = new WebApiClient({\n * credentials: '{\"type\":\"service_account\",...}'\n * });\n *\n * // With service account credentials as object\n * const client = new WebApiClient({\n * credentials: {\n * type: \"service_account\",\n * // ... other fields\n * }\n * });\n * ```\n */\n constructor(protected params: WebApiClientParams) {\n super();\n this.apiKey = params.apiKey ?? getEnvironmentVariable(\"GOOGLE_API_KEY\");\n this.credentials = iife(() => {\n if (params.credentials) {\n return normalizeGCPCredentials(params.credentials);\n }\n const credentialsVar = getEnvironmentVariable(\"GOOGLE_CLOUD_CREDENTIALS\");\n if (credentialsVar) {\n return normalizeGCPCredentials(credentialsVar);\n }\n return undefined;\n });\n }\n\n /**\n * Executes an HTTP request with appropriate Google API authentication.\n *\n * This method adds authentication headers to the request based on the\n * configured authentication method:\n *\n * - If an API key is configured, adds the `X-Goog-Api-Key` header\n * - If service account credentials are configured, generates an access token\n * and adds it via the `Authorization` header with Bearer scheme\n *\n * The authentication priority is:\n * 1. API key (if provided)\n * 2. Service account credentials (if provided)\n *\n * @param request - The HTTP request to execute. Headers will be modified\n * in-place to include authentication information.\n * @returns A Promise that resolves to the HTTP response\n *\n * @throws {AuthError} If no authentication method is available (neither apiKey\n * nor credentials), or if service account authentication\n * fails (e.g., invalid credentials, network error, or\n * token generation failure)\n *\n * @example\n * ```typescript\n * const client = new WebApiClient({ apiKey: 'your-key' });\n * const request = new Request('https://generativelanguage.googleapis.com/v1/models');\n * const response = await client.fetch(request);\n * const data = await response.json();\n * ```\n *\n * @remarks\n * - The request object is modified in-place by adding headers\n * - Service account tokens are automatically cached and refreshed\n * - If both API key and credentials are provided, API key takes precedence\n */\n async fetch(request: Request): Promise<Response> {\n if (!this.apiKey && !this.credentials) {\n throw new AuthError({\n message:\n \"No authentication method available. Please provide either an apiKey or credentials.\",\n });\n }\n if (this.apiKey) {\n request.headers.set(GOOGLE_API_KEY_HEADER, this.apiKey);\n }\n if (this.credentials) {\n request.headers.set(\n GCP_API_KEY_HEADER,\n `Bearer ${await getGCPCredentialsAccessToken(this.credentials)}`\n );\n }\n return fetch(request);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,IAAsB,YAAtB,MAAgC;;;;;CAU9B,MAAM,eAAgC;AACpC,SAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyHX,IAAa,eAAb,cAAkC,UAAU;CAC1C,YAAqB;AACnB,SAAO,OAAO,KAAK,WAAW,YAAY,KAAK,WAAW;;CAG5D,MAAM,eAAgC;AACpC,MAAI,OAAO,KAAK,gBAAgB,YAC9B,QAAO,KAAK,YAAY;MAExB,QAAO,MAAM,cAAc;;;;;;;;;;CAY/B;;;;;;;;;;CAWA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqCA,YAAY,QAAsC;AAChD,SAAO;AADa,OAAA,SAAA;AAEpB,OAAK,SAAS,OAAO,WAAA,GAAA,0BAAA,wBAAiC,iBAAiB;AACvE,OAAK,cAAcA,aAAAA,WAAW;AAC5B,OAAI,OAAO,YACT,QAAOC,iBAAAA,wBAAwB,OAAO,YAAY;GAEpD,MAAM,kBAAA,GAAA,0BAAA,wBAAwC,2BAA2B;AACzE,OAAI,eACF,QAAOA,iBAAAA,wBAAwB,eAAe;IAGhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuCJ,MAAM,MAAM,SAAqC;AAC/C,MAAI,CAAC,KAAK,UAAU,CAAC,KAAK,YACxB,OAAM,IAAIC,eAAAA,UAAU,EAClB,SACE,uFACH,CAAC;AAEJ,MAAI,KAAK,OACP,SAAQ,QAAQ,IAAIC,cAAAA,uBAAuB,KAAK,OAAO;AAEzD,MAAI,KAAK,YACP,SAAQ,QAAQ,IACdC,cAAAA,oBACA,UAAU,MAAMC,iBAAAA,6BAA6B,KAAK,YAAY,GAC/D;AAEH,SAAO,MAAM,QAAQ"}
1
+ {"version":3,"file":"index.cjs","names":["iife","normalizeGCPCredentials","AuthError","GOOGLE_API_KEY_HEADER","GCP_API_KEY_HEADER","getGCPCredentialsAccessToken"],"sources":["../../src/clients/index.ts"],"sourcesContent":["import { getEnvironmentVariable } from \"@langchain/core/utils/env\";\nimport { GCP_API_KEY_HEADER, GOOGLE_API_KEY_HEADER } from \"../const.js\";\nimport {\n GCPCredentials,\n getGCPCredentialsAccessToken,\n normalizeGCPCredentials,\n} from \"../utils/gcp-auth.js\";\nimport { AuthError } from \"../utils/errors.js\";\nimport { iife } from \"../utils/misc.js\";\n\n/**\n * Abstract base class for API clients that interact with Google services.\n *\n * This class defines the contract for API clients, requiring implementations\n * to provide a fetch method that handles HTTP requests with appropriate\n * authentication headers. Concrete implementations should handle different\n * authentication strategies (API keys, service account credentials, etc.)\n * based on the runtime environment.\n *\n * @abstract\n *\n * @example\n * ```typescript\n * class MyApiClient extends ApiClient {\n * async fetch(request: Request): Promise<Response> {\n * // Add authentication headers\n * request.headers.set('Authorization', 'Bearer token');\n * return fetch(request);\n * }\n * }\n * ```\n */\nexport abstract class ApiClient {\n /**\n * Has an API Key been set for this client?\n */\n abstract hasApiKey(): boolean;\n\n /**\n * For some credential methods, we know what the project ID is.\n * This is necessary for OAuth-based access to Vertex\n */\n async getProjectId(): Promise<string> {\n return \"unknown-project-id\";\n }\n\n /**\n * Executes an HTTP request with appropriate authentication.\n *\n * Implementations should add necessary authentication headers to the request\n * before forwarding it to the underlying fetch implementation.\n *\n * @param request - The HTTP request to execute\n * @returns A Promise that resolves to the HTTP response\n *\n * @abstract\n */\n abstract fetch(request: Request): Promise<Response>;\n}\n\n/**\n * Configuration parameters for the WebApiClient.\n *\n * This interface defines the authentication options available for web-based\n * API clients. Authentication can be provided via an API key or GCP service\n * account credentials. The client will automatically check environment variables\n * if explicit values are not provided.\n *\n * @interface\n */\nexport interface WebApiClientParams {\n /**\n * Google API key for authentication.\n *\n * If not provided, the client will attempt to read from the\n * `GOOGLE_API_KEY` environment variable.\n *\n * @see https://cloud.google.com/docs/authentication/api-keys\n */\n apiKey?: string;\n\n /**\n * GCP service account credentials for authentication.\n *\n * Can be provided as either:\n * - A JSON string containing the service account key\n * - A GCPCredentials object\n *\n * If not provided, the client will attempt to read from the\n * `GOOGLE_CLOUD_CREDENTIALS` environment variable.\n *\n * @see https://cloud.google.com/iam/docs/creating-managing-service-account-keys\n */\n credentials?: string | GCPCredentials;\n\n /**\n * Google Auth options configuration.\n *\n * @deprecated This option is not supported in web environments.\n * Import from `@langchain/google/node` to configure google auth options\n * using the NodeApiClient instead.\n */\n googleAuthOptions?: never;\n}\n\n/**\n * Web-compatible API client for Google services.\n *\n * This client provides authentication for Google API requests in web environments\n * (browsers, edge functions, etc.) where the google-auth-library is not available.\n * It supports two authentication methods:\n *\n * 1. **API Key Authentication**: Simple key-based authentication suitable for\n * public APIs and client-side applications.\n *\n * 2. **Service Account Credentials**: OAuth2-based authentication using GCP\n * service account keys. The client automatically handles token generation\n * and caching.\n *\n * The client follows this authentication priority:\n * 1. Explicit `apiKey` parameter\n * 2. `GOOGLE_API_KEY` environment variable\n * 3. Explicit `credentials` parameter\n * 4. `GOOGLE_CLOUD_CREDENTIALS` environment variable\n *\n * @extends ApiClient\n *\n * @example\n * ```typescript\n * // Using API key\n * const client = new WebApiClient({\n * apiKey: 'your-api-key'\n * });\n *\n * // Using service account credentials\n * const client = new WebApiClient({\n * credentials: {\n * type: \"service_account\",\n * project_id: \"my-project\",\n * private_key_id: \"key-id\",\n * private_key: \"-----BEGIN PRIVATE KEY-----\\n...\",\n * client_email: \"service-account@project.iam.gserviceaccount.com\",\n * // ... other required fields\n * }\n * });\n *\n * // Using environment variables\n * // Set GOOGLE_API_KEY or GOOGLE_CLOUD_CREDENTIALS\n * const client = new WebApiClient({});\n *\n * // Make authenticated requests\n * const request = new Request('https://api.google.com/...');\n * const response = await client.fetch(request);\n * ```\n *\n * @remarks\n * - API keys are added via the `X-Goog-Api-Key` header\n * - Service account tokens are added via the `Authorization` header with Bearer scheme\n * - Tokens are automatically cached and refreshed as needed\n * - For Node.js environments with advanced auth requirements, use NodeApiClient instead\n *\n * @see {@link NodeApiClient} for Node.js-specific authentication options\n * @see {@link GCPCredentials} for service account credential structure\n */\nexport class WebApiClient extends ApiClient {\n hasApiKey(): boolean {\n return typeof this.apiKey === \"string\" && this.apiKey !== \"\";\n }\n\n async getProjectId(): Promise<string> {\n if (typeof this.credentials !== \"undefined\") {\n return this.credentials.project_id;\n } else {\n return super.getProjectId();\n }\n }\n\n /**\n * The Google API key used for authentication, if provided.\n *\n * This value is resolved from either the constructor parameter or the\n * `GOOGLE_API_KEY` environment variable.\n *\n * @protected\n */\n protected apiKey?: string;\n\n /**\n * The normalized GCP service account credentials, if provided.\n *\n * This value is resolved from either the constructor parameter or the\n * `GOOGLE_CLOUD_CREDENTIALS` environment variable, and is normalized\n * to ensure immutability.\n *\n * @protected\n */\n protected credentials?: GCPCredentials;\n\n /**\n * Creates a new WebApiClient instance.\n *\n * The constructor initializes authentication credentials by checking:\n * 1. Explicit parameters passed to the constructor\n * 2. Environment variables (`GOOGLE_API_KEY`, `GOOGLE_CLOUD_CREDENTIALS`)\n *\n * Credentials are normalized and frozen to prevent accidental modification.\n *\n * @param params - Configuration parameters for the client\n *\n * @example\n * ```typescript\n * // Minimal configuration (uses environment variables)\n * const client = new WebApiClient({});\n *\n * // With explicit API key\n * const client = new WebApiClient({\n * apiKey: 'your-api-key'\n * });\n *\n * // With service account credentials as JSON string\n * const client = new WebApiClient({\n * credentials: '{\"type\":\"service_account\",...}'\n * });\n *\n * // With service account credentials as object\n * const client = new WebApiClient({\n * credentials: {\n * type: \"service_account\",\n * // ... other fields\n * }\n * });\n * ```\n */\n constructor(protected params: WebApiClientParams) {\n super();\n this.apiKey = params.apiKey ?? getEnvironmentVariable(\"GOOGLE_API_KEY\");\n this.credentials = iife(() => {\n if (params.credentials) {\n return normalizeGCPCredentials(params.credentials);\n }\n const credentialsVar = getEnvironmentVariable(\"GOOGLE_CLOUD_CREDENTIALS\");\n if (credentialsVar) {\n return normalizeGCPCredentials(credentialsVar);\n }\n return undefined;\n });\n }\n\n /**\n * Executes an HTTP request with appropriate Google API authentication.\n *\n * This method adds authentication headers to the request based on the\n * configured authentication method:\n *\n * - If an API key is configured, adds the `X-Goog-Api-Key` header\n * - If service account credentials are configured, generates an access token\n * and adds it via the `Authorization` header with Bearer scheme\n *\n * The authentication priority is:\n * 1. API key (if provided)\n * 2. Service account credentials (if provided)\n *\n * @param request - The HTTP request to execute. Headers will be modified\n * in-place to include authentication information.\n * @returns A Promise that resolves to the HTTP response\n *\n * @throws {AuthError} If no authentication method is available (neither apiKey\n * nor credentials), or if service account authentication\n * fails (e.g., invalid credentials, network error, or\n * token generation failure)\n *\n * @example\n * ```typescript\n * const client = new WebApiClient({ apiKey: 'your-key' });\n * const request = new Request('https://generativelanguage.googleapis.com/v1/models');\n * const response = await client.fetch(request);\n * const data = await response.json();\n * ```\n *\n * @remarks\n * - The request object is modified in-place by adding headers\n * - Service account tokens are automatically cached and refreshed\n * - If both API key and credentials are provided, API key takes precedence\n */\n async fetch(request: Request): Promise<Response> {\n if (!this.apiKey && !this.credentials) {\n throw new AuthError({\n message:\n \"No authentication method available. Please provide either an apiKey or credentials.\",\n });\n }\n if (this.apiKey) {\n request.headers.set(GOOGLE_API_KEY_HEADER, this.apiKey);\n }\n if (this.credentials) {\n request.headers.set(\n GCP_API_KEY_HEADER,\n `Bearer ${await getGCPCredentialsAccessToken(this.credentials)}`\n );\n }\n return fetch(request);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,IAAsB,YAAtB,MAAgC;;;;;CAU9B,MAAM,eAAgC;EACpC,OAAO;CACT;AAcF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0GA,IAAa,eAAb,cAAkC,UAAU;CAqEpB;CApEtB,YAAqB;EACnB,OAAO,OAAO,KAAK,WAAW,YAAY,KAAK,WAAW;CAC5D;CAEA,MAAM,eAAgC;EACpC,IAAI,OAAO,KAAK,gBAAgB,aAC9B,OAAO,KAAK,YAAY;OAExB,OAAO,MAAM,aAAa;CAE9B;;;;;;;;;CAUA;;;;;;;;;;CAWA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqCA,YAAY,QAAsC;EAChD,MAAM;EADc,KAAA,SAAA;EAEpB,KAAK,SAAS,OAAO,WAAA,GAAA,0BAAA,uBAAA,CAAiC,gBAAgB;EACtE,KAAK,cAAcA,aAAAA,WAAW;GAC5B,IAAI,OAAO,aACT,OAAOC,iBAAAA,wBAAwB,OAAO,WAAW;GAEnD,MAAM,kBAAA,GAAA,0BAAA,uBAAA,CAAwC,0BAA0B;GACxE,IAAI,gBACF,OAAOA,iBAAAA,wBAAwB,cAAc;EAGjD,CAAC;CACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsCA,MAAM,MAAM,SAAqC;EAC/C,IAAI,CAAC,KAAK,UAAU,CAAC,KAAK,aACxB,MAAM,IAAIC,eAAAA,UAAU,EAClB,SACE,sFACJ,CAAC;EAEH,IAAI,KAAK,QACP,QAAQ,QAAQ,IAAIC,cAAAA,uBAAuB,KAAK,MAAM;EAExD,IAAI,KAAK,aACP,QAAQ,QAAQ,IACdC,cAAAA,oBACA,UAAU,MAAMC,iBAAAA,6BAA6B,KAAK,WAAW,GAC/D;EAEF,OAAO,MAAM,OAAO;CACtB;AACF"}
@@ -95,6 +95,7 @@ var ApiClient = class {
95
95
  * @see {@link GCPCredentials} for service account credential structure
96
96
  */
97
97
  var WebApiClient = class extends ApiClient {
98
+ params;
98
99
  hasApiKey() {
99
100
  return typeof this.apiKey === "string" && this.apiKey !== "";
100
101
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/clients/index.ts"],"sourcesContent":["import { getEnvironmentVariable } from \"@langchain/core/utils/env\";\nimport { GCP_API_KEY_HEADER, GOOGLE_API_KEY_HEADER } from \"../const.js\";\nimport {\n GCPCredentials,\n getGCPCredentialsAccessToken,\n normalizeGCPCredentials,\n} from \"../utils/gcp-auth.js\";\nimport { AuthError } from \"../utils/errors.js\";\nimport { iife } from \"../utils/misc.js\";\n\n/**\n * Abstract base class for API clients that interact with Google services.\n *\n * This class defines the contract for API clients, requiring implementations\n * to provide a fetch method that handles HTTP requests with appropriate\n * authentication headers. Concrete implementations should handle different\n * authentication strategies (API keys, service account credentials, etc.)\n * based on the runtime environment.\n *\n * @abstract\n *\n * @example\n * ```typescript\n * class MyApiClient extends ApiClient {\n * async fetch(request: Request): Promise<Response> {\n * // Add authentication headers\n * request.headers.set('Authorization', 'Bearer token');\n * return fetch(request);\n * }\n * }\n * ```\n */\nexport abstract class ApiClient {\n /**\n * Has an API Key been set for this client?\n */\n abstract hasApiKey(): boolean;\n\n /**\n * For some credential methods, we know what the project ID is.\n * This is necessary for OAuth-based access to Vertex\n */\n async getProjectId(): Promise<string> {\n return \"unknown-project-id\";\n }\n\n /**\n * Executes an HTTP request with appropriate authentication.\n *\n * Implementations should add necessary authentication headers to the request\n * before forwarding it to the underlying fetch implementation.\n *\n * @param request - The HTTP request to execute\n * @returns A Promise that resolves to the HTTP response\n *\n * @abstract\n */\n abstract fetch(request: Request): Promise<Response>;\n}\n\n/**\n * Configuration parameters for the WebApiClient.\n *\n * This interface defines the authentication options available for web-based\n * API clients. Authentication can be provided via an API key or GCP service\n * account credentials. The client will automatically check environment variables\n * if explicit values are not provided.\n *\n * @interface\n */\nexport interface WebApiClientParams {\n /**\n * Google API key for authentication.\n *\n * If not provided, the client will attempt to read from the\n * `GOOGLE_API_KEY` environment variable.\n *\n * @see https://cloud.google.com/docs/authentication/api-keys\n */\n apiKey?: string;\n\n /**\n * GCP service account credentials for authentication.\n *\n * Can be provided as either:\n * - A JSON string containing the service account key\n * - A GCPCredentials object\n *\n * If not provided, the client will attempt to read from the\n * `GOOGLE_CLOUD_CREDENTIALS` environment variable.\n *\n * @see https://cloud.google.com/iam/docs/creating-managing-service-account-keys\n */\n credentials?: string | GCPCredentials;\n\n /**\n * Google Auth options configuration.\n *\n * @deprecated This option is not supported in web environments.\n * Import from `@langchain/google/node` to configure google auth options\n * using the NodeApiClient instead.\n */\n googleAuthOptions?: never;\n}\n\n/**\n * Web-compatible API client for Google services.\n *\n * This client provides authentication for Google API requests in web environments\n * (browsers, edge functions, etc.) where the google-auth-library is not available.\n * It supports two authentication methods:\n *\n * 1. **API Key Authentication**: Simple key-based authentication suitable for\n * public APIs and client-side applications.\n *\n * 2. **Service Account Credentials**: OAuth2-based authentication using GCP\n * service account keys. The client automatically handles token generation\n * and caching.\n *\n * The client follows this authentication priority:\n * 1. Explicit `apiKey` parameter\n * 2. `GOOGLE_API_KEY` environment variable\n * 3. Explicit `credentials` parameter\n * 4. `GOOGLE_CLOUD_CREDENTIALS` environment variable\n *\n * @extends ApiClient\n *\n * @example\n * ```typescript\n * // Using API key\n * const client = new WebApiClient({\n * apiKey: 'your-api-key'\n * });\n *\n * // Using service account credentials\n * const client = new WebApiClient({\n * credentials: {\n * type: \"service_account\",\n * project_id: \"my-project\",\n * private_key_id: \"key-id\",\n * private_key: \"-----BEGIN PRIVATE KEY-----\\n...\",\n * client_email: \"service-account@project.iam.gserviceaccount.com\",\n * // ... other required fields\n * }\n * });\n *\n * // Using environment variables\n * // Set GOOGLE_API_KEY or GOOGLE_CLOUD_CREDENTIALS\n * const client = new WebApiClient({});\n *\n * // Make authenticated requests\n * const request = new Request('https://api.google.com/...');\n * const response = await client.fetch(request);\n * ```\n *\n * @remarks\n * - API keys are added via the `X-Goog-Api-Key` header\n * - Service account tokens are added via the `Authorization` header with Bearer scheme\n * - Tokens are automatically cached and refreshed as needed\n * - For Node.js environments with advanced auth requirements, use NodeApiClient instead\n *\n * @see {@link NodeApiClient} for Node.js-specific authentication options\n * @see {@link GCPCredentials} for service account credential structure\n */\nexport class WebApiClient extends ApiClient {\n hasApiKey(): boolean {\n return typeof this.apiKey === \"string\" && this.apiKey !== \"\";\n }\n\n async getProjectId(): Promise<string> {\n if (typeof this.credentials !== \"undefined\") {\n return this.credentials.project_id;\n } else {\n return super.getProjectId();\n }\n }\n\n /**\n * The Google API key used for authentication, if provided.\n *\n * This value is resolved from either the constructor parameter or the\n * `GOOGLE_API_KEY` environment variable.\n *\n * @protected\n */\n protected apiKey?: string;\n\n /**\n * The normalized GCP service account credentials, if provided.\n *\n * This value is resolved from either the constructor parameter or the\n * `GOOGLE_CLOUD_CREDENTIALS` environment variable, and is normalized\n * to ensure immutability.\n *\n * @protected\n */\n protected credentials?: GCPCredentials;\n\n /**\n * Creates a new WebApiClient instance.\n *\n * The constructor initializes authentication credentials by checking:\n * 1. Explicit parameters passed to the constructor\n * 2. Environment variables (`GOOGLE_API_KEY`, `GOOGLE_CLOUD_CREDENTIALS`)\n *\n * Credentials are normalized and frozen to prevent accidental modification.\n *\n * @param params - Configuration parameters for the client\n *\n * @example\n * ```typescript\n * // Minimal configuration (uses environment variables)\n * const client = new WebApiClient({});\n *\n * // With explicit API key\n * const client = new WebApiClient({\n * apiKey: 'your-api-key'\n * });\n *\n * // With service account credentials as JSON string\n * const client = new WebApiClient({\n * credentials: '{\"type\":\"service_account\",...}'\n * });\n *\n * // With service account credentials as object\n * const client = new WebApiClient({\n * credentials: {\n * type: \"service_account\",\n * // ... other fields\n * }\n * });\n * ```\n */\n constructor(protected params: WebApiClientParams) {\n super();\n this.apiKey = params.apiKey ?? getEnvironmentVariable(\"GOOGLE_API_KEY\");\n this.credentials = iife(() => {\n if (params.credentials) {\n return normalizeGCPCredentials(params.credentials);\n }\n const credentialsVar = getEnvironmentVariable(\"GOOGLE_CLOUD_CREDENTIALS\");\n if (credentialsVar) {\n return normalizeGCPCredentials(credentialsVar);\n }\n return undefined;\n });\n }\n\n /**\n * Executes an HTTP request with appropriate Google API authentication.\n *\n * This method adds authentication headers to the request based on the\n * configured authentication method:\n *\n * - If an API key is configured, adds the `X-Goog-Api-Key` header\n * - If service account credentials are configured, generates an access token\n * and adds it via the `Authorization` header with Bearer scheme\n *\n * The authentication priority is:\n * 1. API key (if provided)\n * 2. Service account credentials (if provided)\n *\n * @param request - The HTTP request to execute. Headers will be modified\n * in-place to include authentication information.\n * @returns A Promise that resolves to the HTTP response\n *\n * @throws {AuthError} If no authentication method is available (neither apiKey\n * nor credentials), or if service account authentication\n * fails (e.g., invalid credentials, network error, or\n * token generation failure)\n *\n * @example\n * ```typescript\n * const client = new WebApiClient({ apiKey: 'your-key' });\n * const request = new Request('https://generativelanguage.googleapis.com/v1/models');\n * const response = await client.fetch(request);\n * const data = await response.json();\n * ```\n *\n * @remarks\n * - The request object is modified in-place by adding headers\n * - Service account tokens are automatically cached and refreshed\n * - If both API key and credentials are provided, API key takes precedence\n */\n async fetch(request: Request): Promise<Response> {\n if (!this.apiKey && !this.credentials) {\n throw new AuthError({\n message:\n \"No authentication method available. Please provide either an apiKey or credentials.\",\n });\n }\n if (this.apiKey) {\n request.headers.set(GOOGLE_API_KEY_HEADER, this.apiKey);\n }\n if (this.credentials) {\n request.headers.set(\n GCP_API_KEY_HEADER,\n `Bearer ${await getGCPCredentialsAccessToken(this.credentials)}`\n );\n }\n return fetch(request);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,IAAsB,YAAtB,MAAgC;;;;;CAU9B,MAAM,eAAgC;AACpC,SAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyHX,IAAa,eAAb,cAAkC,UAAU;CAC1C,YAAqB;AACnB,SAAO,OAAO,KAAK,WAAW,YAAY,KAAK,WAAW;;CAG5D,MAAM,eAAgC;AACpC,MAAI,OAAO,KAAK,gBAAgB,YAC9B,QAAO,KAAK,YAAY;MAExB,QAAO,MAAM,cAAc;;;;;;;;;;CAY/B;;;;;;;;;;CAWA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqCA,YAAY,QAAsC;AAChD,SAAO;AADa,OAAA,SAAA;AAEpB,OAAK,SAAS,OAAO,UAAU,uBAAuB,iBAAiB;AACvE,OAAK,cAAc,WAAW;AAC5B,OAAI,OAAO,YACT,QAAO,wBAAwB,OAAO,YAAY;GAEpD,MAAM,iBAAiB,uBAAuB,2BAA2B;AACzE,OAAI,eACF,QAAO,wBAAwB,eAAe;IAGhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuCJ,MAAM,MAAM,SAAqC;AAC/C,MAAI,CAAC,KAAK,UAAU,CAAC,KAAK,YACxB,OAAM,IAAI,UAAU,EAClB,SACE,uFACH,CAAC;AAEJ,MAAI,KAAK,OACP,SAAQ,QAAQ,IAAI,uBAAuB,KAAK,OAAO;AAEzD,MAAI,KAAK,YACP,SAAQ,QAAQ,IACd,oBACA,UAAU,MAAM,6BAA6B,KAAK,YAAY,GAC/D;AAEH,SAAO,MAAM,QAAQ"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/clients/index.ts"],"sourcesContent":["import { getEnvironmentVariable } from \"@langchain/core/utils/env\";\nimport { GCP_API_KEY_HEADER, GOOGLE_API_KEY_HEADER } from \"../const.js\";\nimport {\n GCPCredentials,\n getGCPCredentialsAccessToken,\n normalizeGCPCredentials,\n} from \"../utils/gcp-auth.js\";\nimport { AuthError } from \"../utils/errors.js\";\nimport { iife } from \"../utils/misc.js\";\n\n/**\n * Abstract base class for API clients that interact with Google services.\n *\n * This class defines the contract for API clients, requiring implementations\n * to provide a fetch method that handles HTTP requests with appropriate\n * authentication headers. Concrete implementations should handle different\n * authentication strategies (API keys, service account credentials, etc.)\n * based on the runtime environment.\n *\n * @abstract\n *\n * @example\n * ```typescript\n * class MyApiClient extends ApiClient {\n * async fetch(request: Request): Promise<Response> {\n * // Add authentication headers\n * request.headers.set('Authorization', 'Bearer token');\n * return fetch(request);\n * }\n * }\n * ```\n */\nexport abstract class ApiClient {\n /**\n * Has an API Key been set for this client?\n */\n abstract hasApiKey(): boolean;\n\n /**\n * For some credential methods, we know what the project ID is.\n * This is necessary for OAuth-based access to Vertex\n */\n async getProjectId(): Promise<string> {\n return \"unknown-project-id\";\n }\n\n /**\n * Executes an HTTP request with appropriate authentication.\n *\n * Implementations should add necessary authentication headers to the request\n * before forwarding it to the underlying fetch implementation.\n *\n * @param request - The HTTP request to execute\n * @returns A Promise that resolves to the HTTP response\n *\n * @abstract\n */\n abstract fetch(request: Request): Promise<Response>;\n}\n\n/**\n * Configuration parameters for the WebApiClient.\n *\n * This interface defines the authentication options available for web-based\n * API clients. Authentication can be provided via an API key or GCP service\n * account credentials. The client will automatically check environment variables\n * if explicit values are not provided.\n *\n * @interface\n */\nexport interface WebApiClientParams {\n /**\n * Google API key for authentication.\n *\n * If not provided, the client will attempt to read from the\n * `GOOGLE_API_KEY` environment variable.\n *\n * @see https://cloud.google.com/docs/authentication/api-keys\n */\n apiKey?: string;\n\n /**\n * GCP service account credentials for authentication.\n *\n * Can be provided as either:\n * - A JSON string containing the service account key\n * - A GCPCredentials object\n *\n * If not provided, the client will attempt to read from the\n * `GOOGLE_CLOUD_CREDENTIALS` environment variable.\n *\n * @see https://cloud.google.com/iam/docs/creating-managing-service-account-keys\n */\n credentials?: string | GCPCredentials;\n\n /**\n * Google Auth options configuration.\n *\n * @deprecated This option is not supported in web environments.\n * Import from `@langchain/google/node` to configure google auth options\n * using the NodeApiClient instead.\n */\n googleAuthOptions?: never;\n}\n\n/**\n * Web-compatible API client for Google services.\n *\n * This client provides authentication for Google API requests in web environments\n * (browsers, edge functions, etc.) where the google-auth-library is not available.\n * It supports two authentication methods:\n *\n * 1. **API Key Authentication**: Simple key-based authentication suitable for\n * public APIs and client-side applications.\n *\n * 2. **Service Account Credentials**: OAuth2-based authentication using GCP\n * service account keys. The client automatically handles token generation\n * and caching.\n *\n * The client follows this authentication priority:\n * 1. Explicit `apiKey` parameter\n * 2. `GOOGLE_API_KEY` environment variable\n * 3. Explicit `credentials` parameter\n * 4. `GOOGLE_CLOUD_CREDENTIALS` environment variable\n *\n * @extends ApiClient\n *\n * @example\n * ```typescript\n * // Using API key\n * const client = new WebApiClient({\n * apiKey: 'your-api-key'\n * });\n *\n * // Using service account credentials\n * const client = new WebApiClient({\n * credentials: {\n * type: \"service_account\",\n * project_id: \"my-project\",\n * private_key_id: \"key-id\",\n * private_key: \"-----BEGIN PRIVATE KEY-----\\n...\",\n * client_email: \"service-account@project.iam.gserviceaccount.com\",\n * // ... other required fields\n * }\n * });\n *\n * // Using environment variables\n * // Set GOOGLE_API_KEY or GOOGLE_CLOUD_CREDENTIALS\n * const client = new WebApiClient({});\n *\n * // Make authenticated requests\n * const request = new Request('https://api.google.com/...');\n * const response = await client.fetch(request);\n * ```\n *\n * @remarks\n * - API keys are added via the `X-Goog-Api-Key` header\n * - Service account tokens are added via the `Authorization` header with Bearer scheme\n * - Tokens are automatically cached and refreshed as needed\n * - For Node.js environments with advanced auth requirements, use NodeApiClient instead\n *\n * @see {@link NodeApiClient} for Node.js-specific authentication options\n * @see {@link GCPCredentials} for service account credential structure\n */\nexport class WebApiClient extends ApiClient {\n hasApiKey(): boolean {\n return typeof this.apiKey === \"string\" && this.apiKey !== \"\";\n }\n\n async getProjectId(): Promise<string> {\n if (typeof this.credentials !== \"undefined\") {\n return this.credentials.project_id;\n } else {\n return super.getProjectId();\n }\n }\n\n /**\n * The Google API key used for authentication, if provided.\n *\n * This value is resolved from either the constructor parameter or the\n * `GOOGLE_API_KEY` environment variable.\n *\n * @protected\n */\n protected apiKey?: string;\n\n /**\n * The normalized GCP service account credentials, if provided.\n *\n * This value is resolved from either the constructor parameter or the\n * `GOOGLE_CLOUD_CREDENTIALS` environment variable, and is normalized\n * to ensure immutability.\n *\n * @protected\n */\n protected credentials?: GCPCredentials;\n\n /**\n * Creates a new WebApiClient instance.\n *\n * The constructor initializes authentication credentials by checking:\n * 1. Explicit parameters passed to the constructor\n * 2. Environment variables (`GOOGLE_API_KEY`, `GOOGLE_CLOUD_CREDENTIALS`)\n *\n * Credentials are normalized and frozen to prevent accidental modification.\n *\n * @param params - Configuration parameters for the client\n *\n * @example\n * ```typescript\n * // Minimal configuration (uses environment variables)\n * const client = new WebApiClient({});\n *\n * // With explicit API key\n * const client = new WebApiClient({\n * apiKey: 'your-api-key'\n * });\n *\n * // With service account credentials as JSON string\n * const client = new WebApiClient({\n * credentials: '{\"type\":\"service_account\",...}'\n * });\n *\n * // With service account credentials as object\n * const client = new WebApiClient({\n * credentials: {\n * type: \"service_account\",\n * // ... other fields\n * }\n * });\n * ```\n */\n constructor(protected params: WebApiClientParams) {\n super();\n this.apiKey = params.apiKey ?? getEnvironmentVariable(\"GOOGLE_API_KEY\");\n this.credentials = iife(() => {\n if (params.credentials) {\n return normalizeGCPCredentials(params.credentials);\n }\n const credentialsVar = getEnvironmentVariable(\"GOOGLE_CLOUD_CREDENTIALS\");\n if (credentialsVar) {\n return normalizeGCPCredentials(credentialsVar);\n }\n return undefined;\n });\n }\n\n /**\n * Executes an HTTP request with appropriate Google API authentication.\n *\n * This method adds authentication headers to the request based on the\n * configured authentication method:\n *\n * - If an API key is configured, adds the `X-Goog-Api-Key` header\n * - If service account credentials are configured, generates an access token\n * and adds it via the `Authorization` header with Bearer scheme\n *\n * The authentication priority is:\n * 1. API key (if provided)\n * 2. Service account credentials (if provided)\n *\n * @param request - The HTTP request to execute. Headers will be modified\n * in-place to include authentication information.\n * @returns A Promise that resolves to the HTTP response\n *\n * @throws {AuthError} If no authentication method is available (neither apiKey\n * nor credentials), or if service account authentication\n * fails (e.g., invalid credentials, network error, or\n * token generation failure)\n *\n * @example\n * ```typescript\n * const client = new WebApiClient({ apiKey: 'your-key' });\n * const request = new Request('https://generativelanguage.googleapis.com/v1/models');\n * const response = await client.fetch(request);\n * const data = await response.json();\n * ```\n *\n * @remarks\n * - The request object is modified in-place by adding headers\n * - Service account tokens are automatically cached and refreshed\n * - If both API key and credentials are provided, API key takes precedence\n */\n async fetch(request: Request): Promise<Response> {\n if (!this.apiKey && !this.credentials) {\n throw new AuthError({\n message:\n \"No authentication method available. Please provide either an apiKey or credentials.\",\n });\n }\n if (this.apiKey) {\n request.headers.set(GOOGLE_API_KEY_HEADER, this.apiKey);\n }\n if (this.credentials) {\n request.headers.set(\n GCP_API_KEY_HEADER,\n `Bearer ${await getGCPCredentialsAccessToken(this.credentials)}`\n );\n }\n return fetch(request);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,IAAsB,YAAtB,MAAgC;;;;;CAU9B,MAAM,eAAgC;EACpC,OAAO;CACT;AAcF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0GA,IAAa,eAAb,cAAkC,UAAU;CAqEpB;CApEtB,YAAqB;EACnB,OAAO,OAAO,KAAK,WAAW,YAAY,KAAK,WAAW;CAC5D;CAEA,MAAM,eAAgC;EACpC,IAAI,OAAO,KAAK,gBAAgB,aAC9B,OAAO,KAAK,YAAY;OAExB,OAAO,MAAM,aAAa;CAE9B;;;;;;;;;CAUA;;;;;;;;;;CAWA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqCA,YAAY,QAAsC;EAChD,MAAM;EADc,KAAA,SAAA;EAEpB,KAAK,SAAS,OAAO,UAAU,uBAAuB,gBAAgB;EACtE,KAAK,cAAc,WAAW;GAC5B,IAAI,OAAO,aACT,OAAO,wBAAwB,OAAO,WAAW;GAEnD,MAAM,iBAAiB,uBAAuB,0BAA0B;GACxE,IAAI,gBACF,OAAO,wBAAwB,cAAc;EAGjD,CAAC;CACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsCA,MAAM,MAAM,SAAqC;EAC/C,IAAI,CAAC,KAAK,UAAU,CAAC,KAAK,aACxB,MAAM,IAAI,UAAU,EAClB,SACE,sFACJ,CAAC;EAEH,IAAI,KAAK,QACP,QAAQ,QAAQ,IAAI,uBAAuB,KAAK,MAAM;EAExD,IAAI,KAAK,aACP,QAAQ,QAAQ,IACd,oBACA,UAAU,MAAM,6BAA6B,KAAK,WAAW,GAC/D;EAEF,OAAO,MAAM,OAAO;CACtB;AACF"}
@@ -87,6 +87,7 @@ let google_auth_library = require("google-auth-library");
87
87
  * @see {@link GoogleAuthOptions} for advanced authentication configuration
88
88
  */
89
89
  var NodeApiClient = class extends require_index.ApiClient {
90
+ params;
90
91
  hasApiKey() {
91
92
  return typeof this.apiKey === "string" && this.apiKey !== "";
92
93
  }