Neo4jVectorStore#
- class llama_index.vector_stores.Neo4jVectorStore(username: str, password: str, url: str, embedding_dimension: int, database: str = 'neo4j', index_name: str = 'vector', keyword_index_name: str = 'keyword', node_label: str = 'Chunk', embedding_node_property: str = 'embedding', text_node_property: str = 'text', distance_strategy: str = 'cosine', hybrid_search: bool = False, retrieval_query: str = '', **kwargs: Any)#
Bases:
VectorStore
Attributes Summary
Methods Summary
add
(nodes, **add_kwargs)Add nodes with embedding to vector store.
This method constructs a Cypher query and executes it to create a new vector index in Neo4j.
create_new_keyword_index
([text_node_properties])This method constructs a Cypher query and executes it to create a new full text index in Neo4j.
database_query
(query[, params])This method sends a Cypher query to the connected Neo4j database and returns the results as a list of dictionaries.
delete
(ref_doc_id, **delete_kwargs)Delete nodes using with ref_doc_id.
query
(query, **kwargs)Query vector store.
Check if the fulltext index exists in the Neo4j database.
Check if the vector index exists in the Neo4j database and returns its embedding dimension.
Attributes Documentation
- flat_metadata = True#
- stores_text: bool = True#
Methods Documentation
- create_new_index() None #
This method constructs a Cypher query and executes it to create a new vector index in Neo4j.
- create_new_keyword_index(text_node_properties: List[str] = []) None #
This method constructs a Cypher query and executes it to create a new full text index in Neo4j.
- database_query(query: str, params: Optional[dict] = None) List[Dict[str, Any]] #
This method sends a Cypher query to the connected Neo4j database and returns the results as a list of dictionaries.
- Parameters
query (str) – The Cypher query to execute.
params (dict, optional) – Dictionary of query parameters. Defaults to {}.
- Returns
List of dictionaries containing the query results.
- Return type
List[Dict[str, Any]]
- delete(ref_doc_id: str, **delete_kwargs: Any) None #
Delete nodes using with ref_doc_id.
- query(query: VectorStoreQuery, **kwargs: Any) VectorStoreQueryResult #
Query vector store.
- retrieve_existing_fts_index() Optional[str] #
Check if the fulltext index exists in the Neo4j database.
This method queries the Neo4j database for existing fts indexes with the specified name.
- Returns
keyword index information
- Return type
(Tuple)
- retrieve_existing_index() bool #
Check if the vector index exists in the Neo4j database and returns its embedding dimension.
This method queries the Neo4j database for existing indexes and attempts to retrieve the dimension of the vector index with the specified name. If the index exists, its dimension is returned. If the index doesn’t exist, None is returned.
- Returns
The embedding dimension of the existing index if found.
- Return type
int or None