Skip to main content

Class: ImageDocument<T>

TextNode is the default node type for text. Most common node type in LlamaIndex.TS

Type parameters

NameType
Textends Metadata = Metadata

Hierarchy

Constructors

constructor

new ImageDocument<T>(init)

Type parameters

NameType
Textends Metadata = Metadata

Parameters

NameType
initImageNodeConstructorProps<T>

Overrides

ImageNode.constructor

Defined in

packages/core/src/Node.ts:332

Properties

embedding

Optional embedding: number[]

Inherited from

ImageNode.embedding

Defined in

packages/core/src/Node.ts:53


endCharIdx

Optional endCharIdx: number

Inherited from

ImageNode.endCharIdx

Defined in

packages/core/src/Node.ts:173


excludedEmbedMetadataKeys

excludedEmbedMetadataKeys: string[] = []

Inherited from

ImageNode.excludedEmbedMetadataKeys

Defined in

packages/core/src/Node.ts:57


excludedLlmMetadataKeys

excludedLlmMetadataKeys: string[] = []

Inherited from

ImageNode.excludedLlmMetadataKeys

Defined in

packages/core/src/Node.ts:58


hash

hash: string = ""

Inherited from

ImageNode.hash

Defined in

packages/core/src/Node.ts:60


id_

id_: string

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.

Inherited from

ImageNode.id_

Defined in

packages/core/src/Node.ts:52


image

image: ImageType

Inherited from

ImageNode.image

Defined in

packages/core/src/Node.ts:313


metadata

metadata: T

Inherited from

ImageNode.metadata

Defined in

packages/core/src/Node.ts:56


metadataSeparator

metadataSeparator: string = "\n"

Inherited from

ImageNode.metadataSeparator

Defined in

packages/core/src/Node.ts:176


relationships

relationships: Partial<Record<NodeRelationship, RelatedNodeType<T>>> = {}

Inherited from

ImageNode.relationships

Defined in

packages/core/src/Node.ts:59


startCharIdx

Optional startCharIdx: number

Inherited from

ImageNode.startCharIdx

Defined in

packages/core/src/Node.ts:172


text

text: string = ""

Inherited from

ImageNode.text

Defined in

packages/core/src/Node.ts:171

Accessors

childNodes

get childNodes(): undefined | RelatedNodeInfo<T>[]

Returns

undefined | RelatedNodeInfo<T>[]

Inherited from

ImageNode.childNodes

Defined in

packages/core/src/Node.ts:114


nextNode

get nextNode(): undefined | RelatedNodeInfo<T>

Returns

undefined | RelatedNodeInfo<T>

Inherited from

ImageNode.nextNode

Defined in

packages/core/src/Node.ts:94


parentNode

get parentNode(): undefined | RelatedNodeInfo<T>

Returns

undefined | RelatedNodeInfo<T>

Inherited from

ImageNode.parentNode

Defined in

packages/core/src/Node.ts:104


prevNode

get prevNode(): undefined | RelatedNodeInfo<T>

Returns

undefined | RelatedNodeInfo<T>

Inherited from

ImageNode.prevNode

Defined in

packages/core/src/Node.ts:82


sourceNode

get sourceNode(): undefined | RelatedNodeInfo<T>

Returns

undefined | RelatedNodeInfo<T>

Inherited from

ImageNode.sourceNode

Defined in

packages/core/src/Node.ts:72

Methods

asRelatedNodeInfo

asRelatedNodeInfo(): RelatedNodeInfo<T>

Returns

RelatedNodeInfo<T>

Inherited from

ImageNode.asRelatedNodeInfo

Defined in

packages/core/src/Node.ts:136


clone

clone(): BaseNode<Metadata>

Returns

BaseNode<Metadata>

Inherited from

ImageNode.clone

Defined in

packages/core/src/Node.ts:153


generateHash

generateHash(): string

Generate a hash of the text node. The ID is not part of the hash as it can change independent of content.

Returns

string

Inherited from

ImageNode.generateHash

Defined in

packages/core/src/Node.ts:194


getContent

getContent(metadataMode?): string

Parameters

NameTypeDefault value
metadataModeMetadataModeMetadataMode.NONE

Returns

string

Inherited from

ImageNode.getContent

Defined in

packages/core/src/Node.ts:208


getEmbedding

getEmbedding(): number[]

Returns

number[]

Inherited from

ImageNode.getEmbedding

Defined in

packages/core/src/Node.ts:128


getMetadataStr

getMetadataStr(metadataMode): string

Parameters

NameType
metadataModeMetadataMode

Returns

string

Inherited from

ImageNode.getMetadataStr

Defined in

packages/core/src/Node.ts:213


getNodeInfo

getNodeInfo(): Object

Returns

Object

NameType
endundefined | number
startundefined | number

Inherited from

ImageNode.getNodeInfo

Defined in

packages/core/src/Node.ts:240


getText

getText(): string

Returns

string

Inherited from

ImageNode.getText

Defined in

packages/core/src/Node.ts:244


getType

getType(): ObjectType

Returns

ObjectType

Overrides

ImageNode.getType

Defined in

packages/core/src/Node.ts:340


getUrl

getUrl(): URL

Returns

URL

Inherited from

ImageNode.getUrl

Defined in

packages/core/src/Node.ts:324


setContent

setContent(value): void

Parameters

NameType
valuestring

Returns

void

Inherited from

ImageNode.setContent

Defined in

packages/core/src/Node.ts:234


toJSON

toJSON(): Record<string, any>

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).

Returns

Record<string, any>

See

toMutableJSON - use to return a mutable JSON instead

Inherited from

ImageNode.toJSON

Defined in

packages/core/src/Node.ts:149


toMutableJSON

toMutableJSON(): Record<string, any>

Converts the object to a JSON representation. Properties can be safely modified as a deep clone of the properties are created.

Returns

Record<string, any>

  • The JSON representation of the object.

Inherited from

ImageNode.toMutableJSON

Defined in

packages/core/src/Node.ts:162