Closed sweep-nightly[bot] closed 11 months ago
tests/server/chunks/test_chunk_routes.py
β
Sandbox logs for
pre-commit install
1/2 βpre-commit installed at .git/hooks/pre-commit pre-commit installed at .git/hooks/pre-push
poetry install
2/2 β (`1`)The currently activated Python version 3.10.12 is not supported by the project (>=3.11,<3.12). Trying to find and use a compatible version. Poetry was unable to find a compatible version. If you have one, you can explicitly use it via the "env use" command.
pyproject.toml
β
Sandbox logs for
pre-commit install
1/2 βpre-commit installed at .git/hooks/pre-commit pre-commit installed at .git/hooks/pre-push
poetry install
2/2 β (`1`)The currently activated Python version 3.10.12 is not supported by the project (>=3.11,<3.12). Trying to find and use a compatible version. Poetry was unable to find a compatible version. If you have one, you can explicitly use it via the "env use" command.
tests/server/chunks/test_chunk_routes.py
β
Sandbox logs for
pre-commit install
1/2 βpre-commit installed at .git/hooks/pre-commit pre-commit installed at .git/hooks/pre-push
poetry install
2/2 β (`1`)The currently activated Python version 3.10.12 is not supported by the project (>=3.11,<3.12). Trying to find and use a compatible version. Poetry was unable to find a compatible version. If you have one, you can explicitly use it via the "env use" command.
Description
This PR refactors the
retrieve_relevant
function inchunks_service.py
to improve modularity and readability. The function was quite large and complex, so it has been broken down into smaller subfunctions to reduce complexity. Additionally, unit tests have been added to ensure the correctness of the refactored code.Summary of Changes
VectorStoreIndex
and thevector_index_retriever
into a new function namedcreate_index_and_retriever
.retrieve_and_sort_nodes
.Chunk
objects into a new function namedconstruct_chunks
.retrieve_relevant
function to call the new subfunctions in the appropriate order.retrieve_relevant
function.Please review and merge this PR. Thank you!
Fixes #1.
π Latest improvements to Sweep:
rope
library to refactor Python! Check out Large Language Models are Bad at Refactoring Code. To have Sweep refactor your code, trysweep: Refactor <your_file>.py to be more modular
!π‘ To get Sweep to edit this pull request, you can: