@langchain/google-common 2.1.26-dev-1773962633795 → 2.1.27

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 (60) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/auth.cjs.map +1 -1
  3. package/dist/auth.d.cts.map +1 -1
  4. package/dist/auth.d.ts.map +1 -1
  5. package/dist/auth.js.map +1 -1
  6. package/dist/chat_models.cjs +1 -1
  7. package/dist/chat_models.cjs.map +1 -1
  8. package/dist/chat_models.js +1 -1
  9. package/dist/chat_models.js.map +1 -1
  10. package/dist/connection.cjs.map +1 -1
  11. package/dist/connection.js.map +1 -1
  12. package/dist/experimental/media.cjs.map +1 -1
  13. package/dist/experimental/media.js.map +1 -1
  14. package/dist/experimental/utils/media_core.cjs.map +1 -1
  15. package/dist/experimental/utils/media_core.js.map +1 -1
  16. package/dist/llms.cjs +1 -1
  17. package/dist/llms.cjs.map +1 -1
  18. package/dist/llms.js +1 -1
  19. package/dist/llms.js.map +1 -1
  20. package/dist/types.cjs.map +1 -1
  21. package/dist/types.d.cts +1 -1
  22. package/dist/types.d.cts.map +1 -1
  23. package/dist/types.d.ts +1 -1
  24. package/dist/types.d.ts.map +1 -1
  25. package/dist/types.js.map +1 -1
  26. package/dist/utils/anthropic.cjs.map +1 -1
  27. package/dist/utils/anthropic.js.map +1 -1
  28. package/dist/utils/common.cjs.map +1 -1
  29. package/dist/utils/common.js.map +1 -1
  30. package/dist/utils/failed_handler.cjs.map +1 -1
  31. package/dist/utils/failed_handler.js.map +1 -1
  32. package/dist/utils/gemini.cjs +1 -0
  33. package/dist/utils/gemini.cjs.map +1 -1
  34. package/dist/utils/gemini.d.cts.map +1 -1
  35. package/dist/utils/gemini.d.ts.map +1 -1
  36. package/dist/utils/gemini.js +1 -0
  37. package/dist/utils/gemini.js.map +1 -1
  38. package/dist/utils/safety.cjs.map +1 -1
  39. package/dist/utils/safety.js.map +1 -1
  40. package/dist/utils/stream.cjs.map +1 -1
  41. package/dist/utils/stream.js.map +1 -1
  42. package/dist/utils/zod_to_gemini_parameters.cjs.map +1 -1
  43. package/dist/utils/zod_to_gemini_parameters.js.map +1 -1
  44. package/experimental/media.cjs +1 -0
  45. package/experimental/media.d.cts +1 -0
  46. package/experimental/media.d.ts +1 -0
  47. package/experimental/media.js +1 -0
  48. package/experimental/utils/media_core.cjs +1 -0
  49. package/experimental/utils/media_core.d.cts +1 -0
  50. package/experimental/utils/media_core.d.ts +1 -0
  51. package/experimental/utils/media_core.js +1 -0
  52. package/package.json +5 -14
  53. package/types.cjs +1 -0
  54. package/types.d.cts +1 -0
  55. package/types.d.ts +1 -0
  56. package/types.js +1 -0
  57. package/utils.cjs +1 -0
  58. package/utils.d.cts +1 -0
  59. package/utils.d.ts +1 -0
  60. package/utils.js +1 -0
