@langchain/core
Version:
Core LangChain.js abstractions and schemas
1 lines • 3.42 kB
Source Map (JSON)
{"version":3,"file":"multimodal.cjs","names":[],"sources":["../../../src/messages/content/multimodal.ts"],"sourcesContent":["import { BaseContentBlock } from \"./base.js\";\n\nexport type Multimodal = never;\n\nexport const KNOWN_BLOCK_TYPES = [\n \"image\",\n \"video\",\n \"audio\",\n \"text-plain\",\n \"file\",\n];\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport declare namespace Multimodal {\n type BaseDataRecord = {\n /**\n * MIME type of the file.\n *\n * @see https://www.iana.org/assignments/media-types/media-types.xhtml#image\n */\n mimeType?: string | undefined;\n };\n type DataRecordFileId = BaseDataRecord & {\n /**\n * ID of the data file, e.g. from a provider's file api\n */\n fileId: string;\n url?: never;\n data?: never;\n };\n type DataRecordUrl = BaseDataRecord & {\n fileId?: never;\n /**\n * URL of the data file\n */\n url: string;\n data?: never;\n };\n type DataRecordBase64 = BaseDataRecord & {\n fileId?: never;\n url?: never;\n /**\n * MIME type of the file. Required for base64 encoding.\n *\n * @see https://www.iana.org/assignments/media-types/media-types.xhtml#image\n */\n mimeType: string;\n /**\n * Base64 encoded string or binary data of the data\n */\n data: string | Uint8Array;\n };\n type DataRecord = DataRecordFileId | DataRecordUrl | DataRecordBase64;\n\n /** Content block for multimodal data */\n export type Data<TMetadata = Record<string, unknown>> = BaseContentBlock &\n DataRecord & {\n /**\n * MIME type of the file. Required for base64 encoding.\n */\n mimeType?: string;\n /**\n * Metadata of the file\n */\n metadata?: TMetadata;\n /**\n * Content block identifier for multimodal content, e.g. image, video, audio, file or plain text. This can be either:\n * - generated by the provider (e.g., an OpenAI block ID)\n * - generated by LangChain upon creation\n */\n id?: string;\n };\n\n /** Content block for image data */\n export type Image = Data & {\n /** Type of the content block */\n readonly type: \"image\";\n };\n /** Content block for video data */\n export type Video = Data & {\n /** Type of the content block */\n readonly type: \"video\";\n };\n /** Content block for audio data */\n export type Audio = Data & {\n /** Type of the content block */\n readonly type: \"audio\";\n };\n /** Content block for plain text data */\n export type PlainText = Data & {\n /** Type of the content block */\n readonly type: \"text-plain\";\n /**\n * Plaintext content. This is optional if the data is base64 encoded.\n */\n text?: string;\n /**\n * Title of the file, e.g. the title of a document\n */\n title?: string;\n /**\n * Context for the text, e.g. a description or a summary of the text's content\n */\n context?: string;\n };\n\n /** Content block for file data */\n export type File = Data & {\n /**\n * Non-descript multimodal content block\n *\n * This block is intended for files that aren't covered by existing content block types.\n */\n readonly type: \"file\";\n };\n\n export type Standard = Image | Video | Audio | PlainText | File;\n}\n"],"mappings":";;AAIA,MAAa,oBAAoB;CAC/B;CACA;CACA;CACA;CACA;AACD"}