From 65af1b65baf2e6f186687bd764afa58314afde62 Mon Sep 17 00:00:00 2001 From: Logan <logan.markewich@live.com> Date: Wed, 22 Nov 2023 19:54:53 -0600 Subject: [PATCH] fix download loaders [v0.9.6.post2] (#9106) --- llama_index/VERSION | 2 +- llama_index/download/download_utils.py | 22 ++++++++++++++++------ llama_index/llama_pack/download.py | 1 + pyproject.toml | 2 +- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/llama_index/VERSION b/llama_index/VERSION index a8cf406047..2a1d954596 100644 --- a/llama_index/VERSION +++ b/llama_index/VERSION @@ -1 +1 @@ -0.9.6.post1 +0.9.6.post2 diff --git a/llama_index/download/download_utils.py b/llama_index/download/download_utils.py index ba0a9d44c1..3ee7ff69f6 100644 --- a/llama_index/download/download_utils.py +++ b/llama_index/download/download_utils.py @@ -244,6 +244,7 @@ def download_llama_module( base_file_name: str = "base.py", use_gpt_index_import: bool = False, disable_library_cache: bool = False, + override_path: bool = False, ) -> Type: """Download a module from LlamaHub. @@ -290,15 +291,24 @@ def download_llama_module( refresh_cache=refresh_cache, use_gpt_index_import=use_gpt_index_import, base_file_name=base_file_name, - override_path=True, + override_path=override_path, ) # loads the module into memory - spec = util.spec_from_file_location( - "custom_module", location=f"{dirpath}/{base_file_name}" - ) - if spec is None: - raise ValueError(f"Could not find file: {dirpath}/{base_file_name}.") + if override_path: + spec = util.spec_from_file_location( + "custom_module", location=f"{dirpath}/{base_file_name}" + ) + if spec is None: + raise ValueError(f"Could not find file: {dirpath}/{base_file_name}.") + else: + spec = util.spec_from_file_location( + "custom_module", location=f"{dirpath}/{module_id}/{base_file_name}" + ) + if spec is None: + raise ValueError( + f"Could not find file: {dirpath}/{module_id}/{base_file_name}." + ) module = util.module_from_spec(spec) spec.loader.exec_module(module) # type: ignore diff --git a/llama_index/llama_pack/download.py b/llama_index/llama_pack/download.py index 4ffab15e8a..d1d1cc7d5e 100644 --- a/llama_index/llama_pack/download.py +++ b/llama_index/llama_pack/download.py @@ -28,6 +28,7 @@ def download_llama_pack( custom_path=download_dir, library_path="llama_packs/library.json", disable_library_cache=True, + override_path=True, ) if not issubclass(pack_cls, BaseLlamaPack): raise ValueError(f"Tool class {pack_cls} must be a subclass of BaseToolSpec.") diff --git a/pyproject.toml b/pyproject.toml index 16cd9e8480..a9ecaef5d6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,7 +39,7 @@ name = "llama-index" packages = [{include = "llama_index"}] readme = "README.md" repository = "https://github.com/run-llama/llama_index" -version = "0.9.6.post1" +version = "0.9.6.post2" [tool.poetry.dependencies] SQLAlchemy = {extras = ["asyncio"], version = ">=1.4.49"} -- GitLab