Neo4j vector store

import os
import openai

openai.api_key = os.environ["OPENAI_API_KEY"]

Initiate Neo4j vector wrapper

from llama_index.vector_stores import Neo4jVectorStore

username = "neo4j"
password = "pleaseletmein"
url = "bolt://localhost:7687"
embed_dim = 1536

neo4j_vector = Neo4jVectorStore(username, password, url, embed_dim)

Load documents, build the VectorStoreIndex

from llama_index import VectorStoreIndex, SimpleDirectoryReader
from IPython.display import Markdown, display
# load documents
documents = SimpleDirectoryReader("../data/paul_graham").load_data()
from import StorageContext

storage_context = StorageContext.from_defaults(vector_store=neo4j_vector)
index = VectorStoreIndex.from_documents(documents, storage_context=storage_context)
query_engine = index.as_query_engine()
response = query_engine.query("What happened at interleaf?")

At Interleaf, there was a group called Release Engineering that seemed to be as big as the group that actually wrote the software. The software at Interleaf had to be updated on the server, and there was a lot of work involved in maintaining and releasing new versions.

Load existing vector index

In order to connect to an existing vector index, you need to define the index_name and text_node_property parameters:

  • index_name: name of the existing vector index (default is vector)

  • text_node_property: name of the property that containt the text value (default is text)

index_name = "existing_index"
text_node_property = "text"
existing_vector = Neo4jVectorStore(

loaded_index = VectorStoreIndex.from_vector_store(existing_vector)

Metadata filtering

At the moment, the metadata filtering is not supported.