Skip to main content

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>

Defined in

packages/core/schema/dist/index.d.ts:58

Properties

embedding

embedding: undefined | number[]

Defined in

packages/core/schema/dist/index.d.ts:52


excludedEmbedMetadataKeys

excludedEmbedMetadataKeys: string[]

Defined in

packages/core/schema/dist/index.d.ts:54


excludedLlmMetadataKeys

excludedLlmMetadataKeys: string[]

Defined in

packages/core/schema/dist/index.d.ts:55


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.

Defined in

packages/core/schema/dist/index.d.ts:51


metadata

metadata: T

Defined in

packages/core/schema/dist/index.d.ts:53


relationships

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

Defined in

packages/core/schema/dist/index.d.ts:56

Accessors

childNodes

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

Returns

undefined | RelatedNodeInfo<T>[]

Defined in

packages/core/schema/dist/index.d.ts:67


hash

Defined in

packages/core/schema/dist/index.d.ts:57


nextNode

get nextNode(): undefined | RelatedNodeInfo<T>

Returns

undefined | RelatedNodeInfo<T>

Defined in

packages/core/schema/dist/index.d.ts:65


parentNode

get parentNode(): undefined | RelatedNodeInfo<T>

Returns

undefined | RelatedNodeInfo<T>

Defined in

packages/core/schema/dist/index.d.ts:66


prevNode

get prevNode(): undefined | RelatedNodeInfo<T>

Returns

undefined | RelatedNodeInfo<T>

Defined in

packages/core/schema/dist/index.d.ts:64


sourceNode

get sourceNode(): undefined | RelatedNodeInfo<T>

Returns

undefined | RelatedNodeInfo<T>

Defined in

packages/core/schema/dist/index.d.ts:63


type

get abstract type(): ObjectType

Returns

ObjectType

Defined in

packages/core/schema/dist/index.d.ts:59

Methods

asRelatedNodeInfo()

asRelatedNodeInfo(): RelatedNodeInfo<T>

Returns

RelatedNodeInfo<T>

Defined in

packages/core/schema/dist/index.d.ts:70


clone()

clone(): BaseNode<Metadata>

Returns

BaseNode<Metadata>

Defined in

packages/core/schema/dist/index.d.ts:77


generateHash()

abstract generateHash(): string

Returns

string

Defined in

packages/core/schema/dist/index.d.ts:68


getContent()

abstract getContent(metadataMode): string

Parameters

metadataMode: MetadataMode

Returns

string

Defined in

packages/core/schema/dist/index.d.ts:60


getEmbedding()

getEmbedding(): number[]

Returns

number[]

Defined in

packages/core/schema/dist/index.d.ts:69


getMetadataStr()

abstract getMetadataStr(metadataMode): string

Parameters

metadataMode: MetadataMode

Returns

string

Defined in

packages/core/schema/dist/index.d.ts:61


setContent()

abstract setContent(value): void

Parameters

value: unknown

Returns

void

Defined in

packages/core/schema/dist/index.d.ts:62


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

Defined in

packages/core/schema/dist/index.d.ts:76


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.

Defined in

packages/core/schema/dist/index.d.ts:83