()
| 16 | |
| 17 | |
| 18 | def generate_datasource(): |
| 19 | init_settings() |
| 20 | logger.info("Creating new index") |
| 21 | storage_dir = os.environ.get("STORAGE_DIR", "storage") |
| 22 | # load the documents and create the index |
| 23 | documents = get_documents() |
| 24 | index = VectorStoreIndex.from_documents( |
| 25 | documents, |
| 26 | ) |
| 27 | # store it for later |
| 28 | index.storage_context.persist(storage_dir) |
| 29 | logger.info(f"Finished creating new index. Stored in {storage_dir}") |
| 30 | |
| 31 | |
| 32 | if __name__ == "__main__": |
no test coverage detected