Skip to main content

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

Type parameters

NameType
Textends Metadata = Metadata

Parameters

NameType
init?Partial<IndexNode<T>>

Overrides

TextNode.constructor

Defined in

packages/core/src/Node.ts:243

Properties

embedding

Optional embedding: number[]

Inherited from

TextNode.embedding

Defined in

packages/core/src/Node.ts:50


endCharIdx

Optional endCharIdx: number

Inherited from

TextNode.endCharIdx

Defined in

packages/core/src/Node.ts:156


excludedEmbedMetadataKeys

excludedEmbedMetadataKeys: string[] = []

Inherited from

TextNode.excludedEmbedMetadataKeys

Defined in

packages/core/src/Node.ts:54


excludedLlmMetadataKeys

excludedLlmMetadataKeys: string[] = []

Inherited from

TextNode.excludedLlmMetadataKeys

Defined in

packages/core/src/Node.ts:55


hash

hash: string = ""

Inherited from

TextNode.hash

Defined in

packages/core/src/Node.ts:57


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:49


indexId

indexId: string = ""

Defined in

packages/core/src/Node.ts:241


metadata

metadata: T

Inherited from

TextNode.metadata

Defined in

packages/core/src/Node.ts:53


metadataSeparator

metadataSeparator: string = "\n"

Inherited from

TextNode.metadataSeparator

Defined in

packages/core/src/Node.ts:159


relationships

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

Inherited from

TextNode.relationships

Defined in

packages/core/src/Node.ts:56


startCharIdx

Optional startCharIdx: number

Inherited from

TextNode.startCharIdx

Defined in

packages/core/src/Node.ts:155


text

text: string = ""

Inherited from

TextNode.text

Defined in

packages/core/src/Node.ts:154

Accessors

childNodes

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

Returns

undefined | RelatedNodeInfo<T>[]

Inherited from

TextNode.childNodes

Defined in

packages/core/src/Node.ts:111


nextNode

get nextNode(): undefined | RelatedNodeInfo<T>

Returns

undefined | RelatedNodeInfo<T>

Inherited from

TextNode.nextNode

Defined in

packages/core/src/Node.ts:91


parentNode

get parentNode(): undefined | RelatedNodeInfo<T>

Returns

undefined | RelatedNodeInfo<T>

Inherited from

TextNode.parentNode

Defined in

packages/core/src/Node.ts:101


prevNode

get prevNode(): undefined | RelatedNodeInfo<T>

Returns

undefined | RelatedNodeInfo<T>

Inherited from

TextNode.prevNode

Defined in

packages/core/src/Node.ts:79


sourceNode

get sourceNode(): undefined | RelatedNodeInfo<T>

Returns

undefined | RelatedNodeInfo<T>

Inherited from

TextNode.sourceNode

Defined in

packages/core/src/Node.ts:69

Methods

asRelatedNodeInfo

asRelatedNodeInfo(): RelatedNodeInfo<T>

Returns

RelatedNodeInfo<T>

Inherited from

TextNode.asRelatedNodeInfo

Defined in

packages/core/src/Node.ts:133


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:177


getContent

getContent(metadataMode?): string

Parameters

NameTypeDefault value
metadataModeMetadataModeMetadataMode.NONE

Returns

string

Inherited from

TextNode.getContent

Defined in

packages/core/src/Node.ts:191


getEmbedding

getEmbedding(): number[]

Returns

number[]

Inherited from

TextNode.getEmbedding

Defined in

packages/core/src/Node.ts:125


getMetadataStr

getMetadataStr(metadataMode): string

Parameters

NameType
metadataModeMetadataMode

Returns

string

Inherited from

TextNode.getMetadataStr

Defined in

packages/core/src/Node.ts:196


getNodeInfo

getNodeInfo(): Object

Returns

Object

NameType
endundefined | number
startundefined | number

Inherited from

TextNode.getNodeInfo

Defined in

packages/core/src/Node.ts:223


getText

getText(): string

Returns

string

Inherited from

TextNode.getText

Defined in

packages/core/src/Node.ts:227


getType

getType(): ObjectType

Returns

ObjectType

Overrides

TextNode.getType

Defined in

packages/core/src/Node.ts:252


setContent

setContent(value): void

Parameters

NameType
valuestring

Returns

void

Inherited from

TextNode.setContent

Defined in

packages/core/src/Node.ts:217


toJSON

toJSON(): Record<string, any>

Used with built in JSON.stringify

Returns

Record<string, any>

Inherited from

TextNode.toJSON

Defined in

packages/core/src/Node.ts:145