Skip to main content

Class: IndexNode<T>

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

Extends

Type parameters

T extends Metadata = Metadata

Constructors

new IndexNode()

new IndexNode<T>(init?): IndexNode<T>

Parameters

init?: Partial <IndexNode<T>>

Returns

IndexNode<T>

Overrides

TextNode . constructor

Source

packages/core/src/Node.ts:252

Properties

embedding?

optional embedding: number[]

Inherited from

TextNode . embedding

Source

packages/core/src/Node.ts:51


endCharIdx?

optional endCharIdx: number

Inherited from

TextNode . endCharIdx

Source

packages/core/src/Node.ts:174


excludedEmbedMetadataKeys

excludedEmbedMetadataKeys: string[] = []

Inherited from

TextNode . excludedEmbedMetadataKeys

Source

packages/core/src/Node.ts:55


excludedLlmMetadataKeys

excludedLlmMetadataKeys: string[] = []

Inherited from

TextNode . excludedLlmMetadataKeys

Source

packages/core/src/Node.ts:56


hash

hash: string = ""

Inherited from

TextNode . hash

Source

packages/core/src/Node.ts:58


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_

Source

packages/core/src/Node.ts:50


indexId

indexId: string = ""

Source

packages/core/src/Node.ts:250


metadata

metadata: T

Inherited from

TextNode . metadata

Source

packages/core/src/Node.ts:54


metadataSeparator

metadataSeparator: string = "\n"

Inherited from

TextNode . metadataSeparator

Source

packages/core/src/Node.ts:177


relationships

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

Inherited from

TextNode . relationships

Source

packages/core/src/Node.ts:57


startCharIdx?

optional startCharIdx: number

Inherited from

TextNode . startCharIdx

Source

packages/core/src/Node.ts:173


text

text: string = ""

Inherited from

TextNode . text

Source

packages/core/src/Node.ts:170


textTemplate

textTemplate: string = ""

Inherited from

TextNode . textTemplate

Source

packages/core/src/Node.ts:171

Accessors

childNodes

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

Returns

undefined | RelatedNodeInfo<T>[]

Source

packages/core/src/Node.ts:113


nextNode

get nextNode(): undefined | RelatedNodeInfo<T>

Returns

undefined | RelatedNodeInfo<T>

Source

packages/core/src/Node.ts:93


parentNode

get parentNode(): undefined | RelatedNodeInfo<T>

Returns

undefined | RelatedNodeInfo<T>

Source

packages/core/src/Node.ts:103


prevNode

get prevNode(): undefined | RelatedNodeInfo<T>

Returns

undefined | RelatedNodeInfo<T>

Source

packages/core/src/Node.ts:81


sourceNode

get sourceNode(): undefined | RelatedNodeInfo<T>

Returns

undefined | RelatedNodeInfo<T>

Source

packages/core/src/Node.ts:71

Methods

asRelatedNodeInfo()

asRelatedNodeInfo(): RelatedNodeInfo<T>

Returns

RelatedNodeInfo<T>

Inherited from

TextNode . asRelatedNodeInfo

Source

packages/core/src/Node.ts:135


clone()

clone(): BaseNode <Metadata>

Returns

BaseNode <Metadata>

Inherited from

TextNode . clone

Source

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

Source

packages/core/src/Node.ts:195


getContent()

getContent(metadataMode): string

Parameters

metadataMode: MetadataMode= MetadataMode.NONE

Returns

string

Inherited from

TextNode . getContent

Source

packages/core/src/Node.ts:209


getEmbedding()

getEmbedding(): number[]

Returns

number[]

Inherited from

TextNode . getEmbedding

Source

packages/core/src/Node.ts:127


getMetadataStr()

getMetadataStr(metadataMode): string

Parameters

metadataMode: MetadataMode

Returns

string

Inherited from

TextNode . getMetadataStr

Source

packages/core/src/Node.ts:214


getNodeInfo()

getNodeInfo(): object

Returns

object

end

end: undefined | number

start

start: undefined | number

Inherited from

TextNode . getNodeInfo

Source

packages/core/src/Node.ts:240


getText()

getText(): string

Returns

string

Inherited from

TextNode . getText

Source

packages/core/src/Node.ts:244


getType()

getType(): ObjectType

Returns

ObjectType

Overrides

TextNode . getType

Source

packages/core/src/Node.ts:261


setContent()

setContent(value): void

Parameters

value: string

Returns

void

Inherited from

TextNode . setContent

Source

packages/core/src/Node.ts:235


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>

Inherited from

TextNode . toJSON

See

toMutableJSON - use to return a mutable JSON instead

Source

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

Source

packages/core/src/Node.ts:161