Skip to content

Commit

Permalink
adding chunk size param
Browse files Browse the repository at this point in the history
  • Loading branch information
shanbady committed Jan 21, 2025
1 parent 5e07494 commit a15436a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions vector_search/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ def generate_embeddings(ids, resource_type):


@app.task(bind=True)
def start_embed_resources(self, indexes, skip_content_files):
def start_embed_resources(
self, indexes, skip_content_files, chunk_size=settings.QDRANT_CHUNK_SIZE
):
"""
Celery task to embed all learning resources for given indexes
Expand All @@ -84,6 +86,7 @@ def start_embed_resources(self, indexes, skip_content_files):
"QDRANT_HOST and QDRANT_BASE_COLLECTION_NAME"
)
return None

try:
if COURSE_TYPE in indexes:
blocklisted_ids = load_course_blocklist()
Expand Down Expand Up @@ -129,7 +132,7 @@ def start_embed_resources(self, indexes, skip_content_files):
)
for ids in chunks(
run_contentfiles,
chunk_size=settings.QDRANT_CHUNK_SIZE,
chunk_size=chunk_size,
)
]
for resource_type in [
Expand All @@ -147,7 +150,7 @@ def start_embed_resources(self, indexes, skip_content_files):
)
.order_by("id")
.values_list("id", flat=True),
chunk_size=settings.QDRANT_CHUNK_SIZE,
chunk_size=chunk_size,
):
index_tasks.append(
generate_embeddings.si(
Expand Down

0 comments on commit a15436a

Please sign in to comment.