UNPKG

@langchain/community

Version:
1 lines • 5.44 kB
{"version":3,"file":"googlevertexai.d.cts","names":["GoogleAuthOptions","Embeddings","EmbeddingsParams","GoogleVertexAIBaseLLMInput","GoogleVertexAIBasePrediction","GoogleVertexAILLMResponse","GoogleVertexAIMultimodalEmbeddingsParams","GoogleVertexAIMultimodalEmbeddingsInstance","GoogleVertexAIMultimodalEmbeddingsResults","GoogleVertexAIMedia","Buffer","MediaEmbeddings","GoogleVertexAIMultimodalEmbeddings","Promise"],"sources":["../../../src/experimental/multimodal_embeddings/googlevertexai.d.ts"],"sourcesContent":["import { GoogleAuthOptions } from \"google-auth-library\";\nimport { Embeddings, EmbeddingsParams } from \"@langchain/core/embeddings\";\nimport { GoogleVertexAIBaseLLMInput, GoogleVertexAIBasePrediction } from \"../../types/googlevertexai-types.js\";\nimport { GoogleVertexAILLMResponse } from \"../../utils/googlevertexai-connection.js\";\n/**\n * Parameters for the GoogleVertexAIMultimodalEmbeddings class, extending\n * both EmbeddingsParams and GoogleVertexAIConnectionParams.\n */\nexport interface GoogleVertexAIMultimodalEmbeddingsParams extends EmbeddingsParams, GoogleVertexAIBaseLLMInput<GoogleAuthOptions> {\n}\n/**\n * An instance of media (text or image) that can be used for generating\n * embeddings.\n */\ninterface GoogleVertexAIMultimodalEmbeddingsInstance {\n text?: string;\n image?: {\n bytesBase64Encoded: string;\n };\n}\n/**\n * The results of generating embeddings, extending\n * GoogleVertexAIBasePrediction. It includes text and image embeddings.\n */\ninterface GoogleVertexAIMultimodalEmbeddingsResults extends GoogleVertexAIBasePrediction {\n textEmbedding?: number[];\n imageEmbedding?: number[];\n}\n/**\n * The media should have a text property, an image property, or both.\n */\nexport type GoogleVertexAIMedia = {\n text: string;\n image?: Buffer;\n} | {\n text?: string;\n image: Buffer;\n};\nexport type MediaEmbeddings = {\n text?: number[];\n image?: number[];\n};\n/**\n * Class for generating embeddings for text and images using Google's\n * Vertex AI. It extends the Embeddings base class and implements the\n * GoogleVertexAIMultimodalEmbeddingsParams interface.\n */\nexport declare class GoogleVertexAIMultimodalEmbeddings extends Embeddings implements GoogleVertexAIMultimodalEmbeddingsParams {\n model: string;\n private connection;\n constructor(fields?: GoogleVertexAIMultimodalEmbeddingsParams);\n /**\n * Converts media (text or image) to an instance that can be used for\n * generating embeddings.\n * @param media The media (text or image) to be converted.\n * @returns An instance of media that can be used for generating embeddings.\n */\n mediaToInstance(media: GoogleVertexAIMedia): GoogleVertexAIMultimodalEmbeddingsInstance;\n /**\n * Converts the response from Google Vertex AI to embeddings.\n * @param response The response from Google Vertex AI.\n * @returns An array of media embeddings.\n */\n responseToEmbeddings(response: GoogleVertexAILLMResponse<GoogleVertexAIMultimodalEmbeddingsResults>): MediaEmbeddings[];\n /**\n * Generates embeddings for multiple media instances.\n * @param media An array of media instances.\n * @returns A promise that resolves to an array of media embeddings.\n */\n embedMedia(media: GoogleVertexAIMedia[]): Promise<MediaEmbeddings[]>;\n /**\n * Generates embeddings for a single media instance.\n * @param media A single media instance.\n * @returns A promise that resolves to a media embedding.\n */\n embedMediaQuery(media: GoogleVertexAIMedia): Promise<MediaEmbeddings>;\n /**\n * Generates embeddings for multiple images.\n * @param images An array of images.\n * @returns A promise that resolves to an array of image embeddings.\n */\n embedImage(images: Buffer[]): Promise<number[][]>;\n /**\n * Generates embeddings for a single image.\n * @param image A single image.\n * @returns A promise that resolves to an image embedding.\n */\n embedImageQuery(image: Buffer): Promise<number[]>;\n /**\n * Generates embeddings for multiple text documents.\n * @param documents An array of text documents.\n * @returns A promise that resolves to an array of text document embeddings.\n */\n embedDocuments(documents: string[]): Promise<number[][]>;\n /**\n * Generates embeddings for a single text document.\n * @param document A single text document.\n * @returns A promise that resolves to a text document embedding.\n */\n embedQuery(document: string): Promise<number[]>;\n}\nexport {};\n//# sourceMappingURL=googlevertexai.d.ts.map"],"mappings":";;;;;;;;;AAQA;;AAAkEE,UAAjDI,wCAAAA,SAAiDJ,gBAAAA,EAAkBC,0BAAlBD,CAA6CF,iBAA7CE,CAAAA,CAAAA;AAA4C;AAC7G;AAKmD;AAiBpD;AAOA,UAxBUK,0CAAAA,CAwBiB;EASNK,IAAAA,CAAAA,EAAAA,MAAAA;EAGIN,KAAAA,CAAAA,EAAAA;IAOEG,kBAAAA,EAAAA,MAAAA;EAAsBF,CAAAA;;;;;;UAjCvCC,yCAAAA,SAAkDJ,4BA6CdS,CAAAA;EAMnBJ,aAAAA,CAAAA,EAAAA,MAAAA,EAAAA;EAA8BE,cAAAA,CAAAA,EAAAA,MAAAA,EAAAA;;;;;AAYrBE,KAxDxBJ,mBAAAA,GAwDwBI;EAMKA,IAAAA,EAAAA,MAAAA;EAMPA,KAAAA,CAAAA,EAlEtBH,MAkEsBG;CApD8BZ,GAAAA;EAAsBK,IAAAA,CAAAA,EAAAA,MAAAA;EAAwC,KAAA,EAXnHI,MAWmH;;KATlHC,eAAAA;;;;;;;;;cASSC,kCAAAA,SAA2CX,UAAAA,YAAsBK;;;uBAG7DA;;;;;;;yBAOEG,sBAAsBF;;;;;;iCAMdF,0BAA0BG,6CAA6CG;;;;;;oBAMpFF,wBAAwBI,QAAQF;;;;;;yBAM3BF,sBAAsBI,QAAQF;;;;;;qBAMlCD,WAAWG;;;;;;yBAMPH,SAASG;;;;;;uCAMKA;;;;;;gCAMPA"}