Skip to content

Commit

Permalink
Address error on /learn after change of embedding model (#870)
Browse files Browse the repository at this point in the history
* Address error on `/learn` after change of embedding model.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Set `all_files` option to default to False

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
srdas and pre-commit-ci[bot] authored Jul 8, 2024
1 parent fdb8456 commit 4664a0b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/jupyter-ai/jupyter_ai/chat_handlers/learn.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def _build_list_response(self):
return message

async def learn_dir(
self, path: str, chunk_size: int, chunk_overlap: int, all_files: bool
self, path: str, chunk_size: int, chunk_overlap: int, all_files: bool = False
):
dask_client: DaskClient = await self.dask_client_future
splitter_kwargs = {"chunk_size": chunk_size, "chunk_overlap": chunk_overlap}
Expand Down Expand Up @@ -267,7 +267,9 @@ async def relearn(self, metadata: IndexMetadata):
for dir in metadata.dirs:
# TODO: do not relearn directories in serial, but instead
# concurrently or in parallel
await self.learn_dir(dir.path, dir.chunk_size, dir.chunk_overlap)
await self.learn_dir(
dir.path, dir.chunk_size, dir.chunk_overlap, all_files=False
)

self.save()

Expand Down

0 comments on commit 4664a0b

Please sign in to comment.