()
| 31 | |
| 32 | # Test overriding llmware_data folder |
| 33 | def test_setup_custom_location(): |
| 34 | |
| 35 | # upstream application creating custom home path, e.g., aibloks |
| 36 | new_home_folder = "llmware_data_custom" |
| 37 | LLMWareConfig.set_home(os.path.join(LLMWareConfig.get_home(), new_home_folder)) |
| 38 | |
| 39 | new_llmware_path = "aibloks_data" |
| 40 | LLMWareConfig.set_llmware_path_name(new_llmware_path) |
| 41 | |
| 42 | # Make folders if they don't already exist |
| 43 | if not os.path.exists(LLMWareConfig().get_home()): |
| 44 | os.mkdir(LLMWareConfig().get_home()) |
| 45 | if not os.path.exists(LLMWareConfig().get_llmware_path()): |
| 46 | LLMWareConfig.setup_llmware_workspace() |
| 47 | |
| 48 | assert new_home_folder in LLMWareConfig.get_home(), "Custom home folder not set correctly." |
| 49 | assert new_home_folder in LLMWareConfig.get_llmware_path() and new_llmware_path in LLMWareConfig.get_llmware_path(), "Custom LLMWare path not set correctly." |
| 50 | assert new_home_folder in LLMWareConfig.get_library_path() and new_llmware_path in LLMWareConfig.get_library_path(), "Library path not set correctly." |
| 51 | |
| 52 | # test with library setup and adding files |
| 53 | library_name = "library_with_custom_path" |
| 54 | library = Library().create_new_library(library_name) |
| 55 | sample_files_path = Setup().load_sample_files() |
| 56 | library.add_files(os.path.join(sample_files_path,"Agreements")) |
| 57 | |
| 58 | assert new_home_folder in library.library_main_path, "Custom path not found in library main path." |
| 59 | |
| 60 | results = Query(library).text_query("salary") |
| 61 | |
| 62 | assert len(results) > 0 |
| 63 | |
| 64 |
nothing calls this directly
no test coverage detected