Class: Document<T>
A document is just a special text node with a docId.
Type parameters
Name | Type |
---|---|
T | extends Metadata = Metadata |
Hierarchy
-
TextNode
<T
>↳
Document
Constructors
constructor
• new Document<T
>(init?
)
Type parameters
Name | Type |
---|---|
T | extends Metadata = Metadata |
Parameters
Name | Type |
---|---|
init? | Partial <Document <T >> |
Overrides
Defined in
Properties
embedding
• Optional
embedding: number
[]
Inherited from
Defined in
endCharIdx
• Optional
endCharIdx: number
Inherited from
Defined in
excludedEmbedMetadataKeys
• excludedEmbedMetadataKeys: string
[] = []
Inherited from
TextNode.excludedEmbedMetadataKeys
Defined in
excludedLlmMetadataKeys
• excludedLlmMetadataKeys: string
[] = []
Inherited from
TextNode.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"
Inherited from
Defined in
relationships
• relationships: Partial
<Record
<NodeRelationship
, RelatedNodeType
<T
>>> = {}
Inherited from
Defined in
startCharIdx
• Optional
startCharIdx: number
Inherited from
Defined in
text
• text: string
= ""
Inherited from
Defined in
Accessors
childNodes
• get
childNodes(): undefined
| RelatedNodeInfo
<T
>[]
Returns
undefined
| RelatedNodeInfo
<T
>[]
Inherited from
TextNode.childNodes
Defined in
nextNode
• get
nextNode(): undefined
| RelatedNodeInfo
<T
>
Returns
undefined
| RelatedNodeInfo
<T
>
Inherited from
TextNode.nextNode
Defined in
parentNode
• get
parentNode(): undefined
| RelatedNodeInfo
<T
>
Returns
undefined
| RelatedNodeInfo
<T
>
Inherited from
TextNode.parentNode
Defined in
prevNode
• get
prevNode(): undefined
| RelatedNodeInfo
<T
>
Returns
undefined
| RelatedNodeInfo
<T
>
Inherited from
TextNode.prevNode
Defined in
sourceNode
• get
sourceNode(): undefined
| RelatedNodeInfo
<T
>
Returns
undefined
| RelatedNodeInfo
<T
>
Inherited from
TextNode.sourceNode
Defined in
Methods
asRelatedNodeInfo
▸ asRelatedNodeInfo(): RelatedNodeInfo
<T
>
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
Inherited from
Defined in
getContent
▸ getContent(metadataMode?
): string
Parameters
Name | Type | Default value |
---|---|---|
metadataMode | MetadataMode | MetadataMode.NONE |
Returns
string
Inherited from
Defined in
getEmbedding
▸ getEmbedding(): number
[]
Returns
number
[]
Inherited from
Defined in
getMetadataStr
▸ getMetadataStr(metadataMode
): string
Parameters
Name | Type |
---|---|
metadataMode | MetadataMode |
Returns
string
Inherited from
Defined in
getNodeInfo
▸ getNodeInfo(): Object
Returns
Object
Name | Type |
---|---|
end | undefined | number |
start | undefined | number |
Inherited from
Defined in
getText
▸ getText(): string
Returns
string
Inherited from
Defined in
getType
▸ getType(): ObjectType
Returns
Overrides
Defined in
setContent
▸ setContent(value
): void
Parameters
Name | Type |
---|---|
value | string |
Returns
void
Inherited from
Defined in
toJSON
▸ toJSON(): Record
<string
, any
>
Used with built in JSON.stringify
Returns
Record
<string
, any
>