Skip to main content

Neo4j

What is Neo4j?

  • Neo4j is an open-source database management system that specializes in graph database technology.
  • Neo4j allows you to represent and store data in nodes and edges, making it ideal for handling connected data and relationships.
  • Neo4j provides a Cypher Query Language, making it easy to interact with and query your graph data.
  • With Neo4j, you can achieve high-performance graph traversals and queries, suitable for production-level systems.

Get started with Neo4j by visiting their website.

Installation and Setup​

  • Install the Python SDK with pip install neo4j

VectorStore​

The Neo4j vector index is used as a vectorstore, whether for semantic search or example selection.

from langchain_community.vectorstores import Neo4jVector
API Reference:Neo4jVector

See a usage example

GraphCypherQAChain​

There exists a wrapper around Neo4j graph database that allows you to generate Cypher statements based on the user input and use them to retrieve relevant information from the database.

from langchain_community.graphs import Neo4jGraph
from langchain.chains import GraphCypherQAChain

See a usage example

Constructing a knowledge graph from text​

Text data often contain rich relationships and insights that can be useful for various analytics, recommendation engines, or knowledge management applications. Diffbot's NLP API allows for the extraction of entities, relationships, and semantic meaning from unstructured text data. By coupling Diffbot's NLP API with Neo4j, a graph database, you can create powerful, dynamic graph structures based on the information extracted from text. These graph structures are fully queryable and can be integrated into various applications.

from langchain_community.graphs import Neo4jGraph
from langchain_experimental.graph_transformers.diffbot import DiffbotGraphTransformer

See a usage example

Memory​

See a usage example.

from langchain.memory import Neo4jChatMessageHistory

Was this page helpful?


You can also leave detailed feedback on GitHub.