@@ -1 +1 @@
1
- {"version":3,"file":"media_core.js","names":[],"sources":["../../../src/experimental/utils/media_core.ts"],"sourcesContent":["import { v1, v4 } from \"uuid\"; // FIXME - it is importing the wrong uuid, so v6 and v7 aren't implemented\nimport { BaseStore } from \"@langchain/core/stores\";\nimport { Serializable } from \"@langchain/core/load/serializable\";\n\nexport type MediaBlobData = {\n value: string; // In Base64 encoding\n type: string; // The mime type and possibly encoding\n};\n\nexport interface MediaBlobParameters {\n data?: MediaBlobData;\n\n metadata?: Record<string, unknown>;\n\n path?: string;\n}\n\nfunction bytesToString(dataArray: Uint8Array): string {\n // Need to handle the array in smaller chunks to deal with stack size limits\n let ret = \"\";\n const chunkSize = 102400;\n for (let i = 0; i < dataArray.length; i += chunkSize) {\n const chunk = dataArray.subarray(i, i + chunkSize);\n ret += String.fromCharCode(...chunk);\n }\n\n return ret;\n}\n\n/**\n * Represents a chunk of data that can be identified by the path where the\n * data is (or will be) located, along with optional metadata about the data.\n */\nexport class MediaBlob extends Serializable implements MediaBlobParameters {\n lc_serializable = true;\n\n lc_namespace = [\n \"langchain\",\n \"google_common\",\n \"experimental\",\n \"utils\",\n \"media_core\",\n ];\n\n data: MediaBlobData = {\n value: \"\",\n type: \"text/plain\",\n };\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n metadata?: Record<string, any>;\n\n path?: string;\n\n constructor(params: MediaBlobParameters) {\n super(params);\n\n this.data = params.data ?? this.data;\n this.metadata = params.metadata;\n this.path = params.path;\n }\n\n get size(): number {\n return this.asBytes.length;\n }\n\n get dataType(): string {\n return this.data?.type ?? \"\";\n }\n\n get encoding(): string {\n const charsetEquals = this.dataType.indexOf(\"charset=\");\n return charsetEquals === -1\n ? \"utf-8\"\n : this.dataType.substring(charsetEquals + 8);\n }\n\n get mimetype(): string {\n const semicolon = this.dataType.indexOf(\";\");\n return semicolon === -1\n ? this.dataType\n : this.dataType.substring(0, semicolon);\n }\n\n get asBytes(): Uint8Array {\n if (!this.data) {\n return Uint8Array.from([]);\n }\n const binString = atob(this.data?.value);\n const ret = new Uint8Array(binString.length);\n for (let co = 0; co < binString.length; co += 1) {\n ret[co] = binString.charCodeAt(co);\n }\n return ret;\n }\n\n async asString(): Promise<string> {\n return bytesToString(this.asBytes);\n }\n\n async asBase64(): Promise<string> {\n return this.data?.value ?? \"\";\n }\n\n async asDataUrl(): Promise<string> {\n return `data:${this.mimetype};base64,${await this.asBase64()}`;\n }\n\n async asUri(): Promise<string> {\n return this.path ?? (await this.asDataUrl());\n }\n\n async encode(): Promise<{ encoded: string; encoding: string }> {\n const dataUrl = await this.asDataUrl();\n const comma = dataUrl.indexOf(\",\");\n const encoded = dataUrl.substring(comma + 1);\n const encoding: string = dataUrl.indexOf(\"base64\") > -1 ? \"base64\" : \"8bit\";\n return {\n encoded,\n encoding,\n };\n }\n\n static fromDataUrl(url: string): MediaBlob {\n if (!url.startsWith(\"data:\")) {\n throw new Error(\"Not a data: URL\");\n }\n const colon = url.indexOf(\":\");\n const semicolon = url.indexOf(\";\");\n const mimeType = url.substring(colon + 1, semicolon);\n\n const comma = url.indexOf(\",\");\n const base64Data = url.substring(comma + 1);\n\n const data: MediaBlobData = {\n type: mimeType,\n value: base64Data,\n };\n\n return new MediaBlob({\n data,\n path: url,\n });\n }\n\n static async fromBlob(\n blob: Blob,\n other?: Omit<MediaBlobParameters, \"data\">\n ): Promise<MediaBlob> {\n const valueBuffer = await blob.arrayBuffer();\n const valueArray = new Uint8Array(valueBuffer);\n const valueStr = bytesToString(valueArray);\n const value = btoa(valueStr);\n\n return new MediaBlob({\n ...other,\n data: {\n value,\n type: blob.type,\n },\n });\n }\n}\n\nexport type ActionIfInvalidAction =\n | \"ignore\"\n | \"prefixPath\"\n | \"prefixUuid1\"\n | \"prefixUuid4\"\n | \"prefixUuid6\"\n | \"prefixUuid7\"\n | \"removePath\";\n\nexport interface BlobStoreStoreOptions {\n /**\n * If the path is missing or invalid in the blob, how should we create\n * a new path?\n * Subclasses may define their own methods, but the following are supported\n * by default:\n * - Undefined or an emtpy string: Reject the blob\n * - \"ignore\": Attempt to store it anyway (but this may fail)\n * - \"prefixPath\": Use the default prefix for the BlobStore and get the\n * unique portion from the URL. The original path is stored in the metadata\n * - \"prefixUuid\": Use the default prefix for the BlobStore and get the\n * unique portion from a generated UUID. The original path is stored\n * in the metadata\n */\n actionIfInvalid?: ActionIfInvalidAction;\n\n /**\n * The expected prefix for URIs that are stored.\n * This may be used to test if a MediaBlob is valid and used to create a new\n * path if \"prefixPath\" or \"prefixUuid\" is set for actionIfInvalid.\n */\n pathPrefix?: string;\n}\n\nexport type ActionIfBlobMissingAction = \"emptyBlob\";\n\nexport interface BlobStoreFetchOptions {\n /**\n * If the blob is not found when fetching, what should we do?\n * Subclasses may define their own methods, but the following are supported\n * by default:\n * - Undefined or an empty string: return undefined\n * - \"emptyBlob\": return a new MediaBlob that has the path set, but nothing else.\n */\n actionIfBlobMissing?: ActionIfBlobMissingAction;\n}\n\nexport interface BlobStoreOptions {\n defaultStoreOptions?: BlobStoreStoreOptions;\n\n defaultFetchOptions?: BlobStoreFetchOptions;\n}\n\n/**\n * A specialized Store that is designed to handle MediaBlobs and use the\n * key that is included in the blob to determine exactly how it is stored.\n *\n * The full details of a MediaBlob may be changed when it is stored.\n * For example, it may get additional or different Metadata. This should be\n * what is returned when the store() method is called.\n *\n * Although BlobStore extends BaseStore, not all of the methods from\n * BaseStore may be implemented (or even possible). Those that are not\n * implemented should be documented and throw an Error if called.\n */\nexport abstract class BlobStore extends BaseStore<string, MediaBlob> {\n lc_namespace = [\"langchain\", \"google-common\"]; // FIXME - What should this be? And why?\n\n defaultStoreOptions: BlobStoreStoreOptions;\n\n defaultFetchOptions: BlobStoreFetchOptions;\n\n constructor(opts?: BlobStoreOptions) {\n super(opts);\n this.defaultStoreOptions = opts?.defaultStoreOptions ?? {};\n this.defaultFetchOptions = opts?.defaultFetchOptions ?? {};\n }\n\n protected async _realKey(key: string | MediaBlob): Promise<string> {\n return typeof key === \"string\" ? key : await key.asUri();\n }\n\n /**\n * Is the path supported by this BlobStore?\n *\n * Although this is async, this is expected to be a relatively fast operation\n * (ie - you shouldn't make network calls).\n *\n * @param path The path to check\n * @param opts Any options (if needed) that may be used to determine if it is valid\n * @return If the path is supported\n */\n hasValidPath(\n path: string | undefined,\n opts?: BlobStoreStoreOptions\n ): Promise<boolean> {\n const prefix = opts?.pathPrefix ?? \"\";\n const isPrefixed = typeof path !== \"undefined\" && path.startsWith(prefix);\n return Promise.resolve(isPrefixed);\n }\n\n protected _blobPathSuffix(blob: MediaBlob): string {\n // Get the path currently set and make sure we treat it as a string\n const blobPath = `${blob.path}`;\n\n // Advance past the first set of /\n let pathStart = blobPath.indexOf(\"/\") + 1;\n while (blobPath.charAt(pathStart) === \"/\") {\n pathStart += 1;\n }\n\n // We will use the rest as the path for a replacement\n return blobPath.substring(pathStart);\n }\n\n protected async _newBlob(\n oldBlob: MediaBlob,\n newPath?: string\n ): Promise<MediaBlob> {\n const oldPath = oldBlob.path;\n const metadata = oldBlob?.metadata ?? {};\n metadata.langchainOldPath = oldPath;\n const newBlob = new MediaBlob({\n ...oldBlob,\n metadata,\n });\n if (newPath) {\n newBlob.path = newPath;\n } else if (newBlob.path) {\n delete newBlob.path;\n }\n return newBlob;\n }\n\n protected async _validBlobPrefixPath(\n blob: MediaBlob,\n opts?: BlobStoreStoreOptions\n ): Promise<MediaBlob> {\n const prefix = opts?.pathPrefix ?? \"\";\n const suffix = this._blobPathSuffix(blob);\n const newPath = `${prefix}${suffix}`;\n return this._newBlob(blob, newPath);\n }\n\n protected _validBlobPrefixUuidFunction(\n name: ActionIfInvalidAction | string\n ): string {\n switch (name) {\n case \"prefixUuid1\":\n return v1();\n case \"prefixUuid4\":\n return v4();\n // case \"prefixUuid6\": return v6();\n // case \"prefixUuid7\": return v7();\n default:\n throw new Error(`Unknown uuid function: ${name}`);\n }\n }\n\n protected async _validBlobPrefixUuid(\n blob: MediaBlob,\n opts?: BlobStoreStoreOptions\n ): Promise<MediaBlob> {\n const prefix = opts?.pathPrefix ?? \"\";\n const suffix = this._validBlobPrefixUuidFunction(\n opts?.actionIfInvalid ?? \"prefixUuid4\"\n );\n const newPath = `${prefix}${suffix}`;\n return this._newBlob(blob, newPath);\n }\n\n protected async _validBlobRemovePath(\n blob: MediaBlob,\n _opts?: BlobStoreStoreOptions\n ): Promise<MediaBlob> {\n return this._newBlob(blob, undefined);\n }\n\n /**\n * Based on the blob and options, return a blob that has a valid path\n * that can be saved.\n * @param blob\n * @param opts\n */\n protected async _validStoreBlob(\n blob: MediaBlob,\n opts?: BlobStoreStoreOptions\n ): Promise<MediaBlob | undefined> {\n if (await this.hasValidPath(blob.path, opts)) {\n return blob;\n }\n switch (opts?.actionIfInvalid) {\n case \"ignore\":\n return blob;\n case \"prefixPath\":\n return this._validBlobPrefixPath(blob, opts);\n case \"prefixUuid1\":\n case \"prefixUuid4\":\n case \"prefixUuid6\":\n case \"prefixUuid7\":\n return this._validBlobPrefixUuid(blob, opts);\n case \"removePath\":\n return this._validBlobRemovePath(blob, opts);\n default:\n return undefined;\n }\n }\n\n async store(\n blob: MediaBlob,\n opts: BlobStoreStoreOptions = {}\n ): Promise<MediaBlob | undefined> {\n const allOpts: BlobStoreStoreOptions = {\n ...this.defaultStoreOptions,\n ...opts,\n };\n const validBlob = await this._validStoreBlob(blob, allOpts);\n if (typeof validBlob !== \"undefined\") {\n const validKey = await validBlob.asUri();\n await this.mset([[validKey, validBlob]]);\n const savedKey = await validBlob.asUri();\n return await this.fetch(savedKey);\n }\n return undefined;\n }\n\n protected async _missingFetchBlobEmpty(\n path: string,\n _opts?: BlobStoreFetchOptions\n ): Promise<MediaBlob> {\n return new MediaBlob({ path });\n }\n\n protected async _missingFetchBlob(\n path: string,\n opts?: BlobStoreFetchOptions\n ): Promise<MediaBlob | undefined> {\n switch (opts?.actionIfBlobMissing) {\n case \"emptyBlob\":\n return this._missingFetchBlobEmpty(path, opts);\n default:\n return undefined;\n }\n }\n\n async fetch(\n key: string | MediaBlob,\n opts: BlobStoreFetchOptions = {}\n ): Promise<MediaBlob | undefined> {\n const allOpts: BlobStoreFetchOptions = {\n ...this.defaultFetchOptions,\n ...opts,\n };\n const realKey = await this._realKey(key);\n const ret = await this.mget([realKey]);\n return ret?.[0] ?? (await this._missingFetchBlob(realKey, allOpts));\n }\n}\n\nexport interface BackedBlobStoreOptions extends BlobStoreOptions {\n backingStore: BaseStore<string, MediaBlob>;\n}\n\nexport class BackedBlobStore extends BlobStore {\n backingStore: BaseStore<string, MediaBlob>;\n\n constructor(opts: BackedBlobStoreOptions) {\n super(opts);\n this.backingStore = opts.backingStore;\n }\n\n mdelete(keys: string[]): Promise<void> {\n return this.backingStore.mdelete(keys);\n }\n\n mget(keys: string[]): Promise<(MediaBlob | undefined)[]> {\n return this.backingStore.mget(keys);\n }\n\n mset(keyValuePairs: [string, MediaBlob][]): Promise<void> {\n return this.backingStore.mset(keyValuePairs);\n }\n\n yieldKeys(prefix: string | undefined): AsyncGenerator<string> {\n return this.backingStore.yieldKeys(prefix);\n }\n}\n\nexport interface ReadThroughBlobStoreOptions extends BlobStoreOptions {\n baseStore: BlobStore;\n backingStore: BlobStore;\n}\n\nexport class ReadThroughBlobStore extends BlobStore {\n baseStore: BlobStore;\n\n backingStore: BlobStore;\n\n constructor(opts: ReadThroughBlobStoreOptions) {\n super(opts);\n this.baseStore = opts.baseStore;\n this.backingStore = opts.backingStore;\n }\n\n async store(\n blob: MediaBlob,\n opts: BlobStoreStoreOptions = {}\n ): Promise<MediaBlob | undefined> {\n const originalUri = await blob.asUri();\n const newBlob = await this.backingStore.store(blob, opts);\n if (newBlob) {\n await this.baseStore.mset([[originalUri, newBlob]]);\n }\n return newBlob;\n }\n\n mdelete(keys: string[]): Promise<void> {\n return this.baseStore.mdelete(keys);\n }\n\n mget(keys: string[]): Promise<(MediaBlob | undefined)[]> {\n return this.baseStore.mget(keys);\n }\n\n mset(_keyValuePairs: [string, MediaBlob][]): Promise<void> {\n throw new Error(\"Do not call ReadThroughBlobStore.mset directly\");\n }\n\n yieldKeys(prefix: string | undefined): AsyncGenerator<string> {\n return this.baseStore.yieldKeys(prefix);\n }\n}\n\nexport class SimpleWebBlobStore extends BlobStore {\n _notImplementedException() {\n throw new Error(\"Not implemented for SimpleWebBlobStore\");\n }\n\n async hasValidPath(\n path: string | undefined,\n _opts?: BlobStoreStoreOptions\n ): Promise<boolean> {\n return (\n (await super.hasValidPath(path, { pathPrefix: \"https://\" })) ||\n (await super.hasValidPath(path, { pathPrefix: \"http://\" }))\n );\n }\n\n async _fetch(url: string): Promise<MediaBlob | undefined> {\n const ret = new MediaBlob({\n path: url,\n });\n const metadata: Record<string, unknown> = {};\n const fetchOptions = {\n method: \"GET\",\n };\n const res = await fetch(url, fetchOptions);\n metadata.status = res.status;\n\n const headers: Record<string, string> = {};\n for (const [key, value] of res.headers.entries()) {\n headers[key] = value;\n }\n metadata.headers = headers;\n\n metadata.ok = res.ok;\n if (res.ok) {\n const resMediaBlob = await MediaBlob.fromBlob(await res.blob());\n ret.data = resMediaBlob.data;\n }\n\n ret.metadata = metadata;\n return ret;\n }\n\n async mget(keys: string[]): Promise<(MediaBlob | undefined)[]> {\n const blobMap = keys.map(this._fetch);\n return await Promise.all(blobMap);\n }\n\n async mdelete(_keys: string[]): Promise<void> {\n this._notImplementedException();\n }\n\n async mset(_keyValuePairs: [string, MediaBlob][]): Promise<void> {\n this._notImplementedException();\n }\n\n async *yieldKeys(_prefix: string | undefined): AsyncGenerator<string> {\n this._notImplementedException();\n yield \"\";\n }\n}\n\n/**\n * A blob \"store\" that works with data: URLs that will turn the URL into\n * a blob.\n */\nexport class DataBlobStore extends BlobStore {\n _notImplementedException() {\n throw new Error(\"Not implemented for DataBlobStore\");\n }\n\n hasValidPath(path: string, _opts?: BlobStoreStoreOptions): Promise<boolean> {\n return super.hasValidPath(path, { pathPrefix: \"data:\" });\n }\n\n _fetch(url: string): MediaBlob {\n return MediaBlob.fromDataUrl(url);\n }\n\n async mget(keys: string[]): Promise<(MediaBlob | undefined)[]> {\n const blobMap = keys.map(this._fetch);\n return blobMap;\n }\n\n async mdelete(_keys: string[]): Promise<void> {\n this._notImplementedException();\n }\n\n async mset(_keyValuePairs: [string, MediaBlob][]): Promise<void> {\n this._notImplementedException();\n }\n\n async *yieldKeys(_prefix: string | undefined): AsyncGenerator<string> {\n this._notImplementedException();\n yield \"\";\n }\n}\n\nexport interface MediaManagerConfiguration {\n /**\n * A store that, given a common URI, returns the corresponding MediaBlob.\n * The returned MediaBlob may have a different URI.\n * In many cases, this will be a ReadThroughStore or something similar\n * that has a cached version of the MediaBlob, but also a way to get\n * a new (or refreshed) version.\n */\n store: BlobStore;\n\n /**\n * BlobStores that can resolve a URL into the MediaBlob to save\n * in the canonical store. This list is evaluated in order.\n * If not provided, a default list (which involves a DataBlobStore\n * and a SimpleWebBlobStore) will be used.\n */\n resolvers?: BlobStore[];\n}\n\n/**\n * Responsible for converting a URI (typically a web URL) into a MediaBlob.\n * Allows for aliasing / caching of the requested URI and what it resolves to.\n * This MediaBlob is expected to be usable to provide to an LLM, either\n * through the Base64 of the media or through a canonical URI that the LLM\n * supports.\n */\nexport class MediaManager {\n store: BlobStore;\n\n resolvers: BlobStore[] | undefined;\n\n constructor(config: MediaManagerConfiguration) {\n this.store = config.store;\n this.resolvers = config.resolvers;\n }\n\n defaultResolvers(): BlobStore[] {\n return [new DataBlobStore({}), new SimpleWebBlobStore({})];\n }\n\n async _isInvalid(blob: MediaBlob | undefined): Promise<boolean> {\n return typeof blob === \"undefined\";\n }\n\n /**\n * Given the public URI, load what is at this URI and save it\n * in the store.\n * @param uri The URI to resolve using the resolver\n * @return A canonical MediaBlob for this URI\n */\n async _resolveAndSave(uri: string): Promise<MediaBlob | undefined> {\n let resolvedBlob: MediaBlob | undefined;\n\n const resolvers = this.resolvers || this.defaultResolvers();\n for (let co = 0; co < resolvers.length; co += 1) {\n const resolver = resolvers[co];\n if (await resolver.hasValidPath(uri)) {\n resolvedBlob = await resolver.fetch(uri);\n }\n }\n\n if (resolvedBlob) {\n return await this.store.store(resolvedBlob);\n } else {\n return new MediaBlob({});\n }\n }\n\n async getMediaBlob(uri: string): Promise<MediaBlob | undefined> {\n const aliasBlob = await this.store.fetch(uri);\n const ret = (await this._isInvalid(aliasBlob))\n ? await this._resolveAndSave(uri)\n : (aliasBlob as MediaBlob);\n return ret;\n }\n}\n"],"mappings":";;;;AAiBA,SAAS,cAAc,WAA+B;CAEpD,IAAI,MAAM;CACV,MAAM,YAAY;AAClB,MAAK,IAAI,IAAI,GAAG,IAAI,UAAU,QAAQ,KAAK,WAAW;EACpD,MAAM,QAAQ,UAAU,SAAS,GAAG,IAAI,UAAU;AAClD,SAAO,OAAO,aAAa,GAAG,MAAM;;AAGtC,QAAO;;;;;;AAOT,IAAa,YAAb,MAAa,kBAAkB,aAA4C;CACzE,kBAAkB;CAElB,eAAe;EACb;EACA;EACA;EACA;EACA;EACD;CAED,OAAsB;EACpB,OAAO;EACP,MAAM;EACP;CAGD;CAEA;CAEA,YAAY,QAA6B;AACvC,QAAM,OAAO;AAEb,OAAK,OAAO,OAAO,QAAQ,KAAK;AAChC,OAAK,W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ts"],"sourcesContent":["import { v1, v4 } from \"uuid\"; // FIXME - it is importing the wrong uuid, so v6 and v7 aren't implemented\nimport { BaseStore } from \"@langchain/core/stores\";\nimport { Serializable } from \"@langchain/core/load/serializable\";\n\nexport type MediaBlobData = {\n value: string; // In Base64 encoding\n type: string; // The mime type and possibly encoding\n};\n\nexport interface MediaBlobParameters {\n data?: MediaBlobData;\n\n metadata?: Record<string, unknown>;\n\n path?: string;\n}\n\nfunction bytesToString(dataArray: Uint8Array): string {\n // Need to handle the array in smaller chunks to deal with stack size limits\n let ret = \"\";\n const chunkSize = 102400;\n for (let i = 0; i < dataArray.length; i += chunkSize) {\n const chunk = dataArray.subarray(i, i + chunkSize);\n ret += String.fromCharCode(...chunk);\n }\n\n return ret;\n}\n\n/**\n * Represents a chunk of data that can be identified by the path where the\n * data is (or will be) located, along with optional metadata about the data.\n */\nexport class MediaBlob extends Serializable implements MediaBlobParameters {\n lc_serializable = true;\n\n lc_namespace = [\n \"langchain\",\n \"google_common\",\n \"experimental\",\n \"utils\",\n \"media_core\",\n ];\n\n data: MediaBlobData = {\n value: \"\",\n type: \"text/plain\",\n };\n\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n metadata?: Record<string, any>;\n\n path?: string;\n\n constructor(params: MediaBlobParameters) {\n super(params);\n\n this.data = params.data ?? this.data;\n this.metadata = params.metadata;\n this.path = params.path;\n }\n\n get size(): number {\n return this.asBytes.length;\n }\n\n get dataType(): string {\n return this.data?.type ?? \"\";\n }\n\n get encoding(): string {\n const charsetEquals = this.dataType.indexOf(\"charset=\");\n return charsetEquals === -1\n ? \"utf-8\"\n : this.dataType.substring(charsetEquals + 8);\n }\n\n get mimetype(): string {\n const semicolon = this.dataType.indexOf(\";\");\n return semicolon === -1\n ? this.dataType\n : this.dataType.substring(0, semicolon);\n }\n\n get asBytes(): Uint8Array {\n if (!this.data) {\n return Uint8Array.from([]);\n }\n const binString = atob(this.data?.value);\n const ret = new Uint8Array(binString.length);\n for (let co = 0; co < binString.length; co += 1) {\n ret[co] = binString.charCodeAt(co);\n }\n return ret;\n }\n\n async asString(): Promise<string> {\n return bytesToString(this.asBytes);\n }\n\n async asBase64(): Promise<string> {\n return this.data?.value ?? \"\";\n }\n\n async asDataUrl(): Promise<string> {\n return `data:${this.mimetype};base64,${await this.asBase64()}`;\n }\n\n async asUri(): Promise<string> {\n return this.path ?? (await this.asDataUrl());\n }\n\n async encode(): Promise<{ encoded: string; encoding: string }> {\n const dataUrl = await this.asDataUrl();\n const comma = dataUrl.indexOf(\",\");\n const encoded = dataUrl.substring(comma + 1);\n const encoding: string = dataUrl.indexOf(\"base64\") > -1 ? \"base64\" : \"8bit\";\n return {\n encoded,\n encoding,\n };\n }\n\n static fromDataUrl(url: string): MediaBlob {\n if (!url.startsWith(\"data:\")) {\n throw new Error(\"Not a data: URL\");\n }\n const colon = url.indexOf(\":\");\n const semicolon = url.indexOf(\";\");\n const mimeType = url.substring(colon + 1, semicolon);\n\n const comma = url.indexOf(\",\");\n const base64Data = url.substring(comma + 1);\n\n const data: MediaBlobData = {\n type: mimeType,\n value: base64Data,\n };\n\n return new MediaBlob({\n data,\n path: url,\n });\n }\n\n static async fromBlob(\n blob: Blob,\n other?: Omit<MediaBlobParameters, \"data\">\n ): Promise<MediaBlob> {\n const valueBuffer = await blob.arrayBuffer();\n const valueArray = new Uint8Array(valueBuffer);\n const valueStr = bytesToString(valueArray);\n const value = btoa(valueStr);\n\n return new MediaBlob({\n ...other,\n data: {\n value,\n type: blob.type,\n },\n });\n }\n}\n\nexport type ActionIfInvalidAction =\n | \"ignore\"\n | \"prefixPath\"\n | \"prefixUuid1\"\n | \"prefixUuid4\"\n | \"prefixUuid6\"\n | \"prefixUuid7\"\n | \"removePath\";\n\nexport interface BlobStoreStoreOptions {\n /**\n * If the path is missing or invalid in the blob, how should we create\n * a new path?\n * Subclasses may define their own methods, but the following are supported\n * by default:\n * - Undefined or an emtpy string: Reject the blob\n * - \"ignore\": Attempt to store it anyway (but this may fail)\n * - \"prefixPath\": Use the default prefix for the BlobStore and get the\n * unique portion from the URL. The original path is stored in the metadata\n * - \"prefixUuid\": Use the default prefix for the BlobStore and get the\n * unique portion from a generated UUID. The original path is stored\n * in the metadata\n */\n actionIfInvalid?: ActionIfInvalidAction;\n\n /**\n * The expected prefix for URIs that are stored.\n * This may be used to test if a MediaBlob is valid and used to create a new\n * path if \"prefixPath\" or \"prefixUuid\" is set for actionIfInvalid.\n */\n pathPrefix?: string;\n}\n\nexport type ActionIfBlobMissingAction = \"emptyBlob\";\n\nexport interface BlobStoreFetchOptions {\n /**\n * If the blob is not found when fetching, what should we do?\n * Subclasses may define their own methods, but the following are supported\n * by default:\n * - Undefined or an empty string: return undefined\n * - \"emptyBlob\": return a new MediaBlob that has the path set, but nothing else.\n */\n actionIfBlobMissing?: ActionIfBlobMissingAction;\n}\n\nexport interface BlobStoreOptions {\n defaultStoreOptions?: BlobStoreStoreOptions;\n\n defaultFetchOptions?: BlobStoreFetchOptions;\n}\n\n/**\n * A specialized Store that is designed to handle MediaBlobs and use the\n * key that is included in the blob to determine exactly how it is stored.\n *\n * The full details of a MediaBlob may be changed when it is stored.\n * For example, it may get additional or different Metadata. This should be\n * what is returned when the store() method is called.\n *\n * Although BlobStore extends BaseStore, not all of the methods from\n * BaseStore may be implemented (or even possible). Those that are not\n * implemented should be documented and throw an Error if called.\n */\nexport abstract class BlobStore extends BaseStore<string, MediaBlob> {\n lc_namespace = [\"langchain\", \"google-common\"]; // FIXME - What should this be? And why?\n\n defaultStoreOptions: BlobStoreStoreOptions;\n\n defaultFetchOptions: BlobStoreFetchOptions;\n\n constructor(opts?: BlobStoreOptions) {\n super(opts);\n this.defaultStoreOptions = opts?.defaultStoreOptions ?? {};\n this.defaultFetchOptions = opts?.defaultFetchOptions ?? {};\n }\n\n protected async _realKey(key: string | MediaBlob): Promise<string> {\n return typeof key === \"string\" ? key : await key.asUri();\n }\n\n /**\n * Is the path supported by this BlobStore?\n *\n * Although this is async, this is expected to be a relatively fast operation\n * (ie - you shouldn't make network calls).\n *\n * @param path The path to check\n * @param opts Any options (if needed) that may be used to determine if it is valid\n * @return If the path is supported\n */\n hasValidPath(\n path: string | undefined,\n opts?: BlobStoreStoreOptions\n ): Promise<boolean> {\n const prefix = opts?.pathPrefix ?? \"\";\n const isPrefixed = typeof path !== \"undefined\" && path.startsWith(prefix);\n return Promise.resolve(isPrefixed);\n }\n\n protected _blobPathSuffix(blob: MediaBlob): string {\n // Get the path currently set and make sure we treat it as a string\n const blobPath = `${blob.path}`;\n\n // Advance past the first set of /\n let pathStart = blobPath.indexOf(\"/\") + 1;\n while (blobPath.charAt(pathStart) === \"/\") {\n pathStart += 1;\n }\n\n // We will use the rest as the path for a replacement\n return blobPath.substring(pathStart);\n }\n\n protected async _newBlob(\n oldBlob: MediaBlob,\n newPath?: string\n ): Promise<MediaBlob> {\n const oldPath = oldBlob.path;\n const metadata = oldBlob?.metadata ?? {};\n metadata.langchainOldPath = oldPath;\n const newBlob = new MediaBlob({\n ...oldBlob,\n metadata,\n });\n if (newPath) {\n newBlob.path = newPath;\n } else if (newBlob.path) {\n delete newBlob.path;\n }\n return newBlob;\n }\n\n protected async _validBlobPrefixPath(\n blob: MediaBlob,\n opts?: BlobStoreStoreOptions\n ): Promise<MediaBlob> {\n const prefix = opts?.pathPrefix ?? \"\";\n const suffix = this._blobPathSuffix(blob);\n const newPath = `${prefix}${suffix}`;\n return this._newBlob(blob, newPath);\n }\n\n protected _validBlobPrefixUuidFunction(\n name: ActionIfInvalidAction | string\n ): string {\n switch (name) {\n case \"prefixUuid1\":\n return v1();\n case \"prefixUuid4\":\n return v4();\n // case \"prefixUuid6\": return v6();\n // case \"prefixUuid7\": return v7();\n default:\n throw new Error(`Unknown uuid function: ${name}`);\n }\n }\n\n protected async _validBlobPrefixUuid(\n blob: MediaBlob,\n opts?: BlobStoreStoreOptions\n ): Promise<MediaBlob> {\n const prefix = opts?.pathPrefix ?? \"\";\n const suffix = this._validBlobPrefixUuidFunction(\n opts?.actionIfInvalid ?? \"prefixUuid4\"\n );\n const newPath = `${prefix}${suffix}`;\n return this._newBlob(blob, newPath);\n }\n\n protected async _validBlobRemovePath(\n blob: MediaBlob,\n _opts?: BlobStoreStoreOptions\n ): Promise<MediaBlob> {\n return this._newBlob(blob, undefined);\n }\n\n /**\n * Based on the blob and options, return a blob that has a valid path\n * that can be saved.\n * @param blob\n * @param opts\n */\n protected async _validStoreBlob(\n blob: MediaBlob,\n opts?: BlobStoreStoreOptions\n ): Promise<MediaBlob | undefined> {\n if (await this.hasValidPath(blob.path, opts)) {\n return blob;\n }\n switch (opts?.actionIfInvalid) {\n case \"ignore\":\n return blob;\n case \"prefixPath\":\n return this._validBlobPrefixPath(blob, opts);\n case \"prefixUuid1\":\n case \"prefixUuid4\":\n case \"prefixUuid6\":\n case \"prefixUuid7\":\n return this._validBlobPrefixUuid(blob, opts);\n case \"removePath\":\n return this._validBlobRemovePath(blob, opts);\n default:\n return undefined;\n }\n }\n\n async store(\n blob: MediaBlob,\n opts: BlobStoreStoreOptions = {}\n ): Promise<MediaBlob | undefined> {\n const allOpts: BlobStoreStoreOptions = {\n ...this.defaultStoreOptions,\n ...opts,\n };\n const validBlob = await this._validStoreBlob(blob, allOpts);\n if (typeof validBlob !== \"undefined\") {\n const validKey = await validBlob.asUri();\n await this.mset([[validKey, validBlob]]);\n const savedKey = await validBlob.asUri();\n return await this.fetch(savedKey);\n }\n return undefined;\n }\n\n protected async _missingFetchBlobEmpty(\n path: string,\n _opts?: BlobStoreFetchOptions\n ): Promise<MediaBlob> {\n return new MediaBlob({ path });\n }\n\n protected async _missingFetchBlob(\n path: string,\n opts?: BlobStoreFetchOptions\n ): Promise<MediaBlob | undefined> {\n switch (opts?.actionIfBlobMissing) {\n case \"emptyBlob\":\n return this._missingFetchBlobEmpty(path, opts);\n default:\n return undefined;\n }\n }\n\n async fetch(\n key: string | MediaBlob,\n opts: BlobStoreFetchOptions = {}\n ): Promise<MediaBlob | undefined> {\n const allOpts: BlobStoreFetchOptions = {\n ...this.defaultFetchOptions,\n ...opts,\n };\n const realKey = await this._realKey(key);\n const ret = await this.mget([realKey]);\n return ret?.[0] ?? (await this._missingFetchBlob(realKey, allOpts));\n }\n}\n\nexport interface BackedBlobStoreOptions extends BlobStoreOptions {\n backingStore: BaseStore<string, MediaBlob>;\n}\n\nexport class BackedBlobStore extends BlobStore {\n backingStore: BaseStore<string, MediaBlob>;\n\n constructor(opts: BackedBlobStoreOptions) {\n super(opts);\n this.backingStore = opts.backingStore;\n }\n\n mdelete(keys: string[]): Promise<void> {\n return this.backingStore.mdelete(keys);\n }\n\n mget(keys: string[]): Promise<(MediaBlob | undefined)[]> {\n return this.backingStore.mget(keys);\n }\n\n mset(keyValuePairs: [string, MediaBlob][]): Promise<void> {\n return this.backingStore.mset(keyValuePairs);\n }\n\n yieldKeys(prefix: string | undefined): AsyncGenerator<string> {\n return this.backingStore.yieldKeys(prefix);\n }\n}\n\nexport interface ReadThroughBlobStoreOptions extends BlobStoreOptions {\n baseStore: BlobStore;\n backingStore: BlobStore;\n}\n\nexport class ReadThroughBlobStore extends BlobStore {\n baseStore: BlobStore;\n\n backingStore: BlobStore;\n\n constructor(opts: ReadThroughBlobStoreOptions) {\n super(opts);\n this.baseStore = opts.baseStore;\n this.backingStore = opts.backingStore;\n }\n\n async store(\n blob: MediaBlob,\n opts: BlobStoreStoreOptions = {}\n ): Promise<MediaBlob | undefined> {\n const originalUri = await blob.asUri();\n const newBlob = await this.backingStore.store(blob, opts);\n if (newBlob) {\n await this.baseStore.mset([[originalUri, newBlob]]);\n }\n return newBlob;\n }\n\n mdelete(keys: string[]): Promise<void> {\n return this.baseStore.mdelete(keys);\n }\n\n mget(keys: string[]): Promise<(MediaBlob | undefined)[]> {\n return this.baseStore.mget(keys);\n }\n\n mset(_keyValuePairs: [string, MediaBlob][]): Promise<void> {\n throw new Error(\"Do not call ReadThroughBlobStore.mset directly\");\n }\n\n yieldKeys(prefix: string | undefined): AsyncGenerator<string> {\n return this.baseStore.yieldKeys(prefix);\n }\n}\n\nexport class SimpleWebBlobStore extends BlobStore {\n _notImplementedException() {\n throw new Error(\"Not implemented for SimpleWebBlobStore\");\n }\n\n async hasValidPath(\n path: string | undefined,\n _opts?: BlobStoreStoreOptions\n ): Promise<boolean> {\n return (\n (await super.hasValidPath(path, { pathPrefix: \"https://\" })) ||\n (await super.hasValidPath(path, { pathPrefix: \"http://\" }))\n );\n }\n\n async _fetch(url: string): Promise<MediaBlob | undefined> {\n const ret = new MediaBlob({\n path: url,\n });\n const metadata: Record<string, unknown> = {};\n const fetchOptions = {\n method: \"GET\",\n };\n const res = await fetch(url, fetchOptions);\n metadata.status = res.status;\n\n const headers: Record<string, string> = {};\n for (const [key, value] of res.headers.entries()) {\n headers[key] = value;\n }\n metadata.headers = headers;\n\n metadata.ok = res.ok;\n if (res.ok) {\n const resMediaBlob = await MediaBlob.fromBlob(await res.blob());\n ret.data = resMediaBlob.data;\n }\n\n ret.metadata = metadata;\n return ret;\n }\n\n async mget(keys: string[]): Promise<(MediaBlob | undefined)[]> {\n const blobMap = keys.map(this._fetch);\n return await Promise.all(blobMap);\n }\n\n async mdelete(_keys: string[]): Promise<void> {\n this._notImplementedException();\n }\n\n async mset(_keyValuePairs: [string, MediaBlob][]): Promise<void> {\n this._notImplementedException();\n }\n\n async *yieldKeys(_prefix: string | undefined): AsyncGenerator<string> {\n this._notImplementedException();\n yield \"\";\n }\n}\n\n/**\n * A blob \"store\" that works with data: URLs that will turn the URL into\n * a blob.\n */\nexport class DataBlobStore extends BlobStore {\n _notImplementedException() {\n throw new Error(\"Not implemented for DataBlobStore\");\n }\n\n hasValidPath(path: string, _opts?: BlobStoreStoreOptions): Promise<boolean> {\n return super.hasValidPath(path, { pathPrefix: \"data:\" });\n }\n\n _fetch(url: string): MediaBlob {\n return MediaBlob.fromDataUrl(url);\n }\n\n async mget(keys: string[]): Promise<(MediaBlob | undefined)[]> {\n const blobMap = keys.map(this._fetch);\n return blobMap;\n }\n\n async mdelete(_keys: string[]): Promise<void> {\n this._notImplementedException();\n }\n\n async mset(_keyValuePairs: [string, MediaBlob][]): Promise<void> {\n this._notImplementedException();\n }\n\n async *yieldKeys(_prefix: string | undefined): AsyncGenerator<string> {\n this._notImplementedException();\n yield \"\";\n }\n}\n\nexport interface MediaManagerConfiguration {\n /**\n * A store that, given a common URI, returns the corresponding MediaBlob.\n * The returned MediaBlob may have a different URI.\n * In many cases, this will be a ReadThroughStore or something similar\n * that has a cached version of the MediaBlob, but also a way to get\n * a new (or refreshed) version.\n */\n store: BlobStore;\n\n /**\n * BlobStores that can resolve a URL into the MediaBlob to save\n * in the canonical store. This list is evaluated in order.\n * If not provided, a default list (which involves a DataBlobStore\n * and a SimpleWebBlobStore) will be used.\n */\n resolvers?: BlobStore[];\n}\n\n/**\n * Responsible for converting a URI (typically a web URL) into a MediaBlob.\n * Allows for aliasing / caching of the requested URI and what it resolves to.\n * This MediaBlob is expected to be usable to provide to an LLM, either\n * through the Base64 of the media or through a canonical URI that the LLM\n * supports.\n */\nexport class MediaManager {\n store: BlobStore;\n\n resolvers: BlobStore[] | undefined;\n\n constructor(config: MediaManagerConfiguration) {\n this.store = config.store;\n this.resolvers = config.resolvers;\n }\n\n defaultResolvers(): BlobStore[] {\n return [new DataBlobStore({}), new SimpleWebBlobStore({})];\n }\n\n async _isInvalid(blob: MediaBlob | undefined): Promise<boolean> {\n return typeof blob === \"undefined\";\n }\n\n /**\n * Given the public URI, load what is at this URI and save it\n * in the store.\n * @param uri The URI to resolve using the resolver\n * @return A canonical MediaBlob for this URI\n */\n async _resolveAndSave(uri: string): Promise<MediaBlob | undefined> {\n let resolvedBlob: MediaBlob | undefined;\n\n const resolvers = this.resolvers || this.defaultResolvers();\n for (let co = 0; co < resolvers.length; co += 1) {\n const resolver = resolvers[co];\n if (await resolver.hasValidPath(uri)) {\n resolvedBlob = await resolver.fetch(uri);\n }\n }\n\n if (resolvedBlob) {\n return await this.store.store(resolvedBlob);\n } else {\n return new MediaBlob({});\n }\n }\n\n async getMediaBlob(uri: string): Promise<MediaBlob | undefined> {\n const aliasBlob = await this.store.fetch(uri);\n const ret = (await this._isInvalid(aliasBlob))\n ? await this._resolveAndSave(uri)\n : (aliasBlob as MediaBlob);\n return ret;\n }\n}\n"],"mappings":";;;;AAiBA,SAAS,cAAc,WAA+B;CAEpD,IAAI,MAAM;CACV,MAAM,YAAY;AAClB,MAAK,IAAI,IAAI,GAAG,IAAI,UAAU,QAAQ,KAAK,WAAW;EACpD,MAAM,QAAQ,UAAU,SAAS,GAAG,IAAI,UAAU;AAClD,SAAO,OAAO,aAAa,GAAG,MAAM;;AAGtC,QAAO;;;;;;AAOT,IAAa,YAAb,MAAa,kBAAkB,aAA4C;CACzE,kBAAkB;CAElB,eAAe;EACb;EACA;EACA;EACA;EACA;EACD;CAED,OAAsB;EACpB,OAAO;EACP,MAAM;EACP;CAGD;CAEA;CAEA,YAAY,QAA6B;AACvC,QAAM,OAAO;AAEb,OAAK,OAAO,OAAO,QAAQ,KAAK;AAChC,OAAK,WAAW,OAAO;AACvB,OAAK,OAAO,OAAO;;CAGrB,IAAI,OAAe;AACjB,SAAO,KAAK,QAAQ;;CAGtB,IAAI,WAAmB;AACrB,SAAO,KAAK,MAAM,QAAQ;;CAG5B,IAAI,WAAmB;EACrB,MAAM,gBAAgB,KAAK,SAAS,QAAQ,WAAW;AACvD,SAAO,kBAAkB,KACrB,UACA,KAAK,SAAS,UAAU,gBAAgB,EAAE;;CAGhD,IAAI,WAAmB;EACrB,MAAM,YAAY,KAAK,SAAS,QAAQ,IAAI;AAC5C,SAAO,cAAc,KACjB,KAAK,WACL,KAAK,SAAS,UAAU,GAAG,UAAU;;CAG3C,IAAI,UAAsB;AACxB,MAAI,CAAC,KAAK,KACR,QAAO,WAAW,KAAK,EAAE,CAAC;EAE5B,MAAM,YAAY,KAAK,KAAK,MAAM,MAAM;EACxC,MAAM,MAAM,IAAI,WAAW,UAAU,OAAO;AAC5C,OAAK,IAAI,K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AE,IAAI,mBAAmB,EAAE,CAAC,CAAC;;CAG5D,MAAM,WAAW,MAA+C;AAC9D,SAAO,OAAO,SAAS;;;;;;;;CASzB,MAAM,gBAAgB,KAA6C;EACjE,IAAI;EAEJ,MAAM,YAAY,KAAK,aAAa,KAAK,kBAAkB;AAC3D,OAAK,IAAI,KAAK,GAAG,KAAK,UAAU,QAAQ,MAAM,GAAG;GAC/C,MAAM,WAAW,UAAU;AAC3B,OAAI,MAAM,SAAS,aAAa,IAAI,CAClC,gBAAe,MAAM,SAAS,MAAM,IAAI;;AAI5C,MAAI,aACF,QAAO,MAAM,KAAK,MAAM,MAAM,aAAa;MAE3C,QAAO,IAAI,UAAU,EAAE,CAAC;;CAI5B,MAAM,aAAa,KAA6C;EAC9D,MAAM,YAAY,MAAM,KAAK,MAAM,MAAM,IAAI;AAI7C,SAHa,MAAM,KAAK,WAAW,UAAU,GACzC,MAAM,KAAK,gBAAgB,IAAI,GAC9B"}
package/dist/llms.cjs CHANGED
@@ -20,7 +20,7 @@ var GoogleLLMConnection = class extends require_connection.AbstractGoogleLLMConn
20
20
  var ProxyChatGoogle = class extends require_chat_models.ChatGoogleBase {
21
21
  constructor(fields) {
22
22
  super(fields);
23
- this._addVersion("@langchain/google-common", "2.1.26-dev-1773962633795");
23
+ this._addVersion("@langchain/google-common", "2.1.27");
24
24
  }
25
25
  buildAbstractedClient(fields) {
26
26
  return fields.connection.client;
package/dist/llms.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"llms.cjs","names":["AbstractGoogleLLMConnection","ChatGoogleBase","LLM","ensureParams","DefaultGeminiSafetyHandler","ApiKeyGoogleAuth","copyAIModelParams","BaseLLM","CallbackManager","GenerationChunk"],"sources":["../src/llms.ts"],"sourcesContent":["import { CallbackManager, Callbacks } from \"@langchain/core/callbacks/manager\";\nimport { BaseLLM, LLM } from \"@langchain/core/language_models/llms\";\nimport {\n type BaseLanguageModelCallOptions,\n BaseLanguageModelInput,\n} from \"@langchain/core/language_models/base\";\nimport { BaseMessage, MessageContent } from \"@langchain/core/messages\";\nimport { GenerationChunk } from \"@langchain/core/outputs\";\nimport { getEnvironmentVariable } from \"@langchain/core/utils/env\";\n\nimport { AbstractGoogleLLMConnection } from \"./connection.js\";\nimport {\n GoogleAIBaseLLMInput,\n GoogleAIModelParams,\n GoogleAISafetySetting,\n GooglePlatformType,\n GeminiContent,\n GoogleAIResponseMimeType,\n} from \"./types.js\";\nimport {\n copyAIModelParams,\n copyAndValidateModelParamsInto,\n} from \"./utils/common.js\";\nimport { DefaultGeminiSafetyHandler } from \"./utils/gemini.js\";\nimport { ApiKeyGoogleAuth, GoogleAbstractedClient } from \"./auth.js\";\nimport { ensureParams } from \"./utils/failed_handler.js\";\nimport { ChatGoogleBase } from \"./chat_models.js\";\nimport type { GoogleBaseLLMInput, GoogleAISafetyHandler } from \"./types.js\";\n\nexport { GoogleBaseLLMInput };\n\nclass GoogleLLMConnection<AuthOptions> extends AbstractGoogleLLMConnection<\n MessageContent,\n AuthOptions\n> {\n async formatContents(\n input: MessageContent,\n _parameters: GoogleAIModelParams\n ): Promise<GeminiContent[]> {\n const parts = await this.api.messageContentToParts!(input);\n const contents: GeminiContent[] = [\n {\n role: \"user\", // Required by Vertex AI\n parts,\n },\n ];\n return contents;\n }\n}\n\ntype ProxyChatInput<AuthOptions> = GoogleAIBaseLLMInput<AuthOptions> & {\n connection: GoogleLLMConnection<AuthOptions>;\n};\n\nclass ProxyChatGoogle<AuthOptions> extends ChatGoogleBase<AuthOptions> {\n constructor(fields: ProxyChatInput<AuthOptions>) {\n super(fields);\n this._addVersion(\"@langchain/google-common\", __PKG_VERSION__);\n }\n\n buildAbstractedClient(\n fields: ProxyChatInput<AuthOptions>\n ): GoogleAbstractedClient {\n return fields.connection.client;\n }\n}\n\n/**\n * Integration with an LLM.\n */\nexport abstract class GoogleBaseLLM<AuthOptions>\n extends LLM<BaseLanguageModelCallOptions>\n implements GoogleBaseLLMInput<AuthOptions>\n{\n // Used for tracing, replace with the same name as your class\n static lc_name() {\n return \"GoogleLLM\";\n }\n\n get lc_secrets(): { [key: string]: string } | undefined {\n return {\n authOptions: \"GOOGLE_AUTH_OPTIONS\",\n };\n }\n\n originalFields?: GoogleBaseLLMInput<AuthOptions>;\n\n lc_serializable = true;\n\n modelName = \"gemini-pro\";\n\n model = \"gemini-pro\";\n\n temperature = 0.7;\n\n maxOutputTokens = 1024;\n\n topP = 0.8;\n\n topK = 40;\n\n stopSequences: string[] = [];\n\n safetySettings: GoogleAISafetySetting[] = [];\n\n safetyHandler: GoogleAISafetyHandler;\n\n responseMimeType: GoogleAIResponseMimeType = \"text/plain\";\n\n protected connection: GoogleLLMConnection<AuthOptions>;\n\n protected streamedConnection: GoogleLLMConnection<AuthOptions>;\n\n constructor(fields?: GoogleBaseLLMInput<AuthOptions>) {\n super(ensureParams(fields));\n this.originalFields = fields;\n\n copyAndValidateModelParamsInto(fields, this);\n this.safetyHandler =\n fields?.safetyHandler ?? new DefaultGeminiSafetyHandler();\n\n const client = this.buildClient(fields);\n this.buildConnection(fields ?? {}, client);\n }\n\n abstract buildAbstractedClient(\n fields?: GoogleAIBaseLLMInput<AuthOptions>\n ): GoogleAbstractedClient;\n\n buildApiKeyClient(apiKey: string): GoogleAbstractedClient {\n return new ApiKeyGoogleAuth(apiKey);\n }\n\n buildApiKey(fields?: GoogleAIBaseLLMInput<AuthOptions>): string | undefined {\n return fields?.apiKey ?? getEnvironmentVariable(\"GOOGLE_API_KEY\");\n }\n\n buildClient(\n fields?: GoogleAIBaseLLMInput<AuthOptions>\n ): GoogleAbstractedClient {\n const apiKey = this.buildApiKey(fields);\n if (apiKey) {\n return this.buildApiKeyClient(apiKey);\n } else {\n return this.buildAbstractedClient(fields);\n }\n }\n\n buildConnection(\n fields: GoogleBaseLLMInput<AuthOptions>,\n client: GoogleAbstractedClient\n ) {\n this.connection = new GoogleLLMConnection(\n { ...fields, ...this },\n this.caller,\n client,\n false\n );\n\n this.streamedConnection = new GoogleLLMConnection(\n { ...fields, ...this },\n this.caller,\n client,\n true\n );\n }\n\n get platform(): GooglePlatformType {\n return this.connection.platform;\n }\n\n // Replace\n _llmType() {\n return \"googlellm\";\n }\n\n formatPrompt(prompt: string): MessageContent {\n return prompt;\n }\n\n /**\n * For some given input string and options, return a string output.\n *\n * Despite the fact that `invoke` is overridden below, we still need this\n * in order to handle public APi calls to `generate()`.\n */\n async _call(\n prompt: string,\n options: this[\"ParsedCallOptions\"]\n ): Promise<string> {\n const parameters = copyAIModelParams(this, options);\n const result = await this.connection.request(prompt, parameters, options);\n const ret = this.connection.api.responseToString(result);\n return ret;\n }\n\n // Normally, you should not override this method and instead should override\n // _streamResponseChunks. We are doing so here to allow for multimodal inputs into\n // the LLM.\n async *_streamIterator(\n input: BaseLanguageModelInput,\n options?: BaseLanguageModelCallOptions\n ): AsyncGenerator<string> {\n // TODO: Refactor callback setup and teardown code into core\n const prompt = BaseLLM._convertInputToPromptValue(input);\n const [runnableConfig, callOptions] =\n this._separateRunnableConfigFromCallOptions(options);\n const callbackManager_ = await CallbackManager.configure(\n runnableConfig.callbacks,\n this.callbacks,\n runnableConfig.tags,\n this.tags,\n runnableConfig.metadata,\n this.metadata,\n { verbose: this.verbose }\n );\n const extra = {\n options: callOptions,\n invocation_params: this?.invocationParams(callOptions),\n batch_size: 1,\n };\n const runManagers = await callbackManager_?.handleLLMStart(\n this.toJSON(),\n [prompt.toString()],\n undefined,\n undefined,\n extra,\n undefined,\n undefined,\n runnableConfig.runName\n );\n let generation = new GenerationChunk({\n text: \"\",\n });\n const proxyChat = this.createProxyChat();\n try {\n for await (const chunk of proxyChat._streamIterator(input, options)) {\n const stringValue = this.connection.api.chunkToString(chunk);\n const generationChunk = new GenerationChunk({\n text: stringValue,\n });\n generation = generation.concat(generationChunk);\n yield stringValue;\n }\n } catch (err) {\n await Promise.all(\n (runManagers ?? []).map((runManager) => runManager?.handleLLMError(err))\n );\n throw err;\n }\n await Promise.all(\n (runManagers ?? []).map((runManager) =>\n runManager?.handleLLMEnd({\n generations: [[generation]],\n })\n )\n );\n }\n\n async predictMessages(\n messages: BaseMessage[],\n options?: string[] | BaseLanguageModelCallOptions,\n _callbacks?: Callbacks\n ): Promise<BaseMessage> {\n const { content } = messages[0];\n const result = await this.connection.request(\n content,\n {},\n options as BaseLanguageModelCallOptions\n );\n const ret = this.connection.api.responseToBaseMessage(result);\n return ret;\n }\n\n /**\n * Internal implementation detail to allow Google LLMs to support\n * multimodal input by delegating to the chat model implementation.\n *\n * TODO: Replace with something less hacky.\n */\n protected createProxyChat(): ChatGoogleBase<AuthOptions> {\n return new ProxyChatGoogle<AuthOptions>({\n ...this.originalFields,\n connection: this.connection,\n });\n }\n\n // TODO: Remove the need to override this - we are doing it to\n // allow the LLM to handle multimodal types of input.\n async invoke(\n input: BaseLanguageModelInput,\n options?: BaseLanguageModelCallOptions\n ): Promise<string> {\n const stream = await this._streamIterator(input, options);\n let generatedOutput = \"\";\n for await (const chunk of stream) {\n generatedOutput += chunk;\n }\n return generatedOutput;\n }\n}\n"],"mappings":";;;;;;;;;;;AA+BA,IAAM,sBAAN,cAA+CA,mBAAAA,4BAG7C;CACA,MAAM,eACJ,OACA,aAC0B;AAQ1B,SANkC,CAChC;GACE,MAAM;GACN,OAJU,MAAM,KAAK,IAAI,sBAAuB,MAAM;GAKvD,CACF;;;AASL,IAAM,kBAAN,cAA2CC,oBAAAA,eAA4B;CACrE,YAAY,QAAqC;AAC/C,QAAM,OAAO;AACb,OAAK,YAAY,4BAAA,2BAA4C;;CAG/D,sBACE,QACwB;AACxB,SAAO,OAAO,WAAW;;;;;;AAO7B,IAAsB,gBAAtB,cACUC,qCAAAA,IAEV;CAEE,OAAO,UAAU;AACf,SAAO;;CAGT,IAAI,aAAoD;AACtD,SAAO,EACL,aAAa,uBACd;;CAGH;CAEA,kBAAkB;CAElB,YAAY;CAEZ,QAAQ;CAER,cAAc;CAEd,kBAAkB;CAElB,OAAO;CAEP,OAAO;CAEP,gBAA0B,EAAE;C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M,SAAS,MAAM,KAAK,gBAAgB,OAAO,QAAQ;EACzD,IAAI,kBAAkB;AACtB,aAAW,MAAM,SAAS,OACxB,oBAAmB;AAErB,SAAO"}
1
+ {"version":3,"file":"llms.cjs","names":["AbstractGoogleLLMConnection","ChatGoogleBase","LLM","ensureParams","DefaultGeminiSafetyHandler","ApiKeyGoogleAuth","copyAIModelParams","BaseLLM","CallbackManager","GenerationChunk"],"sources":["../src/llms.ts"],"sourcesContent":["import { CallbackManager, Callbacks } from \"@langchain/core/callbacks/manager\";\nimport { BaseLLM, LLM } from \"@langchain/core/language_models/llms\";\nimport {\n type BaseLanguageModelCallOptions,\n BaseLanguageModelInput,\n} from \"@langchain/core/language_models/base\";\nimport { BaseMessage, MessageContent } from \"@langchain/core/messages\";\nimport { GenerationChunk } from \"@langchain/core/outputs\";\nimport { getEnvironmentVariable } from \"@langchain/core/utils/env\";\n\nimport { AbstractGoogleLLMConnection } from \"./connection.js\";\nimport {\n GoogleAIBaseLLMInput,\n GoogleAIModelParams,\n GoogleAISafetySetting,\n GooglePlatformType,\n GeminiContent,\n GoogleAIResponseMimeType,\n} from \"./types.js\";\nimport {\n copyAIModelParams,\n copyAndValidateModelParamsInto,\n} from \"./utils/common.js\";\nimport { DefaultGeminiSafetyHandler } from \"./utils/gemini.js\";\nimport { ApiKeyGoogleAuth, GoogleAbstractedClient } from \"./auth.js\";\nimport { ensureParams } from \"./utils/failed_handler.js\";\nimport { ChatGoogleBase } from \"./chat_models.js\";\nimport type { GoogleBaseLLMInput, GoogleAISafetyHandler } from \"./types.js\";\n\nexport { GoogleBaseLLMInput };\n\nclass GoogleLLMConnection<AuthOptions> extends AbstractGoogleLLMConnection<\n MessageContent,\n AuthOptions\n> {\n async formatContents(\n input: MessageContent,\n _parameters: GoogleAIModelParams\n ): Promise<GeminiContent[]> {\n const parts = await this.api.messageContentToParts!(input);\n const contents: GeminiContent[] = [\n {\n role: \"user\", // Required by Vertex AI\n parts,\n },\n ];\n return contents;\n }\n}\n\ntype ProxyChatInput<AuthOptions> = GoogleAIBaseLLMInput<AuthOptions> & {\n connection: GoogleLLMConnection<AuthOptions>;\n};\n\nclass ProxyChatGoogle<AuthOptions> extends ChatGoogleBase<AuthOptions> {\n constructor(fields: ProxyChatInput<AuthOptions>) {\n super(fields);\n this._addVersion(\"@langchain/google-common\", __PKG_VERSION__);\n }\n\n buildAbstractedClient(\n fields: ProxyChatInput<AuthOptions>\n ): GoogleAbstractedClient {\n return fields.connection.client;\n }\n}\n\n/**\n * Integration with an LLM.\n */\nexport abstract class GoogleBaseLLM<AuthOptions>\n extends LLM<BaseLanguageModelCallOptions>\n implements GoogleBaseLLMInput<AuthOptions>\n{\n // Used for tracing, replace with the same name as your class\n static lc_name() {\n return \"GoogleLLM\";\n }\n\n get lc_secrets(): { [key: string]: string } | undefined {\n return {\n authOptions: \"GOOGLE_AUTH_OPTIONS\",\n };\n }\n\n originalFields?: GoogleBaseLLMInput<AuthOptions>;\n\n lc_serializable = true;\n\n modelName = \"gemini-pro\";\n\n model = \"gemini-pro\";\n\n temperature = 0.7;\n\n maxOutputTokens = 1024;\n\n topP = 0.8;\n\n topK = 40;\n\n stopSequences: string[] = [];\n\n safetySettings: GoogleAISafetySetting[] = [];\n\n safetyHandler: GoogleAISafetyHandler;\n\n responseMimeType: GoogleAIResponseMimeType = \"text/plain\";\n\n protected connection: GoogleLLMConnection<AuthOptions>;\n\n protected streamedConnection: GoogleLLMConnection<AuthOptions>;\n\n constructor(fields?: GoogleBaseLLMInput<AuthOptions>) {\n super(ensureParams(fields));\n this.originalFields = fields;\n\n copyAndValidateModelParamsInto(fields, this);\n this.safetyHandler =\n fields?.safetyHandler ?? new DefaultGeminiSafetyHandler();\n\n const client = this.buildClient(fields);\n this.buildConnection(fields ?? {}, client);\n }\n\n abstract buildAbstractedClient(\n fields?: GoogleAIBaseLLMInput<AuthOptions>\n ): GoogleAbstractedClient;\n\n buildApiKeyClient(apiKey: string): GoogleAbstractedClient {\n return new ApiKeyGoogleAuth(apiKey);\n }\n\n buildApiKey(fields?: GoogleAIBaseLLMInput<AuthOptions>): string | undefined {\n return fields?.apiKey ?? getEnvironmentVariable(\"GOOGLE_API_KEY\");\n }\n\n buildClient(\n fields?: GoogleAIBaseLLMInput<AuthOptions>\n ): GoogleAbstractedClient {\n const apiKey = this.buildApiKey(fields);\n if (apiKey) {\n return this.buildApiKeyClient(apiKey);\n } else {\n return this.buildAbstractedClient(fields);\n }\n }\n\n buildConnection(\n fields: GoogleBaseLLMInput<AuthOptions>,\n client: GoogleAbstractedClient\n ) {\n this.connection = new GoogleLLMConnection(\n { ...fields, ...this },\n this.caller,\n client,\n false\n );\n\n this.streamedConnection = new GoogleLLMConnection(\n { ...fields, ...this },\n this.caller,\n client,\n true\n );\n }\n\n get platform(): GooglePlatformType {\n return this.connection.platform;\n }\n\n // Replace\n _llmType() {\n return \"googlellm\";\n }\n\n formatPrompt(prompt: string): MessageContent {\n return prompt;\n }\n\n /**\n * For some given input string and options, return a string output.\n *\n * Despite the fact that `invoke` is overridden below, we still need this\n * in order to handle public APi calls to `generate()`.\n */\n async _call(\n prompt: string,\n options: this[\"ParsedCallOptions\"]\n ): Promise<string> {\n const parameters = copyAIModelParams(this, options);\n const result = await this.connection.request(prompt, parameters, options);\n const ret = this.connection.api.responseToString(result);\n return ret;\n }\n\n // Normally, you should not override this method and instead should override\n // _streamResponseChunks. We are doing so here to allow for multimodal inputs into\n // the LLM.\n async *_streamIterator(\n input: BaseLanguageModelInput,\n options?: BaseLanguageModelCallOptions\n ): AsyncGenerator<string> {\n // TODO: Refactor callback setup and teardown code into core\n const prompt = BaseLLM._convertInputToPromptValue(input);\n const [runnableConfig, callOptions] =\n this._separateRunnableConfigFromCallOptions(options);\n const callbackManager_ = await CallbackManager.configure(\n runnableConfig.callbacks,\n this.callbacks,\n runnableConfig.tags,\n this.tags,\n runnableConfig.metadata,\n this.metadata,\n { verbose: this.verbose }\n );\n const extra = {\n options: callOptions,\n invocation_params: this?.invocationParams(callOptions),\n batch_size: 1,\n };\n const runManagers = await callbackManager_?.handleLLMStart(\n this.toJSON(),\n [prompt.toString()],\n undefined,\n undefined,\n extra,\n undefined,\n undefined,\n runnableConfig.runName\n );\n let generation = new GenerationChunk({\n text: \"\",\n });\n const proxyChat = this.createProxyChat();\n try {\n for await (const chunk of proxyChat._streamIterator(input, options)) {\n const stringValue = this.connection.api.chunkToString(chunk);\n const generationChunk = new GenerationChunk({\n text: stringValue,\n });\n generation = generation.concat(generationChunk);\n yield stringValue;\n }\n } catch (err) {\n await Promise.all(\n (runManagers ?? []).map((runManager) => runManager?.handleLLMError(err))\n );\n throw err;\n }\n await Promise.all(\n (runManagers ?? []).map((runManager) =>\n runManager?.handleLLMEnd({\n generations: [[generation]],\n })\n )\n );\n }\n\n async predictMessages(\n messages: BaseMessage[],\n options?: string[] | BaseLanguageModelCallOptions,\n _callbacks?: Callbacks\n ): Promise<BaseMessage> {\n const { content } = messages[0];\n const result = await this.connection.request(\n content,\n {},\n options as BaseLanguageModelCallOptions\n );\n const ret = this.connection.api.responseToBaseMessage(result);\n return ret;\n }\n\n /**\n * Internal implementation detail to allow Google LLMs to support\n * multimodal input by delegating to the chat model implementation.\n *\n * TODO: Replace with something less hacky.\n */\n protected createProxyChat(): ChatGoogleBase<AuthOptions> {\n return new ProxyChatGoogle<AuthOptions>({\n ...this.originalFields,\n connection: this.connection,\n });\n }\n\n // TODO: Remove the need to override this - we are doing it to\n // allow the LLM to handle multimodal types of input.\n async invoke(\n input: BaseLanguageModelInput,\n options?: BaseLanguageModelCallOptions\n ): Promise<string> {\n const stream = await this._streamIterator(input, options);\n let generatedOutput = \"\";\n for await (const chunk of stream) {\n generatedOutput += chunk;\n }\n return generatedOutput;\n }\n}\n"],"mappings":";;;;;;;;;;;AA+BA,IAAM,sBAAN,cAA+CA,mBAAAA,4BAG7C;CACA,MAAM,eACJ,OACA,aAC0B;AAQ1B,SANkC,CAChC;GACE,MAAM;GACN,OAJU,MAAM,KAAK,IAAI,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ER,QAAM,QAAQ,KACX,eAAe,EAAE,EAAE,KAAK,eACvB,YAAY,aAAa,EACvB,aAAa,CAAC,CAAC,WAAW,CAAC,EAC5B,CAAC,CACH,CACF;;CAGH,MAAM,gBACJ,UACA,SACA,YACsB;EACtB,MAAM,EAAE,YAAY,SAAS;EAC7B,MAAM,SAAS,MAAM,KAAK,WAAW,QACnC,SACA,EAAE,EACF,QACD;AAED,SADY,KAAK,WAAW,IAAI,sBAAsB,OAAO;;;;;;;;CAU/D,kBAAyD;AACvD,SAAO,IAAI,gBAA6B;GACtC,GAAG,KAAK;GACR,YAAY,KAAK;GAClB,CAAC;;CAKJ,MAAM,OACJ,OACA,SACiB;EACjB,MAAM,SAAS,MAAM,KAAK,gBAAgB,OAAO,QAAQ;EACzD,IAAI,kBAAkB;AACtB,aAAW,MAAM,SAAS,OACxB,oBAAmB;AAErB,SAAO"}
package/dist/llms.js CHANGED
@@ -20,7 +20,7 @@ var GoogleLLMConnection = class extends AbstractGoogleLLMConnection {
20
20
  var ProxyChatGoogle = class extends ChatGoogleBase {
21
21
  constructor(fields) {
22
22
  super(fields);
23
- this._addVersion("@langchain/google-common", "2.1.26-dev-1773962633795");
23
+ this._addVersion("@langchain/google-common", "2.1.27");
24
24
  }
25
25
  buildAbstractedClient(fields) {
26
26
  return fields.connection.client;
package/dist/llms.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"llms.js","names":[],"sources":["../src/llms.ts"],"sourcesContent":["import { CallbackManager, Callbacks } from \"@langchain/core/callbacks/manager\";\nimport { BaseLLM, LLM } from \"@langchain/core/language_models/llms\";\nimport {\n type BaseLanguageModelCallOptions,\n BaseLanguageModelInput,\n} from \"@langchain/core/language_models/base\";\nimport { BaseMessage, MessageContent } from \"@langchain/core/messages\";\nimport { GenerationChunk } from \"@langchain/core/outputs\";\nimport { getEnvironmentVariable } from \"@langchain/core/utils/env\";\n\nimport { AbstractGoogleLLMConnection } from \"./connection.js\";\nimport {\n GoogleAIBaseLLMInput,\n GoogleAIModelParams,\n GoogleAISafetySetting,\n GooglePlatformType,\n GeminiContent,\n GoogleAIResponseMimeType,\n} from \"./types.js\";\nimport {\n copyAIModelParams,\n copyAndValidateModelParamsInto,\n} from \"./utils/common.js\";\nimport { DefaultGeminiSafetyHandler } from \"./utils/gemini.js\";\nimport { ApiKeyGoogleAuth, GoogleAbstractedClient } from \"./auth.js\";\nimport { ensureParams } from \"./utils/failed_handler.js\";\nimport { ChatGoogleBase } from \"./chat_models.js\";\nimport type { GoogleBaseLLMInput, GoogleAISafetyHandler } from \"./types.js\";\n\nexport { GoogleBaseLLMInput };\n\nclass GoogleLLMConnection<AuthOptions> extends AbstractGoogleLLMConnection<\n MessageContent,\n AuthOptions\n> {\n async formatContents(\n input: MessageContent,\n _parameters: GoogleAIModelParams\n ): Promise<GeminiContent[]> {\n const parts = await this.api.messageContentToParts!(input);\n const contents: GeminiContent[] = [\n {\n role: \"user\", // Required by Vertex AI\n parts,\n },\n ];\n return contents;\n }\n}\n\ntype ProxyChatInput<AuthOptions> = GoogleAIBaseLLMInput<AuthOptions> & {\n connection: GoogleLLMConnection<AuthOptions>;\n};\n\nclass ProxyChatGoogle<AuthOptions> extends ChatGoogleBase<AuthOptions> {\n constructor(fields: ProxyChatInput<AuthOptions>) {\n super(fields);\n this._addVersion(\"@langchain/google-common\", __PKG_VERSION__);\n }\n\n buildAbstractedClient(\n fields: ProxyChatInput<AuthOptions>\n ): GoogleAbstractedClient {\n return fields.connection.client;\n }\n}\n\n/**\n * Integration with an LLM.\n */\nexport abstract class GoogleBaseLLM<AuthOptions>\n extends LLM<BaseLanguageModelCallOptions>\n implements GoogleBaseLLMInput<AuthOptions>\n{\n // Used for tracing, replace with the same name as your class\n static lc_name() {\n return \"GoogleLLM\";\n }\n\n get lc_secrets(): { [key: string]: string } | undefined {\n return {\n authOptions: \"GOOGLE_AUTH_OPTIONS\",\n };\n }\n\n originalFields?: GoogleBaseLLMInput<AuthOptions>;\n\n lc_serializable = true;\n\n modelName = \"gemini-pro\";\n\n model = \"gemini-pro\";\n\n temperature = 0.7;\n\n maxOutputTokens = 1024;\n\n topP = 0.8;\n\n topK = 40;\n\n stopSequences: string[] = [];\n\n safetySettings: GoogleAISafetySetting[] = [];\n\n safetyHandler: GoogleAISafetyHandler;\n\n responseMimeType: GoogleAIResponseMimeType = \"text/plain\";\n\n protected connection: GoogleLLMConnection<AuthOptions>;\n\n protected streamedConnection: GoogleLLMConnection<AuthOptions>;\n\n constructor(fields?: GoogleBaseLLMInput<AuthOptions>) {\n super(ensureParams(fields));\n this.originalFields = fields;\n\n copyAndValidateModelParamsInto(fields, this);\n this.safetyHandler =\n fields?.safetyHandler ?? new DefaultGeminiSafetyHandler();\n\n const client = this.buildClient(fields);\n this.buildConnection(fields ?? {}, client);\n }\n\n abstract buildAbstractedClient(\n fields?: GoogleAIBaseLLMInput<AuthOptions>\n ): GoogleAbstractedClient;\n\n buildApiKeyClient(apiKey: string): GoogleAbstractedClient {\n return new ApiKeyGoogleAuth(apiKey);\n }\n\n buildApiKey(fields?: GoogleAIBaseLLMInput<AuthOptions>): string | undefined {\n return fields?.apiKey ?? getEnvironmentVariable(\"GOOGLE_API_KEY\");\n }\n\n buildClient(\n fields?: GoogleAIBaseLLMInput<AuthOptions>\n ): GoogleAbstractedClient {\n const apiKey = this.buildApiKey(fields);\n if (apiKey) {\n return this.buildApiKeyClient(apiKey);\n } else {\n return this.buildAbstractedClient(fields);\n }\n }\n\n buildConnection(\n fields: GoogleBaseLLMInput<AuthOptions>,\n client: GoogleAbstractedClient\n ) {\n this.connection = new GoogleLLMConnection(\n { ...fields, ...this },\n this.caller,\n client,\n false\n );\n\n this.streamedConnection = new GoogleLLMConnection(\n { ...fields, ...this },\n this.caller,\n client,\n true\n );\n }\n\n get platform(): GooglePlatformType {\n return this.connection.platform;\n }\n\n // Replace\n _llmType() {\n return \"googlellm\";\n }\n\n formatPrompt(prompt: string): MessageContent {\n return prompt;\n }\n\n /**\n * For some given input string and options, return a string output.\n *\n * Despite the fact that `invoke` is overridden below, we still need this\n * in order to handle public APi calls to `generate()`.\n */\n async _call(\n prompt: string,\n options: this[\"ParsedCallOptions\"]\n ): Promise<string> {\n const parameters = copyAIModelParams(this, options);\n const result = await this.connection.request(prompt, parameters, options);\n const ret = this.connection.api.responseToString(result);\n return ret;\n }\n\n // Normally, you should not override this method and instead should override\n // _streamResponseChunks. We are doing so here to allow for multimodal inputs into\n // the LLM.\n async *_streamIterator(\n input: BaseLanguageModelInput,\n options?: BaseLanguageModelCallOptions\n ): AsyncGenerator<string> {\n // TODO: Refactor callback setup and teardown code into core\n const prompt = BaseLLM._convertInputToPromptValue(input);\n const [runnableConfig, callOptions] =\n this._separateRunnableConfigFromCallOptions(options);\n const callbackManager_ = await CallbackManager.configure(\n runnableConfig.callbacks,\n this.callbacks,\n runnableConfig.tags,\n this.tags,\n runnableConfig.metadata,\n this.metadata,\n { verbose: this.verbose }\n );\n const extra = {\n options: callOptions,\n invocation_params: this?.invocationParams(callOptions),\n batch_size: 1,\n };\n const runManagers = await callbackManager_?.handleLLMStart(\n this.toJSON(),\n [prompt.toString()],\n undefined,\n undefined,\n extra,\n undefined,\n undefined,\n runnableConfig.runName\n );\n let generation = new GenerationChunk({\n text: \"\",\n });\n const proxyChat = this.createProxyChat();\n try {\n for await (const chunk of proxyChat._streamIterator(input, options)) {\n const stringValue = this.connection.api.chunkToString(chunk);\n const generationChunk = new GenerationChunk({\n text: stringValue,\n });\n generation = generation.concat(generationChunk);\n yield stringValue;\n }\n } catch (err) {\n await Promise.all(\n (runManagers ?? []).map((runManager) => runManager?.handleLLMError(err))\n );\n throw err;\n }\n await Promise.all(\n (runManagers ?? []).map((runManager) =>\n runManager?.handleLLMEnd({\n generations: [[generation]],\n })\n )\n );\n }\n\n async predictMessages(\n messages: BaseMessage[],\n options?: string[] | BaseLanguageModelCallOptions,\n _callbacks?: Callbacks\n ): Promise<BaseMessage> {\n const { content } = messages[0];\n const result = await this.connection.request(\n content,\n {},\n options as BaseLanguageModelCallOptions\n );\n const ret = this.connection.api.responseToBaseMessage(result);\n return ret;\n }\n\n /**\n * Internal implementation detail to allow Google LLMs to support\n * multimodal input by delegating to the chat model implementation.\n *\n * TODO: Replace with something less hacky.\n */\n protected createProxyChat(): ChatGoogleBase<AuthOptions> {\n return new ProxyChatGoogle<AuthOptions>({\n ...this.originalFields,\n connection: this.connection,\n });\n }\n\n // TODO: Remove the need to override this - we are doing it to\n // allow the LLM to handle multimodal types of input.\n async invoke(\n input: BaseLanguageModelInput,\n options?: BaseLanguageModelCallOptions\n ): Promise<string> {\n const stream = await this._streamIterator(input, options);\n let generatedOutput = \"\";\n for await (const chunk of stream) {\n generatedOutput += chunk;\n }\n return generatedOutput;\n }\n}\n"],"mappings":";;;;;;;;;;;AA+BA,IAAM,sBAAN,cAA+C,4BAG7C;CACA,MAAM,eACJ,OACA,aAC0B;AAQ1B,SANkC,CAChC;GACE,MAAM;GACN,OAJU,MAAM,KAAK,IAAI,sBAAuB,MAAM;GAKvD,CACF;;;AASL,IAAM,kBAAN,cAA2C,eAA4B;CACrE,YAAY,QAAqC;AAC/C,QAAM,OAAO;AACb,OAAK,YAAY,4BAAA,2BAA4C;;CAG/D,sBACE,QACwB;AACxB,SAAO,OAAO,WAAW;;;;;;AAO7B,IAAsB,gBAAtB,cACU,IAEV;CAEE,OAAO,UAAU;AACf,SAAO;;CAGT,IAAI,aAAoD;AACtD,SAAO,EACL,aAAa,uBACd;;CAGH;CAEA,kBAAkB;CAElB,YAAY;CAEZ,QAAQ;CAER,cAAc;CAEd,kBAAkB;CAElB,OAAO;CAEP,OAAO;CAEP,gBAA0B,EAAE;CAE5B,iBAA0C,EAAE;CAE5C;CAEA,mBAA6C;CAE7C;CAEA;CAEA,YAAY,QAA0C;AACpD,QAAM,aAAa,OAAO,CAAC;AAC3B,OAAK,iBAAiB;AAEtB,iCAA+B,QAAQ,KAAK;AAC5C,OAAK,gBACH,QAAQ,iBAAiB,IAAI,4BAA4B;EAE3D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UAAU,CAAC,EACnB,KAAA,GACA,KAAA,GACA,OACA,KAAA,GACA,KAAA,GACA,eAAe,QAChB;EACD,IAAI,aAAa,IAAI,gBAAgB,EACnC,MAAM,IACP,CAAC;EACF,MAAM,YAAY,KAAK,iBAAiB;AACxC,MAAI;AACF,cAAW,MAAM,SAAS,UAAU,gBAAgB,OAAO,QAAQ,EAAE;IACnE,MAAM,cAAc,KAAK,WAAW,IAAI,cAAc,MAAM;IAC5D,MAAM,kBAAkB,IAAI,gBAAgB,EAC1C,MAAM,aACP,CAAC;AACF,iBAAa,WAAW,OAAO,gBAAgB;AAC/C,UAAM;;WAED,KAAK;AACZ,SAAM,QAAQ,KACX,eAAe,EAAE,EAAE,KAAK,eAAe,YAAY,eAAe,IAAI,CAAC,CACzE;AACD,SAAM;;AAER,QAAM,QAAQ,KACX,eAAe,EAAE,EAAE,KAAK,eACvB,YAAY,aAAa,EACvB,aAAa,CAAC,CAAC,WAAW,CAAC,EAC5B,CAAC,CACH,CACF;;CAGH,MAAM,gBACJ,UACA,SACA,YACsB;EACtB,MAAM,EAAE,YAAY,SAAS;EAC7B,MAAM,SAAS,MAAM,KAAK,WAAW,QACnC,SACA,EAAE,EACF,QACD;AAED,SADY,KAAK,WAAW,IAAI,sBAAsB,OAAO;;;;;;;;CAU/D,kBAAyD;AACvD,SAAO,IAAI,gBAA6B;GACtC,GAAG,KAAK;GACR,YAAY,KAAK;GAClB,CAAC;;CAKJ,MAAM,OACJ,OACA,SACiB;EACjB,MAAM,SAAS,MAAM,KAAK,gBAAgB,OAAO,QAAQ;EACzD,IAAI,kBAAkB;AACtB,aAAW,MAAM,SAAS,OACxB,oBAAmB;AAErB,SAAO"}
1
+ {"version":3,"file":"llms.js","names":[],"sources":["../src/llms.ts"],"sourcesContent":["import { CallbackManager, Callbacks } from \"@langchain/core/callbacks/manager\";\nimport { BaseLLM, LLM } from \"@langchain/core/language_models/llms\";\nimport {\n type BaseLanguageModelCallOptions,\n BaseLanguageModelInput,\n} from \"@langchain/core/language_models/base\";\nimport { BaseMessage, MessageContent } from \"@langchain/core/messages\";\nimport { GenerationChunk } from \"@langchain/core/outputs\";\nimport { getEnvironmentVariable } from \"@langchain/core/utils/env\";\n\nimport { AbstractGoogleLLMConnection } from \"./connection.js\";\nimport {\n GoogleAIBaseLLMInput,\n GoogleAIModelParams,\n GoogleAISafetySetting,\n GooglePlatformType,\n GeminiContent,\n GoogleAIResponseMimeType,\n} from \"./types.js\";\nimport {\n copyAIModelParams,\n copyAndValidateModelParamsInto,\n} from \"./utils/common.js\";\nimport { DefaultGeminiSafetyHandler } from \"./utils/gemini.js\";\nimport { ApiKeyGoogleAuth, GoogleAbstractedClient } from \"./auth.js\";\nimport { ensureParams } from \"./utils/failed_handler.js\";\nimport { ChatGoogleBase } from \"./chat_models.js\";\nimport type { GoogleBaseLLMInput, GoogleAISafetyHandler } from \"./types.js\";\n\nexport { GoogleBaseLLMInput };\n\nclass GoogleLLMConnection<AuthOptions> extends AbstractGoogleLLMConnection<\n MessageContent,\n AuthOptions\n> {\n async formatContents(\n input: MessageContent,\n _parameters: GoogleAIModelParams\n ): Promise<GeminiContent[]> {\n const parts = await this.api.messageContentToParts!(input);\n const contents: GeminiContent[] = [\n {\n role: \"user\", // Required by Vertex AI\n parts,\n },\n ];\n return contents;\n }\n}\n\ntype ProxyChatInput<AuthOptions> = GoogleAIBaseLLMInput<AuthOptions> & {\n connection: GoogleLLMConnection<AuthOptions>;\n};\n\nclass ProxyChatGoogle<AuthOptions> extends ChatGoogleBase<AuthOptions> {\n constructor(fields: ProxyChatInput<AuthOptions>) {\n super(fields);\n this._addVersion(\"@langchain/google-common\", __PKG_VERSION__);\n }\n\n buildAbstractedClient(\n fields: ProxyChatInput<AuthOptions>\n ): GoogleAbstractedClient {\n return fields.connection.client;\n }\n}\n\n/**\n * Integration with an LLM.\n */\nexport abstract class GoogleBaseLLM<AuthOptions>\n extends LLM<BaseLanguageModelCallOptions>\n implements GoogleBaseLLMInput<AuthOptions>\n{\n // Used for tracing, replace with the same name as your class\n static lc_name() {\n return \"GoogleLLM\";\n }\n\n get lc_secrets(): { [key: string]: string } | undefined {\n return {\n authOptions: \"GOOGLE_AUTH_OPTIONS\",\n };\n }\n\n originalFields?: GoogleBaseLLMInput<AuthOptions>;\n\n lc_serializable = true;\n\n modelName = \"gemini-pro\";\n\n model = \"gemini-pro\";\n\n temperature = 0.7;\n\n maxOutputTokens = 1024;\n\n topP = 0.8;\n\n topK = 40;\n\n stopSequences: string[] = [];\n\n safetySettings: GoogleAISafetySetting[] = [];\n\n safetyHandler: GoogleAISafetyHandler;\n\n responseMimeType: GoogleAIResponseMimeType = \"text/plain\";\n\n protected connection: GoogleLLMConnection<AuthOptions>;\n\n protected streamedConnection: GoogleLLMConnection<AuthOptions>;\n\n constructor(fields?: GoogleBaseLLMInput<AuthOptions>) {\n super(ensureParams(fields));\n this.originalFields = fields;\n\n copyAndValidateModelParamsInto(fields, this);\n this.safetyHandler =\n fields?.safetyHandler ?? new DefaultGeminiSafetyHandler();\n\n const client = this.buildClient(fields);\n this.buildConnection(fields ?? {}, client);\n }\n\n abstract buildAbstractedClient(\n fields?: GoogleAIBaseLLMInput<AuthOptions>\n ): GoogleAbstractedClient;\n\n buildApiKeyClient(apiKey: string): GoogleAbstractedClient {\n return new ApiKeyGoogleAuth(apiKey);\n }\n\n buildApiKey(fields?: GoogleAIBaseLLMInput<AuthOptions>): string | undefined {\n return fields?.apiKey ?? getEnvironmentVariable(\"GOOGLE_API_KEY\");\n }\n\n buildClient(\n fields?: GoogleAIBaseLLMInput<AuthOptions>\n ): GoogleAbstractedClient {\n const apiKey = this.buildApiKey(fields);\n if (apiKey) {\n return this.buildApiKeyClient(apiKey);\n } else {\n return this.buildAbstractedClient(fields);\n }\n }\n\n buildConnection(\n fields: GoogleBaseLLMInput<AuthOptions>,\n client: GoogleAbstractedClient\n ) {\n this.connection = new GoogleLLMConnection(\n { ...fields, ...this },\n this.caller,\n client,\n false\n );\n\n this.streamedConnection = new GoogleLLMConnection(\n { ...fields, ...this },\n this.caller,\n client,\n true\n );\n }\n\n get platform(): GooglePlatformType {\n return this.connection.platform;\n }\n\n // Replace\n _llmType() {\n return \"googlellm\";\n }\n\n formatPrompt(prompt: string): MessageContent {\n return prompt;\n }\n\n /**\n * For some given input string and options, return a string output.\n *\n * Despite the fact that `invoke` is overridden below, we still need this\n * in order to handle public APi calls to `generate()`.\n */\n async _call(\n prompt: string,\n options: this[\"ParsedCallOptions\"]\n ): Promise<string> {\n const parameters = copyAIModelParams(this, options);\n const result = await this.connection.request(prompt, parameters, options);\n const ret = this.connection.api.responseToString(result);\n return ret;\n }\n\n // Normally, you should not override this method and instead should override\n // _streamResponseChunks. We are doing so here to allow for multimodal inputs into\n // the LLM.\n async *_streamIterator(\n input: BaseLanguageModelInput,\n options?: BaseLanguageModelCallOptions\n ): AsyncGenerator<string> {\n // TODO: Refactor callback setup and teardown code into core\n const prompt = BaseLLM._convertInputToPromptValue(input);\n const [runnableConfig, callOptions] =\n this._separateRunnableConfigFromCallOptions(options);\n const callbackManager_ = await CallbackManager.configure(\n runnableConfig.callbacks,\n this.callbacks,\n runnableConfig.tags,\n this.tags,\n runnableConfig.metadata,\n this.metadata,\n { verbose: this.verbose }\n );\n const extra = {\n options: callOptions,\n invocation_params: this?.invocationParams(callOptions),\n batch_size: 1,\n };\n const runManagers = await callbackManager_?.handleLLMStart(\n this.toJSON(),\n [prompt.toString()],\n undefined,\n undefined,\n extra,\n undefined,\n undefined,\n runnableConfig.runName\n );\n let generation = new GenerationChunk({\n text: \"\",\n });\n const proxyChat = this.createProxyChat();\n try {\n for await (const chunk of proxyChat._streamIterator(input, options)) {\n const stringValue = this.connection.api.chunkToString(chunk);\n const generationChunk = new GenerationChunk({\n text: stringValue,\n });\n generation = generation.concat(generationChunk);\n yield stringValue;\n }\n } catch (err) {\n await Promise.all(\n (runManagers ?? []).map((runManager) => runManager?.handleLLMError(err))\n );\n throw err;\n }\n await Promise.all(\n (runManagers ?? []).map((runManager) =>\n runManager?.handleLLMEnd({\n generations: [[generation]],\n })\n )\n );\n }\n\n async predictMessages(\n messages: BaseMessage[],\n options?: string[] | BaseLanguageModelCallOptions,\n _callbacks?: Callbacks\n ): Promise<BaseMessage> {\n const { content } = messages[0];\n const result = await this.connection.request(\n content,\n {},\n options as BaseLanguageModelCallOptions\n );\n const ret = this.connection.api.responseToBaseMessage(result);\n return ret;\n }\n\n /**\n * Internal implementation detail to allow Google LLMs to support\n * multimodal input by delegating to the chat model implementation.\n *\n * TODO: Replace with something less hacky.\n */\n protected createProxyChat(): ChatGoogleBase<AuthOptions> {\n return new ProxyChatGoogle<AuthOptions>({\n ...this.originalFields,\n connection: this.connection,\n });\n }\n\n // TODO: Remove the need to override this - we are doing it to\n // allow the LLM to handle multimodal types of input.\n async invoke(\n input: BaseLanguageModelInput,\n options?: BaseLanguageModelCallOptions\n ): Promise<string> {\n const stream = await this._streamIterator(input, options);\n let generatedOutput = \"\";\n for await (const chunk of stream) {\n generatedOutput += chunk;\n }\n return generatedOutput;\n }\n}\n"],"mappings":";;;;;;;;;;;AA+BA,IAAM,sBAAN,cAA+C,4BAG7C;CACA,MAAM,eACJ,OACA,aAC0B;AAQ1B,SANkC,CAChC;GACE,MAAM;GACN,OAJU,MAAM,KAAK,IAAI,sBAAuB,MAAM;GAKvD,CACF;;;AASL,IAAM,kBAAN,cAA2C,eAA4B;CACrE,YAAY,QAAqC;AAC/C,QAAM,OAAO;AACb,OAAK,YAAY,4BAAA,SAA4C;;CAG/D,sBACE,QACwB;AACxB,SAAO,OAAO,WAAW;;;;;;AAO7B,IAAsB,gBAAtB,cACU,IAEV;CAEE,OAAO,UAAU;AACf,SAAO;;CAGT,IAAI,aAAoD;AACtD,SAAO,EACL,aAAa,uBACd;;CAGH;CAEA,kBAAkB;CAElB,YAAY;CAEZ,QAAQ;CAER,cAAc;CAEd,kBAAkB;CAElB,OAAO;CAEP,OAAO;CAEP,gBAA0B,EAAE;CAE5B,iBAA0C,EAA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O"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.cjs","names":[],"sources":["../src/types.ts"],"sourcesContent":["import type { BaseLLMParams } from \"@langchain/core/language_models/llms\";\nimport type {\n BaseChatModelCallOptions,\n BindToolsInput,\n} from \"@langchain/core/language_models/chat_models\";\nimport {\n BaseMessage,\n BaseMessageChunk,\n MessageContent,\n} from \"@langchain/core/messages\";\nimport { ChatGenerationChunk, ChatResult } from \"@langchain/core/outputs\";\nimport { EmbeddingsParams } from \"@langchain/core/embeddings\";\nimport { AsyncCallerCallOptions } from \"@langchain/core/utils/async_caller\";\nimport type { JsonStream } from \"./utils/stream.js\";\nimport { MediaManager } from \"./experimental/utils/media_core.js\";\nimport {\n AnthropicResponseData,\n AnthropicAPIConfig,\n} from \"./types-anthropic.js\";\n\nexport * from \"./types-anthropic.js\";\n\n/**\n * Parameters needed to setup the client connection.\n * AuthOptions are something like GoogleAuthOptions (from google-auth-library)\n * or WebGoogleAuthOptions.\n */\nexport interface GoogleClientParams<AuthOptions> {\n authOptions?: AuthOptions;\n\n /** Some APIs allow an API key instead */\n apiKey?: string;\n}\n\n/**\n * What platform is this running on?\n * gai - Google AI Studio / MakerSuite / Generative AI platform\n * gcp - Google Cloud Platform\n */\nexport type GooglePlatformType = \"gai\" | \"gcp\";\n\nexport interface GoogleConnectionParams<\n AuthOptions,\n> extends GoogleClientParams<AuthOptions> {\n /** Hostname for the API call (if this is running on GCP) */\n endpoint?: string;\n\n /** Region where the LLM is stored (if this is running on GCP) */\n location?: string;\n\n /** The version of the API functions. Part of the path. */\n apiVersion?: string;\n\n /**\n * What platform to run the service on.\n * If not specified, the class should determine this from other\n * means. Either way, the platform actually used will be in\n * the \"platform\" getter.\n */\n platformType?: GooglePlatformType;\n\n /**\n * For compatibility with Google's libraries, should this use Vertex?\n * The \"platformType\" parmeter takes precedence.\n */\n vertexai?: boolean;\n}\n\nexport const GoogleAISafetyCategory = {\n Harassment: \"HARM_CATEGORY_HARASSMENT\",\n HARASSMENT: \"HARM_CATEGORY_HARASSMENT\",\n HARM_CATEGORY_HARASSMENT: \"HARM_CATEGORY_HARASSMENT\",\n\n HateSpeech: \"HARM_CATEGORY_HATE_SPEECH\",\n HATE_SPEECH: \"HARM_CATEGORY_HATE_SPEECH\",\n HARM_CATEGORY_HATE_SPEECH: \"HARM_CATEGORY_HATE_SPEECH\",\n\n SexuallyExplicit: \"HARM_CATEGORY_SEXUALLY_EXPLICIT\",\n SEXUALLY_EXPLICIT: \"HARM_CATEGORY_SEXUALLY_EXPLICIT\",\n HARM_CATEGORY_SEXUALLY_EXPLICIT: \"HARM_CATEGORY_SEXUALLY_EXPLICIT\",\n\n Dangerous: \"HARM_CATEGORY_DANGEROUS\",\n DANGEROUS: \"HARM_CATEGORY_DANGEROUS\",\n HARM_CATEGORY_DANGEROUS: \"HARM_CATEGORY_DANGEROUS\",\n\n CivicIntegrity: \"HARM_CATEGORY_CIVIC_INTEGRITY\",\n CIVIC_INTEGRITY: \"HARM_CATEGORY_CIVIC_INTEGRITY\",\n HARM_CATEGORY_CIVIC_INTEGRITY: \"HARM_CATEGORY_CIVIC_INTEGRITY\",\n} as const;\n\nexport type GoogleAISafetyCategory =\n (typeof GoogleAISafetyCategory)[keyof typeof GoogleAISafetyCategory];\n\nexport const GoogleAISafetyThreshold = {\n None: \"BLOCK_NONE\",\n NONE: \"BLOCK_NONE\",\n BLOCK_NONE: \"BLOCK_NONE\",\n\n Few: \"BLOCK_ONLY_HIGH\",\n FEW: \"BLOCK_ONLY_HIGH\",\n BLOCK_ONLY_HIGH: \"BLOCK_ONLY_HIGH\",\n\n Some: \"BLOCK_MEDIUM_AND_ABOVE\",\n SOME: \"BLOCK_MEDIUM_AND_ABOVE\",\n BLOCK_MEDIUM_AND_ABOVE: \"BLOCK_MEDIUM_AND_ABOVE\",\n\n Most: \"BLOCK_LOW_AND_ABOVE\",\n MOST: \"BLOCK_LOW_AND_ABOVE\",\n BLOCK_LOW_AND_ABOVE: \"BLOCK_LOW_AND_ABOVE\",\n\n Off: \"OFF\",\n OFF: \"OFF\",\n BLOCK_OFF: \"OFF\",\n} as const;\n\nexport type GoogleAISafetyThreshold =\n (typeof GoogleAISafetyThreshold)[keyof typeof GoogleAISafetyThreshold];\n\nexport const GoogleAISafetyMethod = {\n Severity: \"SEVERITY\",\n Probability: \"PROBABILITY\",\n} as const;\n\nexport type GoogleAISafetyMethod =\n (typeof GoogleAISafetyMethod)[keyof typeof GoogleAISafetyMethod];\n\nexport interface GoogleAISafetySetting {\n category: GoogleAISafetyCategory | string;\n threshold: GoogleAISafetyThreshold | string;\n method?: GoogleAISafetyMethod | string; // Just for Vertex AI?\n}\n\nexport type GoogleAIResponseMimeType = \"text/plain\" | \"application/json\";\n\nexport type GoogleAIModelModality = \"TEXT\" | \"IMAGE\" | \"AUDIO\" | string;\n\nexport type GoogleThinkingLevel =\n | \"THINKING_LEVEL_UNSPECIFIED\"\n | \"LOW\"\n | \"MEDIUM\"\n | \"HIGH\";\n\nexport interface GoogleThinkingConfig {\n thinkingBudget?: number;\n includeThoughts?: boolean;\n thinkingLevel?: GoogleThinkingLevel;\n}\n\nexport type GooglePrebuiltVoiceName = string;\n\nexport interface GooglePrebuiltVoiceConfig {\n voiceName: GooglePrebuiltVoiceName;\n}\n\nexport interface GoogleVoiceConfig {\n prebuiltVoiceConfig: GooglePrebuiltVoiceConfig;\n}\n\nexport interface GoogleSpeakerVoiceConfig {\n speaker: string;\n voiceConfig: GoogleVoiceConfig;\n}\n\nexport interface GoogleMultiSpeakerVoiceConfig {\n speakerVoiceConfigs: GoogleSpeakerVoiceConfig[];\n}\n\nexport interface GoogleSpeechConfigSingle {\n voiceConfig: GoogleVoiceConfig;\n languageCode?: string;\n}\n\nexport interface GoogleSpeechConfigMulti {\n multiSpeakerVoiceConfig: GoogleMultiSpeakerVoiceConfig;\n languageCode?: string;\n}\n\nexport type GoogleSpeechConfig =\n | GoogleSpeechConfigSingle\n | GoogleSpeechConfigMulti;\n\n/**\n * A simplified version of the GoogleSpeakerVoiceConfig\n */\nexport interface GoogleSpeechSpeakerName {\n speaker: string;\n name: GooglePrebuiltVoiceName;\n}\n\nexport type GoogleSpeechVoice =\n | GooglePrebuiltVoiceName\n | GoogleSpeechSpeakerName\n | GoogleSpeechSpeakerName[];\n\nexport interface GoogleSpeechVoiceLanguage {\n voice: GoogleSpeechVoice;\n languageCode: string;\n}\n\nexport interface GoogleSpeechVoicesLanguage {\n voices: GoogleSpeechVoice;\n languageCode: string;\n}\n\n/**\n * A simplified way to represent the voice (or voices) and language code.\n * \"voice\" and \"voices\" are semantically the same, we're not enforcing\n * that one is an array and one isn't.\n */\nexport type GoogleSpeechSimplifiedLanguage =\n | GoogleSpeechVoiceLanguage\n | GoogleSpeechVoicesLanguage;\n\n/**\n * A simplified way to represent the voices.\n * It can either be the voice (or voices), or the voice or voices with language configuration\n */\nexport type GoogleSpeechConfigSimplified =\n | GoogleSpeechVoice\n | GoogleSpeechSimplifiedLanguage;\n\nexport interface GoogleModelParams {\n /** Model to use */\n model?: string;\n\n /**\n * Model to use\n * Alias for `model`\n */\n modelName?: string;\n}\n\nexport interface GoogleAIModelParams extends GoogleModelParams {\n /** Sampling temperature to use */\n temperature?: number;\n\n /**\n * Maximum number of tokens to generate in the completion.\n * This may include reasoning tokens (for backwards compatibility).\n */\n maxOutputTokens?: number;\n\n /**\n * The maximum number of the output tokens that will be used\n * for the \"thinking\" or \"reasoning\" stages.\n */\n maxReasoningTokens?: number;\n\n /**\n * An alias for \"maxReasoningTokens\"\n */\n thinkingBudget?: number;\n\n /**\n * An OpenAI compatible parameter that will map to \"maxReasoningTokens\"\n */\n reasoningEffort?: \"low\" | \"medium\" | \"high\";\n\n /**\n * Optional. The level of thoughts tokens that the model should generate.\n * Can be specified directly or via reasoningLevel for OpenAI compatibility.\n */\n thinkingLevel?: GoogleThinkingLevel;\n\n /**\n * An OpenAI compatible parameter that will map to \"thinkingLevel\"\n */\n reasoningLevel?: \"low\" | \"medium\" | \"high\";\n\n /**\n * Top-p changes how the model selects tokens for output.\n *\n * Tokens are selected from most probable to least until the sum\n * of their probabilities equals the top-p value.\n *\n * For example, if tokens A, B, and C have a probability of\n * .3, .2, and .1 and the top-p value is .5, then the model will\n * select either A or B as the next token (using temperature).\n */\n topP?: number;\n\n /**\n * Top-k changes how the model selects tokens for output.\n *\n * A top-k of 1 means the selected token is the most probable among\n * all tokens in the model’s vocabulary (also called greedy decoding),\n * while a top-k of 3 means that the next token is selected from\n * among the 3 most probable tokens (using temperature).\n */\n topK?: number;\n\n /**\n * Seed used in decoding. If not set, the request uses a randomly generated seed.\n */\n seed?: number;\n\n /**\n * Presence penalty applied to the next token's logprobs\n * if the token has already been seen in the response.\n * This penalty is binary on/off and not dependant on the\n * number of times the token is used (after the first).\n * Use frequencyPenalty for a penalty that increases with each use.\n * A positive penalty will discourage the use of tokens that have\n * already been used in the response, increasing the vocabulary.\n * A negative penalty will encourage the use of tokens that have\n * already been used in the response, decreasing the vocabulary.\n */\n presencePenalty?: number;\n\n /**\n * Frequency penalty applied to the next token's logprobs,\n * multiplied by the number of times each token has been seen\n * in the respponse so far.\n * A positive penalty will discourage the use of tokens that\n * have already been used, proportional to the number of times\n * the token has been used:\n * The more a token is used, the more dificult it is for the model\n * to use that token again increasing the vocabulary of responses.\n * Caution: A _negative_ penalty will encourage the model to reuse\n * tokens proportional to the number of times the token has been used.\n * Small negative values will reduce the vocabulary of a response.\n * Larger negative values will cause the model to start repeating\n * a common token until it hits the maxOutputTokens limit.\n */\n frequencyPenalty?: number;\n\n stopSequences?: string[];\n\n safetySettings?: GoogleAISafetySetting[];\n\n convertSystemMessageToHumanContent?: boolean;\n\n /**\n * Available for `gemini-1.5-pro`.\n * The output format of the generated candidate text.\n * Supported MIME types:\n * - `text/plain`: Text output.\n * - `application/json`: JSON response in the candidates.\n *\n * @default \"text/plain\"\n */\n responseMimeType?: GoogleAIResponseMimeType;\n\n /**\n * The schema that the model's output should conform to.\n * When this is set, the model will output JSON that conforms to the schema.\n */\n responseSchema?: GeminiJsonSchema;\n\n /**\n * Whether or not to stream.\n * @default false\n */\n streaming?: boolean;\n\n /**\n * Whether to return log probabilities of the output tokens or not.\n * If true, returns the log probabilities of each output token\n * returned in the content of message.\n */\n logprobs?: boolean;\n\n /**\n * An integer between 0 and 5 specifying the number of\n * most likely tokens to return at each token position,\n * each with an associated log probability.\n * logprobs must be set to true if this parameter is used.\n */\n topLogprobs?: number;\n\n /**\n * The modalities of the response.\n */\n responseModalities?: GoogleAIModelModality[];\n\n /**\n * Custom metadata labels to associate with the request.\n * Only supported on Vertex AI (Google Cloud Platform).\n * Labels are key-value pairs where both keys and values must be strings.\n *\n * Example:\n * ```typescript\n * {\n * labels: {\n * \"team\": \"research\",\n * \"component\": \"frontend\",\n * \"environment\": \"production\"\n * }\n * }\n * ```\n */\n labels?: Record<string, string>;\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?: GoogleSpeechConfig | GoogleSpeechConfigSimplified;\n}\n\nexport type GoogleAIToolType = BindToolsInput | GeminiTool;\n\n/**\n * The params which can be passed to the API at request time.\n */\nexport interface GoogleAIModelRequestParams extends GoogleAIModelParams {\n tools?: GoogleAIToolType[];\n /**\n * Force the model to use tools in a specific way.\n *\n * | Mode |\tDescription |\n * |----------|---------------------------------------------------------------------------------------------------------------------------------------------------------|\n * | \"auto\"\t | The default model behavior. The model decides whether to predict a function call or a natural language response. |\n * | \"any\"\t | The model must predict only function calls. To limit the model to a subset of functions, define the allowed function names in `allowed_function_names`. |\n * | \"none\"\t | The model must not predict function calls. This behavior is equivalent to a model request without any associated function declarations. |\n * | string | The string value must be one of the function names. This will force the model to predict the specified function call. |\n *\n * The tool configuration's \"any\" mode (\"forced function calling\") is supported for Gemini 1.5 Pro models only.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n tool_choice?: string | \"auto\" | \"any\" | \"none\" | Record<string, any>;\n /**\n * Allowed functions to call when the mode is \"any\".\n * If empty, any one of the provided functions are called.\n */\n allowed_function_names?: string[];\n\n /**\n * Used to specify a previously created context cache to use with generation.\n * For Vertex, this should be of the form:\n * \"projects/PROJECT_NUMBER/locations/LOCATION/cachedContents/CACHE_ID\",\n *\n * See these guides for more information on how to use context caching:\n * https://cloud.google.com/vertex-ai/generative-ai/docs/context-cache/context-cache-create\n * https://cloud.google.com/vertex-ai/generative-ai/docs/context-cache/context-cache-use\n */\n cachedContent?: string;\n\n /**\n * The schema that the model's output should conform to.\n * When this is set, the model will output JSON that conforms to the schema.\n */\n responseSchema?: GeminiJsonSchema;\n}\n\nexport interface GoogleAIBaseLLMInput<AuthOptions>\n extends\n BaseLLMParams,\n GoogleConnectionParams<AuthOptions>,\n GoogleAIModelParams,\n GoogleAISafetyParams,\n GoogleAIAPIParams {}\n\nexport interface GoogleAIBaseLanguageModelCallOptions\n extends\n BaseChatModelCallOptions,\n GoogleAIModelRequestParams,\n GoogleAISafetyParams {\n /**\n * Whether or not to include usage data, like token counts\n * in the streamed response chunks.\n * @default true\n */\n streamUsage?: boolean;\n}\n\n/**\n * Input to LLM class.\n */\nexport interface GoogleBaseLLMInput<\n AuthOptions,\n> extends GoogleAIBaseLLMInput<AuthOptions> {}\n\nexport interface GoogleResponse {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data: any;\n}\n\nexport interface GoogleRawResponse extends GoogleResponse {\n data: Blob;\n}\n\nexport interface GeminiPartBase {\n thought?: boolean; // Output only\n thoughtSignature?: string;\n}\n\nexport interface GeminiVideoMetadata {\n fps?: number; // Double in range (0.0, 24.0]\n startOffset?: string;\n endOffset?: string;\n}\n\nexport interface GeminiPartBaseFile extends GeminiPartBase {\n videoMetadata?: GeminiVideoMetadata;\n}\n\nexport interface GeminiPartText extends GeminiPartBase {\n text: string;\n}\n\nexport interface GeminiPartInlineData extends GeminiPartBaseFile {\n inlineData: {\n mimeType: string;\n data: string;\n };\n}\n\nexport interface GeminiPartFileData extends GeminiPartBaseFile {\n fileData: {\n mimeType: string;\n fileUri: string;\n };\n}\n\n// AI Studio only?\nexport interface GeminiPartFunctionCall extends GeminiPartBase {\n functionCall: {\n name: string;\n args?: object;\n };\n}\n\n// AI Studio Only?\nexport interface GeminiPartFunctionResponse extends GeminiPartBase {\n functionResponse: {\n name: string;\n response: object;\n };\n}\n\nexport type GeminiPart =\n | GeminiPartText\n | GeminiPartInlineData\n | GeminiPartFileData\n | GeminiPartFunctionCall\n | GeminiPartFunctionResponse;\n\nexport interface GeminiSafetySetting {\n category: string;\n threshold: string;\n}\n\nexport type GeminiSafetyRating = {\n category: string;\n probability: string;\n} & Record<string, unknown>;\n\nexport interface GeminiCitationMetadata {\n citations: GeminiCitation[];\n}\n\nexport interface GeminiCitation {\n startIndex: number;\n endIndex: number;\n uri: string;\n title: string;\n license: string;\n publicationDate: GoogleTypeDate;\n}\n\nexport interface GoogleTypeDate {\n year: number; // 1-9999 or 0 to specify a date without a year\n month: number; // 1-12 or 0 to specify a year without a month and day\n day: number; // Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant\n}\n\nexport interface GeminiGroundingMetadata {\n webSearchQueries?: string[];\n searchEntryPoint?: GeminiSearchEntryPoint;\n groundingChunks: GeminiGroundingChunk[];\n groundingSupports?: GeminiGroundingSupport[];\n retrievalMetadata?: GeminiRetrievalMetadata;\n}\n\nexport interface GeminiSearchEntryPoint {\n renderedContent?: string;\n sdkBlob?: string; // Base64 encoded JSON representing array of tuple.\n}\n\nexport interface GeminiGroundingChunk {\n web: GeminiGroundingChunkWeb;\n retrievedContext: GeminiGroundingChunkRetrievedContext;\n}\n\nexport interface GeminiGroundingChunkWeb {\n uri: string;\n title: string;\n}\n\nexport interface GeminiGroundingChunkRetrievedContext {\n uri: string;\n title: string;\n text: string;\n}\n\nexport interface GeminiGroundingSupport {\n segment: GeminiSegment;\n groundingChunkIndices: number[];\n confidenceScores: number[];\n}\n\nexport interface GeminiSegment {\n partIndex: number;\n startIndex: number;\n endIndex: number;\n text: string;\n}\n\nexport interface GeminiRetrievalMetadata {\n googleSearchDynamicRetrievalScore: number;\n}\n\nexport type GeminiUrlRetrievalStatus =\n | \"URL_RETRIEVAL_STATUS_SUCCESS\"\n | \"URL_RETRIEVAL_STATUS_ERROR\";\n\nexport interface GeminiUrlRetrievalContext {\n retrievedUrl: string;\n urlRetrievalStatus: GeminiUrlRetrievalStatus;\n}\n\nexport interface GeminiUrlRetrievalMetadata {\n urlRetrievalContexts: GeminiUrlRetrievalContext[];\n}\n\nexport type GeminiUrlMetadata = GeminiUrlRetrievalContext;\n\nexport interface GeminiUrlContextMetadata {\n urlMetadata: GeminiUrlMetadata[];\n}\n\nexport interface GeminiLogprobsResult {\n topCandidates: GeminiLogprobsTopCandidate[];\n chosenCandidates: GeminiLogprobsResultCandidate[];\n}\n\nexport interface GeminiLogprobsTopCandidate {\n candidates: GeminiLogprobsResultCandidate[];\n}\n\nexport interface GeminiLogprobsResultCandidate {\n token: string;\n tokenId: number;\n logProbability: number;\n}\n\n// The \"system\" content appears to only be valid in the systemInstruction\nexport type GeminiRole = \"system\" | \"user\" | \"model\" | \"function\";\n\nexport interface GeminiContent {\n parts: GeminiPart[];\n role: GeminiRole; // Vertex AI requires the role\n}\n\n/*\n * If additional attributes are added here, they should also be\n * added to the attributes below\n */\nexport interface GeminiTool {\n functionDeclarations?: GeminiFunctionDeclaration[];\n googleSearchRetrieval?: GoogleSearchRetrieval; // Gemini-1.5\n googleSearch?: GoogleSearch; // Gemini-2.0\n urlContext?: UrlContext;\n retrieval?: VertexAIRetrieval;\n}\n\n/*\n * The known strings in this type should match those in GeminiSearchToolAttribuets\n */\nexport type GoogleSearchToolSetting =\n | boolean\n | \"googleSearchRetrieval\"\n | \"googleSearch\"\n | string;\n\nexport const GeminiSearchToolAttributes = [\n \"googleSearchRetrieval\",\n \"googleSearch\",\n];\n\nexport const GeminiToolAttributes = [\n \"functionDeclaration\",\n \"retrieval\",\n \"urlContext\",\n ...GeminiSearchToolAttributes,\n];\n\nexport interface GoogleSearchRetrieval {\n dynamicRetrievalConfig?: {\n mode?: string;\n dynamicThreshold?: number;\n };\n}\n\nexport interface GoogleSearch {}\n\nexport interface UrlContext {}\n\nexport interface VertexAIRetrieval {\n vertexAiSearch: {\n datastore: string;\n };\n disableAttribution?: boolean;\n}\n\nexport interface GeminiFunctionDeclaration {\n name: string;\n description: string;\n parameters?: GeminiFunctionSchema;\n}\n\nexport interface GeminiFunctionSchema {\n type: GeminiFunctionSchemaType;\n format?: string;\n description?: string;\n nullable?: boolean;\n enum?: string[];\n properties?: Record<string, GeminiFunctionSchema>;\n required?: string[];\n items?: GeminiFunctionSchema;\n}\n\nexport type GeminiFunctionSchemaType =\n | \"string\"\n | \"number\"\n | \"integer\"\n | \"boolean\"\n | \"array\"\n | \"object\";\n\nexport interface GeminiGenerationConfig {\n stopSequences?: string[];\n candidateCount?: number;\n maxOutputTokens?: number;\n temperature?: number;\n topP?: number;\n topK?: number;\n seed?: number;\n presencePenalty?: number;\n frequencyPenalty?: number;\n responseMimeType?: GoogleAIResponseMimeType;\n responseLogprobs?: boolean;\n logprobs?: number;\n responseModalities?: GoogleAIModelModality[];\n thinkingConfig?: GoogleThinkingConfig;\n speechConfig?: GoogleSpeechConfig;\n responseSchema?: GeminiJsonSchema;\n}\n\nexport interface GeminiRequest {\n contents?: GeminiContent[];\n systemInstruction?: GeminiContent;\n tools?: GeminiTool[];\n toolConfig?: {\n functionCallingConfig: {\n mode: \"auto\" | \"any\" | \"none\";\n allowedFunctionNames?: string[];\n };\n };\n safetySettings?: GeminiSafetySetting[];\n generationConfig?: GeminiGenerationConfig;\n cachedContent?: string;\n\n /**\n * Custom metadata labels to associate with the API call.\n */\n labels?: Record<string, string>;\n}\n\nexport interface GeminiResponseCandidate {\n content: {\n parts: GeminiPart[];\n role: string;\n };\n finishReason: string;\n index: number;\n tokenCount?: number;\n safetyRatings: GeminiSafetyRating[];\n citationMetadata?: GeminiCitationMetadata;\n groundingMetadata?: GeminiGroundingMetadata;\n urlRetrievalMetadata?: GeminiUrlRetrievalMetadata;\n urlContextMetadata?: GeminiUrlContextMetadata;\n avgLogprobs?: number;\n logprobsResult: GeminiLogprobsResult;\n finishMessage?: string;\n}\n\ninterface GeminiResponsePromptFeedback {\n blockReason?: string;\n safetyRatings: GeminiSafetyRating[];\n}\n\nexport type ModalityEnum =\n | \"TEXT\"\n | \"IMAGE\"\n | \"VIDEO\"\n | \"AUDIO\"\n | \"DOCUMENT\"\n | string;\n\nexport interface ModalityTokenCount {\n modality: ModalityEnum;\n tokenCount: number;\n}\n\nexport interface GenerateContentResponseUsageMetadata {\n promptTokenCount: number;\n toolUsePromptTokenCount: number;\n cachedContentTokenCount: number;\n thoughtsTokenCount: number;\n candidatesTokenCount: number;\n totalTokenCount: number;\n\n promptTokensDetails: ModalityTokenCount[];\n toolUsePromptTokensDetails: ModalityTokenCount[];\n cacheTokensDetails: ModalityTokenCount[];\n candidatesTokensDetails: ModalityTokenCount[];\n\n [key: string]: unknown;\n}\n\nexport interface GenerateContentResponseData {\n candidates: GeminiResponseCandidate[];\n promptFeedback: GeminiResponsePromptFeedback;\n usageMetadata: GenerateContentResponseUsageMetadata;\n}\n\nexport type GoogleLLMModelFamily = null | \"palm\" | \"gemini\" | \"gemma\";\n\nexport type VertexModelFamily = GoogleLLMModelFamily | \"claude\";\n\nexport type GoogleLLMResponseData =\n | JsonStream\n | GenerateContentResponseData\n | GenerateContentResponseData[];\n\nexport interface GoogleLLMResponse extends GoogleResponse {\n data: GoogleLLMResponseData | AnthropicResponseData;\n}\n\nexport interface GoogleAISafetyHandler {\n /**\n * A function that will take a response and return the, possibly modified,\n * response or throw an exception if there are safety issues.\n *\n * @throws GoogleAISafetyError\n */\n handle(response: GoogleLLMResponse): GoogleLLMResponse;\n}\n\nexport interface GoogleAISafetyParams {\n safetyHandler?: GoogleAISafetyHandler;\n}\n\nexport type GeminiJsonSchema = Record<string, unknown> & {\n properties?: Record<string, GeminiJsonSchema>;\n type: GeminiFunctionSchemaType;\n nullable?: boolean;\n};\n\nexport interface GeminiJsonSchemaDirty extends GeminiJsonSchema {\n items?: GeminiJsonSchemaDirty;\n properties?: Record<string, GeminiJsonSchemaDirty>;\n additionalProperties?: boolean;\n}\n\nexport type GoogleAIAPI = {\n messageContentToParts?: (content: MessageContent) => Promise<GeminiPart[]>;\n\n baseMessageToContent?: (\n message: BaseMessage,\n prevMessage: BaseMessage | undefined,\n useSystemInstruction: boolean\n ) => Promise<GeminiContent[]>;\n\n responseToString: (response: GoogleLLMResponse) => string;\n\n responseToChatGeneration: (\n response: GoogleLLMResponse\n ) => ChatGenerationChunk | null;\n\n chunkToString: (chunk: BaseMessageChunk) => string;\n\n responseToBaseMessage: (response: GoogleLLMResponse) => BaseMessage;\n\n responseToChatResult: (response: GoogleLLMResponse) => ChatResult;\n\n formatData: (\n input: unknown,\n parameters: GoogleAIModelRequestParams\n ) => Promise<unknown>;\n};\n\nexport interface GeminiAPIConfig {\n safetyHandler?: GoogleAISafetyHandler;\n mediaManager?: MediaManager;\n useSystemInstruction?: boolean;\n\n /**\n * How to handle the Google Search tool, since the name (and format)\n * of the tool changes between Gemini 1.5 and Gemini 2.0.\n * true - Change based on the model version. (Default)\n * false - Do not change the tool name provided\n * string value - Use this as the attribute name for the search\n * tool, adapting any tool attributes if possible.\n * When the model is created, a \"true\" or default setting\n * will be changed to a string based on the model.\n */\n googleSearchToolAdjustment?: GoogleSearchToolSetting;\n}\n\nexport type GoogleAIAPIConfig = GeminiAPIConfig | AnthropicAPIConfig;\n\nexport interface GoogleAIAPIParams {\n apiName?: string;\n apiConfig?: GoogleAIAPIConfig;\n}\n\n// Embeddings\n\n/**\n * Defines the parameters required to initialize a\n * GoogleEmbeddings instance. It extends EmbeddingsParams and\n * GoogleConnectionParams.\n */\nexport interface BaseGoogleEmbeddingsParams<AuthOptions>\n extends EmbeddingsParams, GoogleConnectionParams<AuthOptions> {\n model: string;\n\n /**\n * Used to specify output embedding size.\n * If set, output embeddings will be truncated to the size specified.\n */\n dimensions?: number;\n\n /**\n * An alias for \"dimensions\"\n */\n outputDimensionality?: number;\n}\n\n/**\n * Defines additional options specific to the\n * GoogleEmbeddingsInstance. It extends AsyncCallerCallOptions.\n */\nexport interface BaseGoogleEmbeddingsOptions extends AsyncCallerCallOptions {}\n\nexport type GoogleEmbeddingsTaskType =\n | \"RETRIEVAL_QUERY\"\n | \"RETRIEVAL_DOCUMENT\"\n | \"SEMANTIC_SIMILARITY\"\n | \"CLASSIFICATION\"\n | \"CLUSTERING\"\n | \"QUESTION_ANSWERING\"\n | \"FACT_VERIFICATION\"\n | \"CODE_RETRIEVAL_QUERY\"\n | string;\n\n/**\n * Represents an instance for generating embeddings using the Google\n * Vertex AI API. It contains the content to be embedded.\n */\nexport interface VertexEmbeddingsInstance {\n content: string;\n taskType?: GoogleEmbeddingsTaskType;\n title?: string;\n}\n\nexport interface VertexEmbeddingsParameters extends GoogleModelParams {\n autoTruncate?: boolean;\n outputDimensionality?: number;\n}\n\nexport interface VertexEmbeddingsRequest {\n instances: VertexEmbeddingsInstance[];\n parameters?: VertexEmbeddingsParameters;\n}\n\nexport interface AIStudioEmbeddingsRequest {\n content: {\n parts: GeminiPartText[];\n };\n model?: string; // Documentation says required, but tests say otherwise\n taskType?: GoogleEmbeddingsTaskType;\n title?: string;\n outputDimensionality?: number;\n}\n\nexport type GoogleEmbeddingsRequest =\n | VertexEmbeddingsRequest\n | AIStudioEmbeddingsRequest;\n\nexport interface VertexEmbeddingsResponsePrediction {\n embeddings: {\n statistics: {\n token_count: number;\n truncated: boolean;\n };\n values: number[];\n };\n}\n\n/**\n * Defines the structure of the embeddings results returned by the Google\n * Vertex AI API. It extends GoogleBasePrediction and contains the\n * embeddings and their statistics.\n */\nexport interface VertexEmbeddingsResponse extends GoogleResponse {\n data: {\n predictions: VertexEmbeddingsResponsePrediction[];\n };\n}\n\nexport interface AIStudioEmbeddingsResponse extends GoogleResponse {\n data: {\n embedding: {\n values: number[];\n };\n };\n}\n\nexport type GoogleEmbeddingsResponse =\n | VertexEmbeddingsResponse\n | AIStudioEmbeddingsResponse;\n"],"mappings":";;AAoEA,MAAa,yBAAyB;CACpC,YAAY;CACZ,YAAY;CACZ,0BAA0B;CAE1B,YAAY;CACZ,aAAa;CACb,2BAA2B;CAE3B,kBAAkB;CAClB,mBAAmB;CACnB,iCAAiC;CAEjC,WAAW;CACX,WAAW;CACX,yBAAyB;CAEzB,gBAAgB;CAChB,iBAAiB;CACjB,+BAA+B;CAChC;AAKD,MAAa,0BAA0B;CACrC,MAAM;CACN,MAAM;CACN,YAAY;CAEZ,KAAK;CACL,KAAK;CACL,iBAAiB;CAEjB,MAAM;CACN,MAAM;CACN,wBAAwB;CAExB,MAAM;CACN,MAAM;CACN,qBAAqB;CAErB,KAAK;CACL,KAAK;CACL,WAAW;CACZ;AAKD,MAAa,uBAAuB;CAClC,UAAU;CACV,aAAa;CACd;AA6iBD,MAAa,6BAA6B,CACxC,yBACA,eACD;AAED,MAAa,uBAAuB;CAClC;CACA;CACA;CACA,GAAG;CACJ"}
1
+ {"version":3,"file":"types.cjs","names":[],"sources":["../src/types.ts"],"sourcesContent":["import type { BaseLLMParams } from \"@langchain/core/language_models/llms\";\nimport type {\n BaseChatModelCallOptions,\n BindToolsInput,\n} from \"@langchain/core/language_models/chat_models\";\nimport {\n BaseMessage,\n BaseMessageChunk,\n MessageContent,\n} from \"@langchain/core/messages\";\nimport { ChatGenerationChunk, ChatResult } from \"@langchain/core/outputs\";\nimport { EmbeddingsParams } from \"@langchain/core/embeddings\";\nimport { AsyncCallerCallOptions } from \"@langchain/core/utils/async_caller\";\nimport type { JsonStream } from \"./utils/stream.js\";\nimport { MediaManager } from \"./experimental/utils/media_core.js\";\nimport {\n AnthropicResponseData,\n AnthropicAPIConfig,\n} from \"./types-anthropic.js\";\n\nexport * from \"./types-anthropic.js\";\n\n/**\n * Parameters needed to setup the client connection.\n * AuthOptions are something like GoogleAuthOptions (from google-auth-library)\n * or WebGoogleAuthOptions.\n */\nexport interface GoogleClientParams<AuthOptions> {\n authOptions?: AuthOptions;\n\n /** Some APIs allow an API key instead */\n apiKey?: string;\n}\n\n/**\n * What platform is this running on?\n * gai - Google AI Studio / MakerSuite / Generative AI platform\n * gcp - Google Cloud Platform\n */\nexport type GooglePlatformType = \"gai\" | \"gcp\";\n\nexport interface GoogleConnectionParams<\n AuthOptions,\n> extends GoogleClientParams<AuthOptions> {\n /** Hostname for the API call (if this is running on GCP) */\n endpoint?: string;\n\n /** Region where the LLM is stored (if this is running on GCP) */\n location?: string;\n\n /** The version of the API functions. Part of the path. */\n apiVersion?: string;\n\n /**\n * What platform to run the service on.\n * If not specified, the class should determine this from other\n * means. Either way, the platform actually used will be in\n * the \"platform\" getter.\n */\n platformType?: GooglePlatformType;\n\n /**\n * For compatibility with Google's libraries, should this use Vertex?\n * The \"platformType\" parmeter takes precedence.\n */\n vertexai?: boolean;\n}\n\nexport const GoogleAISafetyCategory = {\n Harassment: \"HARM_CATEGORY_HARASSMENT\",\n HARASSMENT: \"HARM_CATEGORY_HARASSMENT\",\n HARM_CATEGORY_HARASSMENT: \"HARM_CATEGORY_HARASSMENT\",\n\n HateSpeech: \"HARM_CATEGORY_HATE_SPEECH\",\n HATE_SPEECH: \"HARM_CATEGORY_HATE_SPEECH\",\n HARM_CATEGORY_HATE_SPEECH: \"HARM_CATEGORY_HATE_SPEECH\",\n\n SexuallyExplicit: \"HARM_CATEGORY_SEXUALLY_EXPLICIT\",\n SEXUALLY_EXPLICIT: \"HARM_CATEGORY_SEXUALLY_EXPLICIT\",\n HARM_CATEGORY_SEXUALLY_EXPLICIT: \"HARM_CATEGORY_SEXUALLY_EXPLICIT\",\n\n Dangerous: \"HARM_CATEGORY_DANGEROUS\",\n DANGEROUS: \"HARM_CATEGORY_DANGEROUS\",\n HARM_CATEGORY_DANGEROUS: \"HARM_CATEGORY_DANGEROUS\",\n\n CivicIntegrity: \"HARM_CATEGORY_CIVIC_INTEGRITY\",\n CIVIC_INTEGRITY: \"HARM_CATEGORY_CIVIC_INTEGRITY\",\n HARM_CATEGORY_CIVIC_INTEGRITY: \"HARM_CATEGORY_CIVIC_INTEGRITY\",\n} as const;\n\nexport type GoogleAISafetyCategory =\n (typeof GoogleAISafetyCategory)[keyof typeof GoogleAISafetyCategory];\n\nexport const GoogleAISafetyThreshold = {\n None: \"BLOCK_NONE\",\n NONE: \"BLOCK_NONE\",\n BLOCK_NONE: \"BLOCK_NONE\",\n\n Few: \"BLOCK_ONLY_HIGH\",\n FEW: \"BLOCK_ONLY_HIGH\",\n BLOCK_ONLY_HIGH: \"BLOCK_ONLY_HIGH\",\n\n Some: \"BLOCK_MEDIUM_AND_ABOVE\",\n SOME: \"BLOCK_MEDIUM_AND_ABOVE\",\n BLOCK_MEDIUM_AND_ABOVE: \"BLOCK_MEDIUM_AND_ABOVE\",\n\n Most: \"BLOCK_LOW_AND_ABOVE\",\n MOST: \"BLOCK_LOW_AND_ABOVE\",\n BLOCK_LOW_AND_ABOVE: \"BLOCK_LOW_AND_ABOVE\",\n\n Off: \"OFF\",\n OFF: \"OFF\",\n BLOCK_OFF: \"OFF\",\n} as const;\n\nexport type GoogleAISafetyThreshold =\n (typeof GoogleAISafetyThreshold)[keyof typeof GoogleAISafetyThreshold];\n\nexport const GoogleAISafetyMethod = {\n Severity: \"SEVERITY\",\n Probability: \"PROBABILITY\",\n} as const;\n\nexport type GoogleAISafetyMethod =\n (typeof GoogleAISafetyMethod)[keyof typeof GoogleAISafetyMethod];\n\nexport interface GoogleAISafetySetting {\n category: GoogleAISafetyCategory | string;\n threshold: GoogleAISafetyThreshold | string;\n method?: GoogleAISafetyMethod | string; // Just for Vertex AI?\n}\n\nexport type GoogleAIResponseMimeType = \"text/plain\" | \"application/json\";\n\nexport type GoogleAIModelModality = \"TEXT\" | \"IMAGE\" | \"AUDIO\" | string;\n\nexport type GoogleThinkingLevel =\n | \"THINKING_LEVEL_UNSPECIFIED\"\n | \"MINIMAL\"\n | \"LOW\"\n | \"MEDIUM\"\n | \"HIGH\";\n\nexport interface GoogleThinkingConfig {\n thinkingBudget?: number;\n includeThoughts?: boolean;\n thinkingLevel?: GoogleThinkingLevel;\n}\n\nexport type GooglePrebuiltVoiceName = string;\n\nexport interface GooglePrebuiltVoiceConfig {\n voiceName: GooglePrebuiltVoiceName;\n}\n\nexport interface GoogleVoiceConfig {\n prebuiltVoiceConfig: GooglePrebuiltVoiceConfig;\n}\n\nexport interface GoogleSpeakerVoiceConfig {\n speaker: string;\n voiceConfig: GoogleVoiceConfig;\n}\n\nexport interface GoogleMultiSpeakerVoiceConfig {\n speakerVoiceConfigs: GoogleSpeakerVoiceConfig[];\n}\n\nexport interface GoogleSpeechConfigSingle {\n voiceConfig: GoogleVoiceConfig;\n languageCode?: string;\n}\n\nexport interface GoogleSpeechConfigMulti {\n multiSpeakerVoiceConfig: GoogleMultiSpeakerVoiceConfig;\n languageCode?: string;\n}\n\nexport type GoogleSpeechConfig =\n | GoogleSpeechConfigSingle\n | GoogleSpeechConfigMulti;\n\n/**\n * A simplified version of the GoogleSpeakerVoiceConfig\n */\nexport interface GoogleSpeechSpeakerName {\n speaker: string;\n name: GooglePrebuiltVoiceName;\n}\n\nexport type GoogleSpeechVoice =\n | GooglePrebuiltVoiceName\n | GoogleSpeechSpeakerName\n | GoogleSpeechSpeakerName[];\n\nexport interface GoogleSpeechVoiceLanguage {\n voice: GoogleSpeechVoice;\n languageCode: string;\n}\n\nexport interface GoogleSpeechVoicesLanguage {\n voices: GoogleSpeechVoice;\n languageCode: string;\n}\n\n/**\n * A simplified way to represent the voice (or voices) and language code.\n * \"voice\" and \"voices\" are semantically the same, we're not enforcing\n * that one is an array and one isn't.\n */\nexport type GoogleSpeechSimplifiedLanguage =\n | GoogleSpeechVoiceLanguage\n | GoogleSpeechVoicesLanguage;\n\n/**\n * A simplified way to represent the voices.\n * It can either be the voice (or voices), or the voice or voices with language configuration\n */\nexport type GoogleSpeechConfigSimplified =\n | GoogleSpeechVoice\n | GoogleSpeechSimplifiedLanguage;\n\nexport interface GoogleModelParams {\n /** Model to use */\n model?: string;\n\n /**\n * Model to use\n * Alias for `model`\n */\n modelName?: string;\n}\n\nexport interface GoogleAIModelParams extends GoogleModelParams {\n /** Sampling temperature to use */\n temperature?: number;\n\n /**\n * Maximum number of tokens to generate in the completion.\n * This may include reasoning tokens (for backwards compatibility).\n */\n maxOutputTokens?: number;\n\n /**\n * The maximum number of the output tokens that will be used\n * for the \"thinking\" or \"reasoning\" stages.\n */\n maxReasoningTokens?: number;\n\n /**\n * An alias for \"maxReasoningTokens\"\n */\n thinkingBudget?: number;\n\n /**\n * An OpenAI compatible parameter that will map to \"maxReasoningTokens\"\n */\n reasoningEffort?: \"low\" | \"medium\" | \"high\";\n\n /**\n * Optional. The level of thoughts tokens that the model should generate.\n * Can be specified directly or via reasoningLevel for OpenAI compatibility.\n */\n thinkingLevel?: GoogleThinkingLevel;\n\n /**\n * An OpenAI compatible parameter that will map to \"thinkingLevel\"\n */\n reasoningLevel?: \"low\" | \"medium\" | \"high\";\n\n /**\n * Top-p changes how the model selects tokens for output.\n *\n * Tokens are selected from most probable to least until the sum\n * of their probabilities equals the top-p value.\n *\n * For example, if tokens A, B, and C have a probability of\n * .3, .2, and .1 and the top-p value is .5, then the model will\n * select either A or B as the next token (using temperature).\n */\n topP?: number;\n\n /**\n * Top-k changes how the model selects tokens for output.\n *\n * A top-k of 1 means the selected token is the most probable among\n * all tokens in the model’s vocabulary (also called greedy decoding),\n * while a top-k of 3 means that the next token is selected from\n * among the 3 most probable tokens (using temperature).\n */\n topK?: number;\n\n /**\n * Seed used in decoding. If not set, the request uses a randomly generated seed.\n */\n seed?: number;\n\n /**\n * Presence penalty applied to the next token's logprobs\n * if the token has already been seen in the response.\n * This penalty is binary on/off and not dependant on the\n * number of times the token is used (after the first).\n * Use frequencyPenalty for a penalty that increases with each use.\n * A positive penalty will discourage the use of tokens that have\n * already been used in the response, increasing the vocabulary.\n * A negative penalty will encourage the use of tokens that have\n * already been used in the response, decreasing the vocabulary.\n */\n presencePenalty?: number;\n\n /**\n * Frequency penalty applied to the next token's logprobs,\n * multiplied by the number of times each token has been seen\n * in the respponse so far.\n * A positive penalty will discourage the use of tokens that\n * have already been used, proportional to the number of times\n * the token has been used:\n * The more a token is used, the more dificult it is for the model\n * to use that token again increasing the vocabulary of responses.\n * Caution: A _negative_ penalty will encourage the model to reuse\n * tokens proportional to the number of times the token has been used.\n * Small negative values will reduce the vocabulary of a response.\n * Larger negative values will cause the model to start repeating\n * a common token until it hits the maxOutputTokens limit.\n */\n frequencyPenalty?: number;\n\n stopSequences?: string[];\n\n safetySettings?: GoogleAISafetySetting[];\n\n convertSystemMessageToHumanContent?: boolean;\n\n /**\n * Available for `gemini-1.5-pro`.\n * The output format of the generated candidate text.\n * Supported MIME types:\n * - `text/plain`: Text output.\n * - `application/json`: JSON response in the candidates.\n *\n * @default \"text/plain\"\n */\n responseMimeType?: GoogleAIResponseMimeType;\n\n /**\n * The schema that the model's output should conform to.\n * When this is set, the model will output JSON that conforms to the schema.\n */\n responseSchema?: GeminiJsonSchema;\n\n /**\n * Whether or not to stream.\n * @default false\n */\n streaming?: boolean;\n\n /**\n * Whether to return log probabilities of the output tokens or not.\n * If true, returns the log probabilities of each output token\n * returned in the content of message.\n */\n logprobs?: boolean;\n\n /**\n * An integer between 0 and 5 specifying the number of\n * most likely tokens to return at each token position,\n * each with an associated log probability.\n * logprobs must be set to true if this parameter is used.\n */\n topLogprobs?: number;\n\n /**\n * The modalities of the response.\n */\n responseModalities?: GoogleAIModelModality[];\n\n /**\n * Custom metadata labels to associate with the request.\n * Only supported on Vertex AI (Google Cloud Platform).\n * Labels are key-value pairs where both keys and values must be strings.\n *\n * Example:\n * ```typescript\n * {\n * labels: {\n * \"team\": \"research\",\n * \"component\": \"frontend\",\n * \"environment\": \"production\"\n * }\n * }\n * ```\n */\n labels?: Record<string, string>;\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?: GoogleSpeechConfig | GoogleSpeechConfigSimplified;\n}\n\nexport type GoogleAIToolType = BindToolsInput | GeminiTool;\n\n/**\n * The params which can be passed to the API at request time.\n */\nexport interface GoogleAIModelRequestParams extends GoogleAIModelParams {\n tools?: GoogleAIToolType[];\n /**\n * Force the model to use tools in a specific way.\n *\n * | Mode |\tDescription |\n * |----------|---------------------------------------------------------------------------------------------------------------------------------------------------------|\n * | \"auto\"\t | The default model behavior. The model decides whether to predict a function call or a natural language response. |\n * | \"any\"\t | The model must predict only function calls. To limit the model to a subset of functions, define the allowed function names in `allowed_function_names`. |\n * | \"none\"\t | The model must not predict function calls. This behavior is equivalent to a model request without any associated function declarations. |\n * | string | The string value must be one of the function names. This will force the model to predict the specified function call. |\n *\n * The tool configuration's \"any\" mode (\"forced function calling\") is supported for Gemini 1.5 Pro models only.\n */\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n tool_choice?: string | \"auto\" | \"any\" | \"none\" | Record<string, any>;\n /**\n * Allowed functions to call when the mode is \"any\".\n * If empty, any one of the provided functions are called.\n */\n allowed_function_names?: string[];\n\n /**\n * Used to specify a previously created context cache to use with generation.\n * For Vertex, this should be of the form:\n * \"projects/PROJECT_NUMBER/locations/LOCATION/cachedContents/CACHE_ID\",\n *\n * See these guides for more information on how to use context caching:\n * https://cloud.google.com/vertex-ai/generative-ai/docs/context-cache/context-cache-create\n * https://cloud.google.com/vertex-ai/generative-ai/docs/context-cache/context-cache-use\n */\n cachedContent?: string;\n\n /**\n * The schema that the model's output should conform to.\n * When this is set, the model will output JSON that conforms to the schema.\n */\n responseSchema?: GeminiJsonSchema;\n}\n\nexport interface GoogleAIBaseLLMInput<AuthOptions>\n extends\n BaseLLMParams,\n GoogleConnectionParams<AuthOptions>,\n GoogleAIModelParams,\n GoogleAISafetyParams,\n GoogleAIAPIParams {}\n\nexport interface GoogleAIBaseLanguageModelCallOptions\n extends\n BaseChatModelCallOptions,\n GoogleAIModelRequestParams,\n GoogleAISafetyParams {\n /**\n * Whether or not to include usage data, like token counts\n * in the streamed response chunks.\n * @default true\n */\n streamUsage?: boolean;\n}\n\n/**\n * Input to LLM class.\n */\nexport interface GoogleBaseLLMInput<\n AuthOptions,\n> extends GoogleAIBaseLLMInput<AuthOptions> {}\n\nexport interface GoogleResponse {\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n data: any;\n}\n\nexport interface GoogleRawResponse extends GoogleResponse {\n data: Blob;\n}\n\nexport interface GeminiPartBase {\n thought?: boolean; // Output only\n thoughtSignature?: string;\n}\n\nexport interface GeminiVideoMetadata {\n fps?: number; // Double in range (0.0, 24.0]\n startOffset?: string;\n endOffset?: string;\n}\n\nexport interface GeminiPartBaseFile extends GeminiPartBase {\n videoMetadata?: GeminiVideoMetadata;\n}\n\nexport interface GeminiPartText extends GeminiPartBase {\n text: string;\n}\n\nexport interface GeminiPartInlineData extends GeminiPartBaseFile {\n inlineData: {\n mimeType: string;\n data: string;\n };\n}\n\nexport interface GeminiPartFileData extends GeminiPartBaseFile {\n fileData: {\n mimeType: string;\n fileUri: string;\n };\n}\n\n// AI Studio only?\nexport interface GeminiPartFunctionCall extends GeminiPartBase {\n functionCall: {\n name: string;\n args?: object;\n };\n}\n\n// AI Studio Only?\nexport interface GeminiPartFunctionResponse extends GeminiPartBase {\n functionResponse: {\n name: string;\n response: object;\n };\n}\n\nexport type GeminiPart =\n | GeminiPartText\n | GeminiPartInlineData\n | GeminiPartFileData\n | GeminiPartFunctionCall\n | GeminiPartFunctionResponse;\n\nexport interface GeminiSafetySetting {\n category: string;\n threshold: string;\n}\n\nexport type GeminiSafetyRating = {\n category: string;\n probability: string;\n} & Record<string, unknown>;\n\nexport interface GeminiCitationMetadata {\n citations: GeminiCitation[];\n}\n\nexport interface GeminiCitation {\n startIndex: number;\n endIndex: number;\n uri: string;\n title: string;\n license: string;\n publicationDate: GoogleTypeDate;\n}\n\nexport interface GoogleTypeDate {\n year: number; // 1-9999 or 0 to specify a date without a year\n month: number; // 1-12 or 0 to specify a year without a month and day\n day: number; // Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant\n}\n\nexport interface GeminiGroundingMetadata {\n webSearchQueries?: string[];\n searchEntryPoint?: GeminiSearchEntryPoint;\n groundingChunks: GeminiGroundingChunk[];\n groundingSupports?: GeminiGroundingSupport[];\n retrievalMetadata?: GeminiRetrievalMetadata;\n}\n\nexport interface GeminiSearchEntryPoint {\n renderedContent?: string;\n sdkBlob?: string; // Base64 encoded JSON representing array of tuple.\n}\n\nexport interface GeminiGroundingChunk {\n web: GeminiGroundingChunkWeb;\n retrievedContext: GeminiGroundingChunkRetrievedContext;\n}\n\nexport interface GeminiGroundingChunkWeb {\n uri: string;\n title: string;\n}\n\nexport interface GeminiGroundingChunkRetrievedContext {\n uri: string;\n title: string;\n text: string;\n}\n\nexport interface GeminiGroundingSupport {\n segment: GeminiSegment;\n groundingChunkIndices: number[];\n confidenceScores: number[];\n}\n\nexport interface GeminiSegment {\n partIndex: number;\n startIndex: number;\n endIndex: number;\n text: string;\n}\n\nexport interface GeminiRetrievalMetadata {\n googleSearchDynamicRetrievalScore: number;\n}\n\nexport type GeminiUrlRetrievalStatus =\n | \"URL_RETRIEVAL_STATUS_SUCCESS\"\n | \"URL_RETRIEVAL_STATUS_ERROR\";\n\nexport interface GeminiUrlRetrievalContext {\n retrievedUrl: string;\n urlRetrievalStatus: GeminiUrlRetrievalStatus;\n}\n\nexport interface GeminiUrlRetrievalMetadata {\n urlRetrievalContexts: GeminiUrlRetrievalContext[];\n}\n\nexport type GeminiUrlMetadata = GeminiUrlRetrievalContext;\n\nexport interface GeminiUrlContextMetadata {\n urlMetadata: GeminiUrlMetadata[];\n}\n\nexport interface GeminiLogprobsResult {\n topCandidates: GeminiLogprobsTopCandidate[];\n chosenCandidates: GeminiLogprobsResultCandidate[];\n}\n\nexport interface GeminiLogprobsTopCandidate {\n candidates: GeminiLogprobsResultCandidate[];\n}\n\nexport interface GeminiLogprobsResultCandidate {\n token: string;\n tokenId: number;\n logProbability: number;\n}\n\n// The \"system\" content appears to only be valid in the systemInstruction\nexport type GeminiRole = \"system\" | \"user\" | \"model\" | \"function\";\n\nexport interface GeminiContent {\n parts: GeminiPart[];\n role: GeminiRole; // Vertex AI requires the role\n}\n\n/*\n * If additional attributes are added here, they should also be\n * added to the attributes below\n */\nexport interface GeminiTool {\n functionDeclarations?: GeminiFunctionDeclaration[];\n googleSearchRetrieval?: GoogleSearchRetrieval; // Gemini-1.5\n googleSearch?: GoogleSearch; // Gemini-2.0\n urlContext?: UrlContext;\n retrieval?: VertexAIRetrieval;\n}\n\n/*\n * The known strings in this type should match those in GeminiSearchToolAttribuets\n */\nexport type GoogleSearchToolSetting =\n | boolean\n | \"googleSearchRetrieval\"\n | \"googleSearch\"\n | string;\n\nexport const GeminiSearchToolAttributes = [\n \"googleSearchRetrieval\",\n \"googleSearch\",\n];\n\nexport const GeminiToolAttributes = [\n \"functionDeclaration\",\n \"retrieval\",\n \"urlContext\",\n ...GeminiSearchToolAttributes,\n];\n\nexport interface GoogleSearchRetrieval {\n dynamicRetrievalConfig?: {\n mode?: string;\n dynamicThreshold?: number;\n };\n}\n\nexport interface GoogleSearch {}\n\nexport interface UrlContext {}\n\nexport interface VertexAIRetrieval {\n vertexAiSearch: {\n datastore: string;\n };\n disableAttribution?: boolean;\n}\n\nexport interface GeminiFunctionDeclaration {\n name: string;\n description: string;\n parameters?: GeminiFunctionSchema;\n}\n\nexport interface GeminiFunctionSchema {\n type: GeminiFunctionSchemaType;\n format?: string;\n description?: string;\n nullable?: boolean;\n enum?: string[];\n properties?: Record<string, GeminiFunctionSchema>;\n required?: string[];\n items?: GeminiFunctionSchema;\n}\n\nexport type GeminiFunctionSchemaType =\n | \"string\"\n | \"number\"\n | \"integer\"\n | \"boolean\"\n | \"array\"\n | \"object\";\n\nexport interface GeminiGenerationConfig {\n stopSequences?: string[];\n candidateCount?: number;\n maxOutputTokens?: number;\n temperature?: number;\n topP?: number;\n topK?: number;\n seed?: number;\n presencePenalty?: number;\n frequencyPenalty?: number;\n responseMimeType?: GoogleAIResponseMimeType;\n responseLogprobs?: boolean;\n logprobs?: number;\n responseModalities?: GoogleAIModelModality[];\n thinkingConfig?: GoogleThinkingConfig;\n speechConfig?: GoogleSpeechConfig;\n responseSchema?: GeminiJsonSchema;\n}\n\nexport interface GeminiRequest {\n contents?: GeminiContent[];\n systemInstruction?: GeminiContent;\n tools?: GeminiTool[];\n toolConfig?: {\n functionCallingConfig: {\n mode: \"auto\" | \"any\" | \"none\";\n allowedFunctionNames?: string[];\n };\n };\n safetySettings?: GeminiSafetySetting[];\n generationConfig?: GeminiGenerationConfig;\n cachedContent?: string;\n\n /**\n * Custom metadata labels to associate with the API call.\n */\n labels?: Record<string, string>;\n}\n\nexport interface GeminiResponseCandidate {\n content: {\n parts: GeminiPart[];\n role: string;\n };\n finishReason: string;\n index: number;\n tokenCount?: number;\n safetyRatings: GeminiSafetyRating[];\n citationMetadata?: GeminiCitationMetadata;\n groundingMetadata?: GeminiGroundingMetadata;\n urlRetrievalMetadata?: GeminiUrlRetrievalMetadata;\n urlContextMetadata?: GeminiUrlContextMetadata;\n avgLogprobs?: number;\n logprobsResult: GeminiLogprobsResult;\n finishMessage?: string;\n}\n\ninterface GeminiResponsePromptFeedback {\n blockReason?: string;\n safetyRatings: GeminiSafetyRating[];\n}\n\nexport type ModalityEnum =\n | \"TEXT\"\n | \"IMAGE\"\n | \"VIDEO\"\n | \"AUDIO\"\n | \"DOCUMENT\"\n | string;\n\nexport interface ModalityTokenCount {\n modality: ModalityEnum;\n tokenCount: number;\n}\n\nexport interface GenerateContentResponseUsageMetadata {\n promptTokenCount: number;\n toolUsePromptTokenCount: number;\n cachedContentTokenCount: number;\n thoughtsTokenCount: number;\n candidatesTokenCount: number;\n totalTokenCount: number;\n\n promptTokensDetails: ModalityTokenCount[];\n toolUsePromptTokensDetails: ModalityTokenCount[];\n cacheTokensDetails: ModalityTokenCount[];\n candidatesTokensDetails: ModalityTokenCount[];\n\n [key: string]: unknown;\n}\n\nexport interface GenerateContentResponseData {\n candidates: GeminiResponseCandidate[];\n promptFeedback: GeminiResponsePromptFeedback;\n usageMetadata: GenerateContentResponseUsageMetadata;\n}\n\nexport type GoogleLLMModelFamily = null | \"palm\" | \"gemini\" | \"gemma\";\n\nexport type VertexModelFamily = GoogleLLMModelFamily | \"claude\";\n\nexport type GoogleLLMResponseData =\n | JsonStream\n | GenerateContentResponseData\n | GenerateContentResponseData[];\n\nexport interface GoogleLLMResponse extends GoogleResponse {\n data: GoogleLLMResponseData | AnthropicResponseData;\n}\n\nexport interface GoogleAISafetyHandler {\n /**\n * A function that will take a response and return the, possibly modified,\n * response or throw an exception if there are safety issues.\n *\n * @throws GoogleAISafetyError\n */\n handle(response: GoogleLLMResponse): GoogleLLMResponse;\n}\n\nexport interface GoogleAISafetyParams {\n safetyHandler?: GoogleAISafetyHandler;\n}\n\nexport type GeminiJsonSchema = Record<string, unknown> & {\n properties?: Record<string, GeminiJsonSchema>;\n type: GeminiFunctionSchemaType;\n nullable?: boolean;\n};\n\nexport interface GeminiJsonSchemaDirty extends GeminiJsonSchema {\n items?: GeminiJsonSchemaDirty;\n properties?: Record<string, GeminiJsonSchemaDirty>;\n additionalProperties?: boolean;\n}\n\nexport type GoogleAIAPI = {\n messageContentToParts?: (content: MessageContent) => Promise<GeminiPart[]>;\n\n baseMessageToContent?: (\n message: BaseMessage,\n prevMessage: BaseMessage | undefined,\n useSystemInstruction: boolean\n ) => Promise<GeminiContent[]>;\n\n responseToString: (response: GoogleLLMResponse) => string;\n\n responseToChatGeneration: (\n response: GoogleLLMResponse\n ) => ChatGenerationChunk | null;\n\n chunkToString: (chunk: BaseMessageChunk) => string;\n\n responseToBaseMessage: (response: GoogleLLMResponse) => BaseMessage;\n\n responseToChatResult: (response: GoogleLLMResponse) => ChatResult;\n\n formatData: (\n input: unknown,\n parameters: GoogleAIModelRequestParams\n ) => Promise<unknown>;\n};\n\nexport interface GeminiAPIConfig {\n safetyHandler?: GoogleAISafetyHandler;\n mediaManager?: MediaManager;\n useSystemInstruction?: boolean;\n\n /**\n * How to handle the Google Search tool, since the name (and format)\n * of the tool changes between Gemini 1.5 and Gemini 2.0.\n * true - Change based on the model version. (Default)\n * false - Do not change the tool name provided\n * string value - Use this as the attribute name for the search\n * tool, adapting any tool attributes if possible.\n * When the model is created, a \"true\" or default setting\n * will be changed to a string based on the model.\n */\n googleSearchToolAdjustment?: GoogleSearchToolSetting;\n}\n\nexport type GoogleAIAPIConfig = GeminiAPIConfig | AnthropicAPIConfig;\n\nexport interface GoogleAIAPIParams {\n apiName?: string;\n apiConfig?: GoogleAIAPIConfig;\n}\n\n// Embeddings\n\n/**\n * Defines the parameters required to initialize a\n * GoogleEmbeddings instance. It extends EmbeddingsParams and\n * GoogleConnectionParams.\n */\nexport interface BaseGoogleEmbeddingsParams<AuthOptions>\n extends EmbeddingsParams, GoogleConnectionParams<AuthOptions> {\n model: string;\n\n /**\n * Used to specify output embedding size.\n * If set, output embeddings will be truncated to the size specified.\n */\n dimensions?: number;\n\n /**\n * An alias for \"dimensions\"\n */\n outputDimensionality?: number;\n}\n\n/**\n * Defines additional options specific to the\n * GoogleEmbeddingsInstance. It extends AsyncCallerCallOptions.\n */\nexport interface BaseGoogleEmbeddingsOptions extends AsyncCallerCallOptions {}\n\nexport type GoogleEmbeddingsTaskType =\n | \"RETRIEVAL_QUERY\"\n | \"RETRIEVAL_DOCUMENT\"\n | \"SEMANTIC_SIMILARITY\"\n | \"CLASSIFICATION\"\n | \"CLUSTERING\"\n | \"QUESTION_ANSWERING\"\n | \"FACT_VERIFICATION\"\n | \"CODE_RETRIEVAL_QUERY\"\n | string;\n\n/**\n * Represents an instance for generating embeddings using the Google\n * Vertex AI API. It contains the content to be embedded.\n */\nexport interface VertexEmbeddingsInstance {\n content: string;\n taskType?: GoogleEmbeddingsTaskType;\n title?: string;\n}\n\nexport interface VertexEmbeddingsParameters extends GoogleModelParams {\n autoTruncate?: boolean;\n outputDimensionality?: number;\n}\n\nexport interface VertexEmbeddingsRequest {\n instances: VertexEmbeddingsInstance[];\n parameters?: VertexEmbeddingsParameters;\n}\n\nexport interface AIStudioEmbeddingsRequest {\n content: {\n parts: GeminiPartText[];\n };\n model?: string; // Documentation says required, but tests say otherwise\n taskType?: GoogleEmbeddingsTaskType;\n title?: string;\n outputDimensionality?: number;\n}\n\nexport type GoogleEmbeddingsRequest =\n | VertexEmbeddingsRequest\n | AIStudioEmbeddingsRequest;\n\nexport interface VertexEmbeddingsResponsePrediction {\n embeddings: {\n statistics: {\n token_count: number;\n truncated: boolean;\n };\n values: number[];\n };\n}\n\n/**\n * Defines the structure of the embeddings results returned by the Google\n * Vertex AI API. It extends GoogleBasePrediction and contains the\n * embeddings and their statistics.\n */\nexport interface VertexEmbeddingsResponse extends GoogleResponse {\n data: {\n predictions: VertexEmbeddingsResponsePrediction[];\n };\n}\n\nexport interface AIStudioEmbeddingsResponse extends GoogleResponse {\n data: {\n embedding: {\n values: number[];\n };\n };\n}\n\nexport type GoogleEmbeddingsResponse =\n | VertexEmbeddingsResponse\n | AIStudioEmbeddingsResponse;\n"],"mappings":";;AAoEA,MAAa,yBAAyB;CACpC,YAAY;CACZ,YAAY;CACZ,0BAA0B;CAE1B,YAAY;CACZ,aAAa;CACb,2BAA2B;CAE3B,kBAAkB;CAClB,mBAAmB;CACnB,iCAAiC;CAEjC,WAAW;CACX,WAAW;CACX,yBAAyB;CAEzB,gBAAgB;CAChB,iBAAiB;CACjB,+BAA+B;CAChC;AAKD,MAAa,0BAA0B;CACrC,MAAM;CACN,MAAM;CACN,YAAY;CAEZ,KAAK;CACL,KAAK;CACL,iBAAiB;CAEjB,MAAM;CACN,MAAM;CACN,wBAAwB;CAExB,MAAM;CACN,MAAM;CACN,qBAAqB;CAErB,KAAK;CACL,KAAK;CACL,WAAW;CACZ;AAKD,MAAa,uBAAuB;CAClC,UAAU;CACV,aAAa;CACd;AA8iBD,MAAa,6BAA6B,CACxC,yBACA,eACD;AAED,MAAa,uBAAuB;CAClC;CACA;CACA;CACA,GAAG;CACJ"}
package/dist/types.d.cts CHANGED
@@ -93,7 +93,7 @@ interface GoogleAISafetySetting {
93
93
  }
94
94
  type GoogleAIResponseMimeType = "text/plain" | "application/json";
95
95
  type GoogleAIModelModality = "TEXT" | "IMAGE" | "AUDIO" | string;
96
- type GoogleThinkingLevel = "THINKING_LEVEL_UNSPECIFIED" | "LOW" | "MEDIUM" | "HIGH";
96
+ type GoogleThinkingLevel = "THINKING_LEVEL_UNSPECIFIED" | "MINIMAL" | "LOW" | "MEDIUM" | "HIGH";
97
97
  interface GoogleThinkingConfig {
98
98
  thinkingBudget?: number;
99
99
  includeThoughts?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.cts","names":[],"sources":["../src/types.ts"],"mappings":";;;;;;;;;;;;AA2BA;;;;UAAiB,kBAAA;EACf,WAAA,GAAc,WAAA;EAAA;EAGd,MAAA;AAAA;;AAQF;;;;KAAY,kBAAA;AAAA,UAEK,sBAAA,sBAEP,kBAAA,CAAmB,WAAA;EAFU;EAIrC,QAAA;EAF2B;EAK3B,QAAA;EALQ;EAQR,UAAA;EAR0B;;;;;;EAgB1B,YAAA,GAAe,kBAAA;EAAf;;;;EAMA,QAAA;AAAA;AAAA,cAGW,sBAAA;EAAA;;;;;;;;;;;;;;;;KAsBD,sBAAA,WACF,sBAAA,eAAqC,sBAAA;AAAA,cAElC,uBAAA;EAAA;;;;;;;;;;;;;;;;KAsBD,uBAAA,WACF,uBAAA,eAAsC,uBAAA;AAAA,cAEnC,oBAAA;EAAA,SAGH,QAAA;EAAA,SAAA,WAAA;AAAA;AAAA,KAEE,oBAAA,WACF,oBAAA,eAAmC,oBAAA;AAAA,UAE5B,qBAAA;EACf,QAAA,EAAU,sBAAA;EACV,SAAA,EAAW,uBAAA;EACX,MAAA,GAAS,oBAAA;AAAA;A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PiB,2BAAA,SAAoC,sBAAA;AAAA,KAEzC,wBAAA;;AA3PZ;;;UA0QiB,wBAAA;EACf,OAAA;EACA,QAAA,GAAW,wBAAA;EACX,KAAA;AAAA;AAAA,UAGe,0BAAA,SAAmC,iBAAA;EAClD,YAAA;EACA,oBAAA;AAAA;AAAA,UAGe,uBAAA;EACf,SAAA,EAAW,wBAAA;EACX,UAAA,GAAa,0BAAA;AAAA;AAAA,UAGE,yBAAA;EACf,OAAA;IACE,KAAA,EAAO,cAAA;EAAA;EAET,KAAA;EACA,QAAA,GAAW,wBAAA;EACX,KAAA;EACA,oBAAA;AAAA;AAAA,KAGU,uBAAA,GACR,uBAAA,GACA,yBAAA;AAAA,UAEa,kCAAA;EACf,UAAA;IACE,UAAA;MACE,WAAA;MACA,SAAA;IAAA;IAEF,MAAA;EAAA;AAAA;;;;;;UASa,wBAAA,SAAiC,cAAA;EAChD,IAAA;IACE,WAAA,EAAa,kCAAA;EAAA;AAAA;AAAA,UAIA,0BAAA,SAAmC,cAAA;EAClD,IAAA;IACE,SAAA;MACE,MAAA;IAAA;EAAA;AAAA;AAAA,KAKM,wBAAA,GACR,wBAAA,GACA,0BAAA"}
package/dist/types.d.ts CHANGED
@@ -93,7 +93,7 @@ interface GoogleAISafetySetting {
93
93
  }
94
94
  type GoogleAIResponseMimeType = "text/plain" | "application/json";
95
95
  type GoogleAIModelModality = "TEXT" | "IMAGE" | "AUDIO" | string;
96
- type GoogleThinkingLevel = "THINKING_LEVEL_UNSPECIFIED" | "LOW" | "MEDIUM" | "HIGH";
96
+ type GoogleThinkingLevel = "THINKING_LEVEL_UNSPECIFIED" | "MINIMAL" | "LOW" | "MEDIUM" | "HIGH";
97
97
  interface GoogleThinkingConfig {
98
98
  thinkingBudget?: number;
99
99
  includeThoughts?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","names":[],"sources":["../src/types.ts"],"mappings":";;;;;;;;;;;;AA2BA;;;;UAAiB,kBAAA;EACf,WAAA,G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