Class: TextNode
TextNode is the default node type for text. Most common node type in LlamaIndex.TS
Hierarchy
Constructors
constructor
• new TextNode(init?
)
Parameters
Name | Type |
---|---|
init? | Partial <TextNode > |
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: Record
<string
, any
> = {}
Inherited from
Defined in
metadataSeparator
• metadataSeparator: string
= "\n"
Defined in
relationships
• relationships: Partial
<Record
<NodeRelationship
, RelatedNodeType
>> = {}
Inherited from
Defined in
startCharIdx
• Optional
startCharIdx: number
Defined in
text
• text: string
= ""
Defined in
Accessors
childNodes
• get
childNodes(): undefined
| RelatedNodeInfo
[]
Returns
undefined
| RelatedNodeInfo
[]
Inherited from
BaseNode.childNodes
Defined in
nextNode
• get
nextNode(): undefined
| RelatedNodeInfo
Returns
undefined
| RelatedNodeInfo
Inherited from
BaseNode.nextNode
Defined in
parentNode
• get
parentNode(): undefined
| RelatedNodeInfo
Returns
undefined
| RelatedNodeInfo
Inherited from
BaseNode.parentNode
Defined in
prevNode
• get
prevNode(): undefined
| RelatedNodeInfo
Returns
undefined
| RelatedNodeInfo
Inherited from
BaseNode.prevNode
Defined in
sourceNode
• get
sourceNode(): undefined
| RelatedNodeInfo
Returns
undefined
| RelatedNodeInfo
Inherited from
BaseNode.sourceNode
Defined in
Methods
asRelatedNodeInfo
▸ asRelatedNodeInfo(): RelatedNodeInfo
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
>
Used with built in JSON.stringify
Returns
Record
<string
, any
>