SergeyO7 commited on
Commit
bd4a39c
·
verified ·
1 Parent(s): 859a3f4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -36,8 +36,8 @@ def load_documents():
36
 
37
  def split_text(documents: list[Document]):
38
  text_splitter = RecursiveCharacterTextSplitter(
39
- chunk_size=300,
40
- chunk_overlap=100,
41
  length_function=len,
42
  add_start_index=True,
43
  )
@@ -59,10 +59,11 @@ def save_to_chroma(chunks: list[Document]):
59
  # Create a new DB from the documents.
60
  db = Chroma.from_documents(
61
  chunks,
62
- HuggingFaceEmbeddings(model_name="BAAI/bge-small-en-v1.5"),
 
63
  persist_directory=CHROMA_PATH
64
  )
65
- db.persist()
66
  print(f"Saved {len(chunks)} chunks to {CHROMA_PATH}.")
67
 
68
 
 
36
 
37
  def split_text(documents: list[Document]):
38
  text_splitter = RecursiveCharacterTextSplitter(
39
+ chunk_size=1000,
40
+ chunk_overlap=200,
41
  length_function=len,
42
  add_start_index=True,
43
  )
 
59
  # Create a new DB from the documents.
60
  db = Chroma.from_documents(
61
  chunks,
62
+ HuggingFaceEmbeddings(model_name="BAAI/bge-m3"),
63
+ cache_folder="model_cache", # Укажите путь для кэша
64
  persist_directory=CHROMA_PATH
65
  )
66
+
67
  print(f"Saved {len(chunks)} chunks to {CHROMA_PATH}.")
68
 
69