VectorDoc
This module defines the VectorDoc class which is used to represent a document with an optional embedding and metadata.
VectorDoc
Class representing a document with an optional embedding and metadata.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
doc |
str
|
The document text. |
required |
doc_id |
str
|
Unique identifier for the document. If not provided, a new UUID will be generated. |
None
|
metadata |
dict
|
Metadata for the document. |
None
|
embedding |
list
|
Embedding for the document. |
None
|
Attributes:
Name | Type | Description |
---|---|---|
doc_id |
str
|
The unique identifier for the document. |
doc |
str
|
The document text. |
metadata |
dict
|
Optional metadata for the document. |
Source code in llmflows/vectorstores/vector_doc.py
embedding
property
writable
The embedding for the document.
Raises:
Type | Description |
---|---|
ValueError
|
If the embedding for the document has not been set. |
Returns:
Type | Description |
---|---|
The embedding of the document. |
values: tuple[str, str, list, dict]
property
Returns a tuple of the document ID, document text, embedding, and metadata.
Raises:
Type | Description |
---|---|
ValueError
|
If the embedding for the document has not been set. |
Returns:
Type | Description |
---|---|
tuple[str, str, list, dict]
|
Tuple[str, str, list, dict]: A tuple of the document ID, document text, embedding, and metadata. |