Skip to content

Commit

Permalink
feat: add page to vector factory metadata attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonkang14 committed Sep 5, 2024
1 parent 7ea3809 commit baec2b8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion api/core/rag/datasource/vdb/vector_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def gen_index_struct_dict(vector_type: VectorType, collection_name: str) -> dict
class Vector:
def __init__(self, dataset: Dataset, attributes: list = None):
if attributes is None:
attributes = ['doc_id', 'dataset_id', 'document_id', 'doc_hash']
attributes = ['doc_id', 'dataset_id', 'document_id', 'doc_hash', 'page']
self._dataset = dataset
self._embeddings = self._get_embeddings()
self._attributes = attributes
Expand Down Expand Up @@ -107,6 +107,7 @@ def create(self, texts: list = None, **kwargs):
def add_texts(self, documents: list[Document], **kwargs):
if kwargs.get('duplicate_check', False):
documents = self._filter_duplicate_texts(documents)

embeddings = self._embeddings.embed_documents([document.page_content for document in documents])
self._vector_processor.create(
texts=documents,
Expand Down

0 comments on commit baec2b8

Please sign in to comment.