Ana içeriğe geç

Class: abstract BaseNode<T>

Generic abstract class for retrievable nodes

Extended by

Type parameters

T extends Metadata = Metadata

Constructors

new BaseNode()

protected new BaseNode<T>(init?): BaseNode<T>

Parameters

init?: BaseNodeParams<T>

Returns

BaseNode<T>

Source

packages/llamaindex/src/Node.ts:72

Properties

embedding?

optional embedding: number[]

Source

packages/llamaindex/src/Node.ts:61


excludedEmbedMetadataKeys

excludedEmbedMetadataKeys: string[]

Source

packages/llamaindex/src/Node.ts:65


excludedLlmMetadataKeys

excludedLlmMetadataKeys: string[]

Source

packages/llamaindex/src/Node.ts:66


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.

Source

packages/llamaindex/src/Node.ts:60


metadata

metadata: T

Source

packages/llamaindex/src/Node.ts:64


relationships

relationships: Partial<Record <NodeRelationship, RelatedNodeType<T>>>

Source

packages/llamaindex/src/Node.ts:67

Accessors

childNodes

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

Returns

undefined | RelatedNodeInfo<T>[]

Source

packages/llamaindex/src/Node.ts:139


hash


nextNode

get nextNode(): undefined | RelatedNodeInfo<T>

Returns

undefined | RelatedNodeInfo<T>

Source

packages/llamaindex/src/Node.ts:119


parentNode

get parentNode(): undefined | RelatedNodeInfo<T>

Returns

undefined | RelatedNodeInfo<T>

Source

packages/llamaindex/src/Node.ts:129


prevNode

get prevNode(): undefined | RelatedNodeInfo<T>

Returns

undefined | RelatedNodeInfo<T>

Source

packages/llamaindex/src/Node.ts:107


sourceNode

get sourceNode(): undefined | RelatedNodeInfo<T>

Returns

undefined | RelatedNodeInfo<T>

Source

packages/llamaindex/src/Node.ts:97


type

get abstract type(): ObjectType

Returns

ObjectType

Source

packages/llamaindex/src/Node.ts:90

Methods

asRelatedNodeInfo()

asRelatedNodeInfo(): RelatedNodeInfo<T>

Returns

RelatedNodeInfo<T>

Source

packages/llamaindex/src/Node.ts:161


clone()

clone(): BaseNode <Metadata>

Returns

BaseNode <Metadata>

Source

packages/llamaindex/src/Node.ts:183


generateHash()

abstract generateHash(): string

Returns

string

Source

packages/llamaindex/src/Node.ts:151


getContent()

abstract getContent(metadataMode): string

Parameters

metadataMode: MetadataMode

Returns

string

Source

packages/llamaindex/src/Node.ts:92


getEmbedding()

getEmbedding(): number[]

Returns

number[]

Source

packages/llamaindex/src/Node.ts:153


getMetadataStr()

abstract getMetadataStr(metadataMode): string

Parameters

metadataMode: MetadataMode

Returns

string

Source

packages/llamaindex/src/Node.ts:93


setContent()

abstract setContent(value): void

Parameters

value: unknown

Returns

void

Source

packages/llamaindex/src/Node.ts:95


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

Source

packages/llamaindex/src/Node.ts:174


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.

Source

packages/llamaindex/src/Node.ts:192