Registry /
llm-agents / llama-index-vector-stores-neo4jvector
Install & Compatibility
Where this runs
tested against v0.6.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.920 runs
installs and imports cleanly · install 0.0s · import 5.141s · 259.7MB
glibcpy 3.10–3.920 runs
installs and imports cleanly · install 20.2s · import 4.769s · 256MB
271MB installed
● package 271MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Neo4jVectorStore
✓ from llama_index.vector_stores.neo4jvector import Neo4jVectorStore
✗ from llama_index.vector_stores import Neo4jVectorStore
Following LlamaIndex v0.10+ package refactor, integration packages must be imported directly from their specific paths, not the consolidated `llama_index.vector_stores` namespace.
VectorStoreIndex
✓ from llama_index.core import VectorStoreIndex
Post LlamaIndex v0.10, core components are found under `llama_index.core`.
This quickstart demonstrates how to set up `Neo4jVectorStore` with LlamaIndex. It initializes the vector store with Neo4j connection details, loads sample documents, creates a `VectorStoreIndex`, and then performs a query. It assumes Neo4j credentials and OpenAI API key are set as environment variables and that a 'data' directory exists for document loading.
import os
from llama_index.vector_stores.neo4jvector import Neo4jVectorStore
from llama_index.core import VectorStoreIndex, SimpleDirectoryReader, Settings
from llama_index.core.embeddings import resolve_embed_model
# Set environment variables for Neo4j and OpenAI
# Ensure you have a running Neo4j instance (e.g., Docker, AuraDB)
# NEO4J_URI = "bolt://localhost:7687"
# NEO4J_USERNAME = "neo4j"
# NEO4J_PASSWORD = "password"
# OPENAI_API_KEY = "sk-..."
# Configure LlamaIndex settings (LLM and Embedding Model)
Settings.embed_model = resolve_embed_model("openai") # Or any other embedding model
# Neo4j connection details
neo4j_url = os.environ.get("NEO4J_URI", "bolt://localhost:7687")
neo4j_username = os.environ.get("NEO4J_USERNAME", "neo4j")
neo4j_password = os.environ.get("NEO4J_PASSWORD", "password")
embedding_dimension = 1536 # OpenAI's default embedding dimension
# Initialize Neo4jVectorStore
try:
neo4j_vector_store = Neo4jVectorStore(
username=neo4j_username,
password=neo4j_password,
url=neo4j_url,
embedding_dimension=embedding_dimension,
index_name="vector",
node_label="Chunk",
embedding_node_property="embedding",
text_node_property="text",
)
except ValueError as e:
print(f"Error connecting to Neo4j: {e}. Please ensure Neo4j is running and credentials are correct.")
exit()
# Create a dummy document for demonstration (in a 'data' directory)
# You might need to create a 'data' directory and a 'test.txt' file
# e.g., echo "This is a test document about LlamaIndex and Neo4j integration." > data/test.txt
# Load documents
# Ensure 'data' directory exists and contains documents
try:
documents = SimpleDirectoryReader("data").load_data()
except Exception as e:
print(f"Error loading documents: {e}. Make sure a 'data' directory exists and contains files.")
documents = []
if not documents:
print("No documents loaded. Creating a dummy document.")
from llama_index.core.schema import Document
documents = [Document(text="LlamaIndex integrates with Neo4j to provide a powerful vector store for RAG applications.")]
# Create a VectorStoreIndex
index = VectorStoreIndex.from_documents(documents, vector_store=neo4j_vector_store)
# Query the index
query_engine = index.as_query_engine()
response = query_engine.query("What is LlamaIndex?")
print(response)
# Example of retrieving documents directly (without LLM synthesis)
retriever = index.as_retriever(similarity_top_k=2)
nodes = retriever.retrieve("How does LlamaIndex work with Neo4j?")
for node in nodes:
print(f"Retrieved Node: {node.text[:100]}...")
# Clean up (optional, depends on your use case)
# neo4j_vector_store._driver.close()
Debug
Known issues
breakingLlamaIndex v0.10+ introduced a major package refactor. All integrations, including Neo4jVectorStore, are now standalone PyPI packages. Direct imports from `llama_index.vector_stores` are no longer valid for integration classes.fixInstall the specific integration package (`pip install llama-index-vector-stores-neo4jvector`) and update imports to `from llama_index.vector_stores.neo4jvector import Neo4jVectorStore`. Core components now reside under `llama_index.core`.
affects: >=0.10.0
gotchaMismatch between `embedding_dimension` specified in `Neo4jVectorStore` and the actual dimension of indexed vectors in the Neo4j database will cause query failures (e.g., `java.lang.IllegalArgumentException: Index query vector has X dimensions, but indexed vectors have Y.`).fixEnsure the `embedding_dimension` parameter passed to `Neo4jVectorStore` precisely matches the dimension of the embedding model you are using and the dimension of any existing vector indexes in Neo4j. If dimensions differ, you may need to recreate the vector index in Neo4j or re-index your data.
affects: All versions
gotchaCreating vector indexes in Neo4j requires a Neo4j database version that supports vector index capabilities (e.g., Neo4j 5.5 or later). Using older versions may result in `Invalid input 'VECTOR'` or similar Cypher errors when the store attempts to create an index.fixUpgrade your Neo4j database instance to a version that supports vector indexing (e.g., Neo4j 5.5+). Refer to the official Neo4j documentation for specific version requirements and upgrade paths.
affects: All versions with older Neo4j databases
Upgrade
Version history
0.6.0latest on PyPI · released Mar 12, 2026
Audit
Dependencies
llama-index-corerequiredCore LlamaIndex functionalities are required.
neo4jrequiredOfficial Neo4j Python driver for database interaction.
llama-index-llms-openaioptionalCommonly used LLM provider for embedding generation and query answering.
llama-index-embeddings-openaioptionalCommonly used embedding model provider for vector generation.