import { ChatResponse, ChatResponseChunk, ChatMessage } from '../../llms/dist/index.js'; import { z } from 'zod/v3'; declare enum NodeRelationship { SOURCE = "SOURCE", PREVIOUS = "PREVIOUS", NEXT = "NEXT", PARENT = "PARENT", CHILD = "CHILD" } declare enum ObjectType { TEXT = "TEXT", IMAGE = "IMAGE", INDEX = "INDEX", DOCUMENT = "DOCUMENT", IMAGE_DOCUMENT = "IMAGE_DOCUMENT" } declare enum MetadataMode { ALL = "ALL", EMBED = "EMBED", LLM = "LLM", NONE = "NONE" } type Metadata = Record; interface RelatedNodeInfo { nodeId: string; nodeType?: ObjectType; metadata: T; hash?: string; } type RelatedNodeType = RelatedNodeInfo | RelatedNodeInfo[]; type BaseNodeParams = { id_?: string | undefined; metadata?: T | undefined; excludedEmbedMetadataKeys?: string[] | undefined; excludedLlmMetadataKeys?: string[] | undefined; relationships?: Partial>> | undefined; hash?: string | undefined; embedding?: number[] | undefined; }; /** * Generic abstract class for retrievable nodes */ declare abstract class BaseNode { /** * The unique ID of the Node/Document. The trailing underscore is here * to avoid collisions with the id keyword in Python. * * Set to a UUID by default. */ id_: string; embedding: number[] | undefined; metadata: T; excludedEmbedMetadataKeys: string[]; excludedLlmMetadataKeys: string[]; relationships: Partial>>; accessor hash: string; protected constructor(init?: BaseNodeParams); abstract get type(): ObjectType; abstract getContent(metadataMode: MetadataMode): string; abstract getMetadataStr(metadataMode: MetadataMode): string; abstract setContent(value: unknown): void; get sourceNode(): RelatedNodeInfo | undefined; get prevNode(): RelatedNodeInfo | undefined; get nextNode(): RelatedNodeInfo | undefined; get parentNode(): RelatedNodeInfo | undefined; get childNodes(): RelatedNodeInfo[] | undefined; abstract generateHash(): string; getEmbedding(): number[]; asRelatedNodeInfo(): RelatedNodeInfo; /** * Called by built in JSON.stringify (see https://javascript.info/json) * Properties are read-only as they are not deep-cloned (not necessary for stringification). * @see toMutableJSON - use to return a mutable JSON instead */ toJSON(): Record; clone(): BaseNode; /** * Converts the object to a JSON representation. * Properties can be safely modified as a deep clone of the properties are created. * @return {Record} - The JSON representation of the object. */ toMutableJSON(): Record; } type TextNodeParams = BaseNodeParams & { text?: string | undefined; textTemplate?: string | undefined; startCharIdx?: number | undefined; endCharIdx?: number | undefined; metadataSeparator?: string | undefined; }; /** * TextNode is the default node type for text. Most common node type in LlamaIndex.TS */ declare class TextNode extends BaseNode { text: string; textTemplate: string; startCharIdx?: number; endCharIdx?: number; metadataSeparator: string; constructor(init?: TextNodeParams); /** * Generate a hash of the text node. * The ID is not part of the hash as it can change independent of content. * @returns */ generateHash(): string; get type(): ObjectType; getContent(metadataMode?: MetadataMode): string; getMetadataStr(metadataMode: MetadataMode): string; setContent(value: string): void; getNodeInfo(): { start: number | undefined; end: number | undefined; }; getText(): string; } type IndexNodeParams = TextNodeParams & { indexId: string; }; declare class IndexNode extends TextNode { indexId: string; constructor(init?: IndexNodeParams); get type(): ObjectType; } /** * A document is just a special text node with a docId. */ declare class Document extends TextNode { constructor(init?: TextNodeParams); get type(): ObjectType; } declare function jsonToNode(json: any, type?: ObjectType): TextNode; type ImageType = string | Blob | URL; type ImageNodeParams = TextNodeParams & { image: ImageType; }; declare class ImageNode extends TextNode { image: ImageType; constructor(init: ImageNodeParams); get type(): ObjectType; getUrl(): URL; private generateImageHash; generateHash(): string; } declare class ImageDocument extends ImageNode { constructor(init: ImageNodeParams); get type(): ObjectType; } /** * A node with a similarity score */ interface NodeWithScore { node: BaseNode; score?: number | undefined; } declare enum ModalityType { TEXT = "TEXT", IMAGE = "IMAGE", AUDIO = "AUDIO" } type NodesByType = { [P in ModalityType]?: BaseNode[]; }; declare function splitNodesByType(nodes: BaseNode[]): NodesByType; declare function buildNodeFromSplits(textSplits: string[], doc: BaseNode, refDoc?: BaseNode, idGenerator?: (idx: number, refDoc: BaseNode) => string): TextNode[]; type StoredValue = Record | null; interface TransformComponentSignature> { >(nodes: BaseNode[], options?: Options): Result; } interface TransformComponent = BaseNode[] | Promise> extends TransformComponentSignature { id: string; } declare class TransformComponent = BaseNode[] | Promise> { constructor(transformFn: TransformComponentSignature); } /** * A reader takes imports data into Document objects. */ interface BaseReader { loadData(...args: unknown[]): Promise; } /** * A FileReader takes file paths and imports data into Document objects. */ declare abstract class FileReader implements BaseReader { abstract loadDataAsContent(fileContent: Uint8Array, filename?: string): Promise; loadData(filePath: string): Promise; static addMetaData(filePath: string): (doc: BaseNode, index: number) => void; } /** * An OutputParser is used to extract structured data from the raw output of the LLM. */ interface BaseOutputParser { parse(output: string): T; format(output: string): string; } declare class EngineResponse implements ChatResponse, ChatResponseChunk { sourceNodes: NodeWithScore[] | undefined; metadata: Metadata; message: ChatMessage; raw: object | null; readonly stream: boolean; private constructor(); static fromResponse(response: string, stream: boolean, sourceNodes: NodeWithScore[]): EngineResponse; private static toChatResponse; static fromChatResponse(chatResponse: ChatResponse, sourceNodes?: NodeWithScore[]): EngineResponse; static fromChatResponseChunk(chunk: ChatResponseChunk, sourceNodes?: NodeWithScore[]): EngineResponse; /** * @deprecated Use `message` instead. */ get response(): string; get delta(): string; toString(): string; } declare const anyFunctionSchema: z.ZodFunction, z.ZodAny>; declare const toolMetadataSchema: z.ZodObject<{ description: z.ZodString; name: z.ZodString; parameters: z.ZodRecord; }, "strip", z.ZodTypeAny, { description: string; name: string; parameters: Record; }, { description: string; name: string; parameters: Record; }>; declare const baseToolSchema: z.ZodObject<{ call: z.ZodOptional, z.ZodAny>>; metadata: z.ZodObject<{ description: z.ZodString; name: z.ZodString; parameters: z.ZodRecord; }, "strip", z.ZodTypeAny, { description: string; name: string; parameters: Record; }, { description: string; name: string; parameters: Record; }>; }, "strip", z.ZodTypeAny, { metadata: { description: string; name: string; parameters: Record; }; call?: ((...args: any[]) => any) | undefined; }, { metadata: { description: string; name: string; parameters: Record; }; call?: ((...args: any[]) => any) | undefined; }>; declare const baseToolWithCallSchema: z.ZodObject<{ metadata: z.ZodObject<{ description: z.ZodString; name: z.ZodString; parameters: z.ZodRecord; }, "strip", z.ZodTypeAny, { description: string; name: string; parameters: Record; }, { description: string; name: string; parameters: Record; }>; } & { call: z.ZodFunction, z.ZodUnknown>; }, "strip", z.ZodTypeAny, { call: (...args: unknown[]) => unknown; metadata: { description: string; name: string; parameters: Record; }; }, { call: (...args: unknown[]) => unknown; metadata: { description: string; name: string; parameters: Record; }; }>; declare const agentParamsSchema: z.ZodArray; }, "strip", z.ZodTypeAny, { description: string; name: string; parameters: Record; }, { description: string; name: string; parameters: Record; }>; } & { call: z.ZodFunction, z.ZodUnknown>; }, "strip", z.ZodTypeAny, { call: (...args: unknown[]) => unknown; metadata: { description: string; name: string; parameters: Record; }; }, { call: (...args: unknown[]) => unknown; metadata: { description: string; name: string; parameters: Record; }; }>, "many">; declare const sentenceSplitterSchema: z.ZodEffects>; chunkOverlap: z.ZodDefault>; separator: z.ZodDefault; paragraphSeparator: z.ZodDefault>; secondaryChunkingRegex: z.ZodDefault>; extraAbbreviations: z.ZodDefault>>; }, "strip", z.ZodTypeAny, { chunkSize: number; chunkOverlap: number; separator: string; paragraphSeparator: string; secondaryChunkingRegex: string; extraAbbreviations: string[]; }, { chunkSize?: number | undefined; chunkOverlap?: number | undefined; separator?: string | undefined; paragraphSeparator?: string | undefined; secondaryChunkingRegex?: string | undefined; extraAbbreviations?: string[] | undefined; }>, { chunkSize: number; chunkOverlap: number; separator: string; paragraphSeparator: string; secondaryChunkingRegex: string; extraAbbreviations: string[]; }, { chunkSize?: number | undefined; chunkOverlap?: number | undefined; separator?: string | undefined; paragraphSeparator?: string | undefined; secondaryChunkingRegex?: string | undefined; extraAbbreviations?: string[] | undefined; }>; declare const sentenceWindowNodeParserSchema: z.ZodObject<{ windowSize: z.ZodDefault; windowMetadataKey: z.ZodDefault; originalTextMetadataKey: z.ZodDefault; }, "strip", z.ZodTypeAny, { windowSize: number; windowMetadataKey: string; originalTextMetadataKey: string; }, { windowSize?: number | undefined; windowMetadataKey?: string | undefined; originalTextMetadataKey?: string | undefined; }>; declare const tokenTextSplitterSchema: z.ZodObject<{ chunkSize: z.ZodDefault; chunkOverlap: z.ZodDefault; separator: z.ZodDefault; backupSeparators: z.ZodDefault>; }, "strip", z.ZodTypeAny, { chunkSize: number; chunkOverlap: number; separator: string; backupSeparators: string[]; }, { chunkSize?: number | undefined; chunkOverlap?: number | undefined; separator?: string | undefined; backupSeparators?: string[] | undefined; }>; type SentenceSplitterParams = z.infer; type TokenTextSplitterParams = z.infer; type SentenceWindowNodeParserParams = z.infer; export { BaseNode, Document, EngineResponse, FileReader, ImageDocument, ImageNode, IndexNode, MetadataMode, ModalityType, NodeRelationship, ObjectType, TextNode, TransformComponent, agentParamsSchema, anyFunctionSchema, baseToolSchema, baseToolWithCallSchema, buildNodeFromSplits, jsonToNode, sentenceSplitterSchema, sentenceWindowNodeParserSchema, splitNodesByType, tokenTextSplitterSchema, toolMetadataSchema }; export type { BaseNodeParams, BaseOutputParser, BaseReader, ImageNodeParams, ImageType, IndexNodeParams, Metadata, NodeWithScore, RelatedNodeInfo, RelatedNodeType, SentenceSplitterParams, SentenceWindowNodeParserParams, StoredValue, TextNodeParams, TokenTextSplitterParams };