I successfully have a property graph index and use azure ai search as a vector store. However, I am a bit confused on what's going on.
import nest_asyncio
from llama_index.core import PropertyGraphIndex
# Apply nest_asyncio to allow nested use of asyncio.run()
nest_asyncio.apply()
# Load documents and create index based on the use_existing_index flag
if use_existing_index:
storage_context = StorageContext.from_defaults(vector_store=vector_store)
index = PropertyGraphIndex.from_documents([], storage_context=storage_context)
else:
# Load documents
storage_context = StorageContext.from_defaults(vector_store=vector_store)
# Create index
index = VectorStoreIndex.from_documents(documents, storage_context=storage_context)
retriever = index.as_retriever(
include_text=False, # include source text, default True
)
nodes = retriever.retrieve("What happened at Interleaf and Viaweb?")
for node in nodes:
print(node.text)