Zum Hauptinhalt springen

Class: ImageNode<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 ImageNode<T>(init)

Type parameters

NameType
Textends Metadata = Metadata

Parameters

NameType
initImageNodeConstructorProps<T>

Overrides

TextNode.constructor

Defined in

packages/core/src/Node.ts:314

Properties

embedding

Optional embedding: number[]

Inherited from

TextNode.embedding

Defined in

packages/core/src/Node.ts:52


endCharIdx

Optional endCharIdx: number

Inherited from

TextNode.endCharIdx

Defined in

packages/core/src/Node.ts:172


excludedEmbedMetadataKeys

excludedEmbedMetadataKeys: string[] = []

Inherited from

TextNode.excludedEmbedMetadataKeys

Defined in

packages/core/src/Node.ts:56


excludedLlmMetadataKeys

excludedLlmMetadataKeys: string[] = []

Inherited from

TextNode.excludedLlmMetadataKeys

Defined in

packages/core/src/Node.ts:57


hash

hash: string = ""

Inherited from

TextNode.hash

Defined in

packages/core/src/Node.ts:59


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

TextNode.id_

Defined in

packages/core/src/Node.ts:51


image

image: ImageType

Defined in

packages/core/src/Node.ts:312


metadata

metadata: T

Inherited from

TextNode.metadata

Defined in

packages/core/src/Node.ts:55


metadataSeparator

metadataSeparator: string = "\n"

Inherited from

TextNode.metadataSeparator

Defined in

packages/core/src/Node.ts:175


relationships

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

Inherited from

TextNode.relationships

Defined in

packages/core/src/Node.ts:58


startCharIdx

Optional startCharIdx: number

Inherited from

TextNode.startCharIdx

Defined in

packages/core/src/Node.ts:171


text

text: string = ""

Inherited from

TextNode.text

Defined in

packages/core/src/Node.ts:170

Accessors

childNodes

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

Returns

undefined | RelatedNodeInfo<T>[]

Inherited from

TextNode.childNodes

Defined in

packages/core/src/Node.ts:113


nextNode

get nextNode(): undefined | RelatedNodeInfo<T>

Returns

undefined | RelatedNodeInfo<T>

Inherited from

TextNode.nextNode

Defined in

packages/core/src/Node.ts:93


parentNode

get parentNode(): undefined | RelatedNodeInfo<T>

Returns

undefined | RelatedNodeInfo<T>

Inherited from

TextNode.parentNode

Defined in

packages/core/src/Node.ts:103


prevNode

get prevNode(): undefined | RelatedNodeInfo<T>

Returns

undefined | RelatedNodeInfo<T>

Inherited from

TextNode.prevNode

Defined in

packages/core/src/Node.ts:81


sourceNode

get sourceNode(): undefined | RelatedNodeInfo<T>

Returns

undefined | RelatedNodeInfo<T>

Inherited from

TextNode.sourceNode

Defined in

packages/core/src/Node.ts:71

Methods

asRelatedNodeInfo

asRelatedNodeInfo(): RelatedNodeInfo<T>

Returns

RelatedNodeInfo<T>

Inherited from

TextNode.asRelatedNodeInfo

Defined in

packages/core/src/Node.ts:135


clone

clone(): BaseNode<Metadata>

Returns

BaseNode<Metadata>

Inherited from

TextNode.clone

Defined in

packages/core/src/Node.ts:152


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

TextNode.generateHash

Defined in

packages/core/src/Node.ts:193


getContent

getContent(metadataMode?): string

Parameters

NameTypeDefault value
metadataModeMetadataModeMetadataMode.NONE

Returns

string

Inherited from

TextNode.getContent

Defined in

packages/core/src/Node.ts:207


getEmbedding

getEmbedding(): number[]

Returns

number[]

Inherited from

TextNode.getEmbedding

Defined in

packages/core/src/Node.ts:127


getMetadataStr

getMetadataStr(metadataMode): string

Parameters

NameType
metadataModeMetadataMode

Returns

string

Inherited from

TextNode.getMetadataStr

Defined in

packages/core/src/Node.ts:212


getNodeInfo

getNodeInfo(): Object

Returns

Object

NameType
endundefined | number
startundefined | number

Inherited from

TextNode.getNodeInfo

Defined in

packages/core/src/Node.ts:239


getText

getText(): string

Returns

string

Inherited from

TextNode.getText

Defined in

packages/core/src/Node.ts:243


getType

getType(): ObjectType

Returns

ObjectType

Overrides

TextNode.getType

Defined in

packages/core/src/Node.ts:319


getUrl

getUrl(): URL

Returns

URL

Defined in

packages/core/src/Node.ts:323


setContent

setContent(value): void

Parameters

NameType
valuestring

Returns

void

Inherited from

TextNode.setContent

Defined in

packages/core/src/Node.ts:233


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

TextNode.toJSON

Defined in

packages/core/src/Node.ts:148


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

TextNode.toMutableJSON

Defined in

packages/core/src/Node.ts:161