Skip to content

Commit

Permalink
Update database_module.py
Browse files Browse the repository at this point in the history
Replaced some hard coded strings with constants
  • Loading branch information
anthonymonforte authored Aug 21, 2024
1 parent 656bb12 commit 7480582
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/modules/database_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
#import chromadb
#from chromadb.utils.data_loaders import ImageLoader

from src.modules.constants import DictionaryKeys

class EmbeddingDb:

def __init__(self, db_path: str) -> None:
Expand Down Expand Up @@ -60,8 +62,8 @@ def generate_chunk_ids(self, chunks: list[Document]) -> list[Document]:
current_chunk_index = 0

for chunk in chunks:
source = chunk.metadata.get("source")
page = chunk.metadata.get("page")
source = chunk.metadata.get(DictionaryKeys.Source)
page = chunk.metadata.get(DictionaryKeys.Page)
current_page_id = f"{source}:{page}"

if current_page_id == last_page_id:
Expand Down

0 comments on commit 7480582

Please sign in to comment.