MCPcopy Create free account
hub / github.com/Azure-Samples/llama-index-python / generate_datasource

Function generate_datasource

backend/app/engine/generate.py:18–29  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

16
17
18def 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
32if __name__ == "__main__":

Callers 1

generate.pyFile · 0.85

Calls 2

init_settingsFunction · 0.90
get_documentsFunction · 0.90

Tested by

no test coverage detected