Class: TextNode<T>
TextNode is the default node type for text. Most common node type in LlamaIndex.TS
Extends
BaseNode
<T
>
Extended by
Type parameters
• T extends Metadata
= Metadata
Constructors
new TextNode()
new TextNode<
T
>(init
):TextNode
<T
>
Parameters
• init: TextNodeParams
<T
>= {}
Returns
TextNode
<T
>
Overrides
Source
Properties
embedding?
optional
embedding:number
[]
Inherited from
Source
endCharIdx?
optional
endCharIdx:number
Source
excludedEmbedMetadataKeys
excludedEmbedMetadataKeys:
string
[]
Inherited from
BaseNode
. excludedEmbedMetadataKeys
Source
excludedLlmMetadataKeys
excludedLlmMetadataKeys:
string
[]
Inherited from
BaseNode
. excludedLlmMetadataKeys
Source
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
Source
metadata
metadata:
T
Inherited from
Source
metadataSeparator
metadataSeparator:
string
Source
relationships
relationships:
Partial
<Record
<NodeRelationship
,RelatedNodeType
<T
>>>
Inherited from
Source
startCharIdx?
optional
startCharIdx:number
Source
text
text:
string
Source
textTemplate
textTemplate:
string
Source
Accessors
childNodes
get
childNodes():undefined
|RelatedNodeInfo
<T
>[]
Returns
undefined
| RelatedNodeInfo
<T
>[]
Source
hash
nextNode
get
nextNode():undefined
|RelatedNodeInfo
<T
>
Returns
undefined
| RelatedNodeInfo
<T
>
Source
parentNode
get
parentNode():undefined
|RelatedNodeInfo
<T
>
Returns
undefined
| RelatedNodeInfo
<T
>
Source
prevNode
get
prevNode():undefined
|RelatedNodeInfo
<T
>
Returns
undefined
| RelatedNodeInfo
<T
>
Source
sourceNode
get
sourceNode():undefined
|RelatedNodeInfo
<T
>
Returns
undefined
| RelatedNodeInfo
<T
>
Source
type
get
type():ObjectType
Returns
Source
Methods
asRelatedNodeInfo()
asRelatedNodeInfo():
RelatedNodeInfo
<T
>
Returns
Inherited from
Source
clone()
Returns
Inherited from
Source
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
Source
getContent()
getContent(
metadataMode
):string
Parameters
• metadataMode: MetadataMode
= MetadataMode.NONE
Returns
string
Overrides
Source
getEmbedding()
getEmbedding():
number
[]
Returns
number
[]
Inherited from
Source
getMetadataStr()
getMetadataStr(
metadataMode
):string
Parameters
• metadataMode: MetadataMode
Returns
string
Overrides
Source
getNodeInfo()
getNodeInfo():
object
Returns
object
end
end:
undefined
|number
start
start:
undefined
|number
Source
getText()
getText():
string
Returns
string
Source
setContent()
setContent(
value
):void
Parameters
• value: string
Returns
void
Overrides
Source
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
See
toMutableJSON - use to return a mutable JSON instead