Class: TextNode<T>
TextNode is the default node type for text. Most common node type in LlamaIndex.TS
Type parameters
Name | Type |
---|---|
T | extends Metadata = Metadata |
Hierarchy
Constructors
constructor
• new TextNode<T
>(init?
): TextNode
<T
>
Type parameters
Name | Type |
---|---|
T | extends Metadata = Metadata |
Parameters
Name | Type |
---|---|
init? | Partial <TextNode <T >> |
Returns
TextNode
<T
>
Overrides
Defined in
Properties
embedding
• Optional
embedding: number
[]
Inherited from
Defined in
endCharIdx
• Optional
endCharIdx: number
Defined in
excludedEmbedMetadataKeys
• excludedEmbedMetadataKeys: string
[] = []
Inherited from
BaseNode.excludedEmbedMetadataKeys
Defined in
excludedLlmMetadataKeys
• excludedLlmMetadataKeys: string
[] = []
Inherited from
BaseNode.excludedLlmMetadataKeys
Defined in
hash
• hash: string
= ""
Inherited from
Defined in
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
Defined in
metadata
• metadata: T
Inherited from
Defined in
metadataSeparator
• metadataSeparator: string
= "\n"
Defined in
relationships
• relationships: Partial
<Record
<NodeRelationship
, RelatedNodeType
<T
>>> = {}
Inherited from
Defined in
startCharIdx
• Optional
startCharIdx: number
Defined in
text
• text: string
= ""
Defined in
textTemplate
• textTemplate: string
= ""
Defined in
Accessors
childNodes
• get
childNodes(): undefined
| RelatedNodeInfo
<T
>[]
Returns
undefined
| RelatedNodeInfo
<T
>[]
Inherited from
BaseNode.childNodes
Defined in
nextNode
• get
nextNode(): undefined
| RelatedNodeInfo
<T
>
Returns
undefined
| RelatedNodeInfo
<T
>
Inherited from
BaseNode.nextNode
Defined in
parentNode
• get
parentNode(): undefined
| RelatedNodeInfo
<T
>
Returns
undefined
| RelatedNodeInfo
<T
>
Inherited from
BaseNode.parentNode
Defined in
prevNode
• get
prevNode(): undefined
| RelatedNodeInfo
<T
>
Returns
undefined
| RelatedNodeInfo
<T
>
Inherited from
BaseNode.prevNode
Defined in
sourceNode
• get
sourceNode(): undefined
| RelatedNodeInfo
<T
>
Returns
undefined
| RelatedNodeInfo
<T
>
Inherited from
BaseNode.sourceNode
Defined in
Methods
asRelatedNodeInfo
▸ asRelatedNodeInfo(): RelatedNodeInfo
<T
>
Returns
Inherited from
Defined in
clone
Returns
Inherited from
Defined in
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
Overrides
Defined in
getContent
▸ getContent(metadataMode?
): string
Parameters
Name | Type | Default value |
---|---|---|
metadataMode | MetadataMode | MetadataMode.NONE |
Returns
string
Overrides
Defined in
getEmbedding
▸ getEmbedding(): number
[]
Returns
number
[]
Inherited from
Defined in
getMetadataStr
▸ getMetadataStr(metadataMode
): string
Parameters
Name | Type |
---|---|
metadataMode | MetadataMode |
Returns
string
Overrides
Defined in
getNodeInfo
▸ getNodeInfo(): Object
Returns
Object
Name | Type |
---|---|
end | undefined | number |
start | undefined | number |
Defined in
getText
▸ getText(): string
Returns
string
Defined in
getType
▸ getType(): ObjectType
Returns
Overrides
Defined in
setContent
▸ setContent(value
): void
Parameters
Name | Type |
---|---|
value | string |
Returns
void
Overrides
Defined in
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
Defined in
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.