Zack Saadioui
8/26/2024
1
SimpleDirectoryReader
1
VectorStoreIndex.from_documents()
1
2
3
4
5
6
python
from llama_index.core import VectorStoreIndex, SimpleDirectoryReader
# Load documents from a directory
documents = SimpleDirectoryReader('path_to_your_documents').load_data()
# Create the index
index = VectorStoreIndex.from_documents(documents)
1
2
3
4
python
query_engine = index.as_query_engine()
response = query_engine.query("What is this document about?")
print(response)
1
2
python
index.insert(new_document)
1
2
python
index.delete(document_id)
1
2
python
index.update(document_id, new_info)
1
2
python
index.refresh()
Copyright © Arsturn 2024