Elements#
ragbits.document_search.documents.element.Element
#
Bases: BaseModel
, ABC
An object representing an element in a document.
id
property
#
Retrieve the ID of the element, primarily used to represent the element's data.
RETURNS | DESCRIPTION |
---|---|
str
|
string representing element
TYPE:
|
key
property
#
Get the representation of the element for embedding.
RETURNS | DESCRIPTION |
---|---|
str | None
|
The representation for embedding. |
text_representation
abstractmethod
property
#
Get the text representation of the element.
RETURNS | DESCRIPTION |
---|---|
str | None
|
The text representation. |
image_representation
property
#
Get the image representation of the element.
RETURNS | DESCRIPTION |
---|---|
bytes | None
|
The image representation. |
get_id_components
#
Creates a dictionary of key value pairs of id components
RETURNS | DESCRIPTION |
---|---|
dict
|
a dictionary
TYPE:
|
Source code in packages/ragbits-document-search/src/ragbits/document_search/documents/element.py
from_vector_db_entry
classmethod
#
from_vector_db_entry(db_entry: VectorStoreEntry) -> Element
Create an element from a vector database entry.
PARAMETER | DESCRIPTION |
---|---|
db_entry |
The vector database entry.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Element
|
The element. |
Source code in packages/ragbits-document-search/src/ragbits/document_search/documents/element.py
to_vector_db_entry
#
to_vector_db_entry() -> VectorStoreEntry
Create a vector database entry from the element.
RETURNS | DESCRIPTION |
---|---|
VectorStoreEntry
|
The vector database entry |
Source code in packages/ragbits-document-search/src/ragbits/document_search/documents/element.py
ragbits.document_search.documents.element.TextElement
#
Bases: Element
An object representing a text element in a document.
id
property
#
Retrieve the ID of the element, primarily used to represent the element's data.
RETURNS | DESCRIPTION |
---|---|
str
|
string representing element
TYPE:
|
key
property
#
Get the representation of the element for embedding.
RETURNS | DESCRIPTION |
---|---|
str | None
|
The representation for embedding. |
image_representation
property
#
Get the image representation of the element.
RETURNS | DESCRIPTION |
---|---|
bytes | None
|
The image representation. |
text_representation
property
#
Get the text representation of the element.
RETURNS | DESCRIPTION |
---|---|
str
|
The text representation. |
get_id_components
#
Creates a dictionary of key value pairs of id components
RETURNS | DESCRIPTION |
---|---|
dict
|
a dictionary
TYPE:
|
Source code in packages/ragbits-document-search/src/ragbits/document_search/documents/element.py
from_vector_db_entry
classmethod
#
from_vector_db_entry(db_entry: VectorStoreEntry) -> Element
Create an element from a vector database entry.
PARAMETER | DESCRIPTION |
---|---|
db_entry |
The vector database entry.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Element
|
The element. |
Source code in packages/ragbits-document-search/src/ragbits/document_search/documents/element.py
to_vector_db_entry
#
to_vector_db_entry() -> VectorStoreEntry
Create a vector database entry from the element.
RETURNS | DESCRIPTION |
---|---|
VectorStoreEntry
|
The vector database entry |
Source code in packages/ragbits-document-search/src/ragbits/document_search/documents/element.py
ragbits.document_search.documents.element.ImageElement
#
Bases: Element
An object representing an image element in a document.
id
property
#
Retrieve the ID of the element, primarily used to represent the element's data.
RETURNS | DESCRIPTION |
---|---|
str
|
string representing element
TYPE:
|
key
property
#
Get the representation of the element for embedding.
RETURNS | DESCRIPTION |
---|---|
str | None
|
The representation for embedding. |
text_representation
property
#
Get the text representation of the element.
RETURNS | DESCRIPTION |
---|---|
str | None
|
The text representation. |
image_representation
property
#
Get the image representation of the element.
RETURNS | DESCRIPTION |
---|---|
bytes
|
The image representation. |
from_vector_db_entry
classmethod
#
from_vector_db_entry(db_entry: VectorStoreEntry) -> Element
Create an element from a vector database entry.
PARAMETER | DESCRIPTION |
---|---|
db_entry |
The vector database entry.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Element
|
The element. |
Source code in packages/ragbits-document-search/src/ragbits/document_search/documents/element.py
to_vector_db_entry
#
to_vector_db_entry() -> VectorStoreEntry
Create a vector database entry from the element.
RETURNS | DESCRIPTION |
---|---|
VectorStoreEntry
|
The vector database entry |
Source code in packages/ragbits-document-search/src/ragbits/document_search/documents/element.py
get_id_components
#
Creates a dictionary of key value pairs of id components
RETURNS | DESCRIPTION |
---|---|
dict
|
a dictionary
TYPE:
|