langchain.vectorstores.neo4j_vector.Neo4jVector¶
class langchain.vectorstores.neo4j_vector.Neo4jVector(embedding: Embeddings, *, search_type: SearchType = SearchType.VECTOR, username: Optional[str] = None, password: Optional[str] = None, url: Optional[str] = None, keyword_index_name: Optional[str] = 'keyword', database: str = 'neo4j', index_name: str = 'vector', node_label: str = 'Chunk', embedding_node_property: str = 'embedding', text_node_property: str = 'text', distance_strategy: DistanceStrategy = DistanceStrategy.COSINE, logger: Optional[Logger] = None, pre_delete_collection: bool = False, retrieval_query: str = '', relevance_score_fn: Optional[Callable[[float], float]] = None)[source]¶
Neo4j vector index.
To use, you should have the neo4j python package installed.
Parameters
url – Neo4j connection url
username – Neo4j username.
password – Neo4j password
database – Optionally provide Neo4j database
Defaults to “neo4j”
embedding – Any embedding function implementing
langchain.embeddings.base.Embeddings interface.
distance_strategy – The distance strategy to use. (default: COSINE)
pre_delete_collection – If True, will delete existing data if it exists.
(default: False). Useful for testing.
Example
from langchain.vectorstores.neo4j_vector import Neo4jVector
from langchain.embeddings.openai import OpenAIEmbeddings
url="bolt://localhost:7687"
username="neo4j"
password="pleaseletmein"
embeddings = OpenAIEmbeddings()
vectorestore = Neo4jVector.from_documents(
    embedding=embeddings,
    documents=docs,
    url=url
    username=username,