39
39
40
40
def _create_indexable_chunks (
41
41
preprocessed_docs : list [dict ],
42
+ tenant_id : str | None ,
42
43
) -> tuple [list [Document ], list [DocMetadataAwareIndexChunk ]]:
43
44
ids_to_documents = {}
44
45
chunks = []
@@ -80,7 +81,7 @@ def _create_indexable_chunks(
80
81
mini_chunk_embeddings = [],
81
82
),
82
83
title_embedding = preprocessed_doc ["title_embedding" ],
83
- tenant_id = None ,
84
+ tenant_id = tenant_id ,
84
85
access = default_public_access ,
85
86
document_sets = set (),
86
87
boost = DEFAULT_BOOST ,
@@ -90,7 +91,7 @@ def _create_indexable_chunks(
90
91
return list (ids_to_documents .values ()), chunks
91
92
92
93
93
- def seed_initial_documents (db_session : Session ) -> None :
94
+ def seed_initial_documents (db_session : Session , tenant_id : str | None ) -> None :
94
95
"""
95
96
Seed initial documents so users don't have an empty index to start
96
97
@@ -177,7 +178,7 @@ def seed_initial_documents(db_session: Session) -> None:
177
178
)
178
179
processed_docs = json .load (open (initial_docs_path ))
179
180
180
- docs , chunks = _create_indexable_chunks (processed_docs )
181
+ docs , chunks = _create_indexable_chunks (processed_docs , tenant_id )
181
182
182
183
index_doc_batch_prepare (
183
184
document_batch = docs ,
@@ -198,6 +199,7 @@ def seed_initial_documents(db_session: Session) -> None:
198
199
199
200
# Retries here because the index may take a few seconds to become ready
200
201
# as we just sent over the Vespa schema and there is a slight delay
202
+
201
203
index_with_retries = retry_builder ()(document_index .index )
202
204
index_with_retries (chunks = chunks )
203
205
0 commit comments