liveBook · Manning

Neo4jChatMemoryRepository

As explained in Spring AI in Action

Neo4jChatMemoryRepository is a Spring AI ChatMemoryRepository implementation that persists chat history in Neo4j.

Neo4jChatMemoryRepository is a Spring AI ChatMemoryRepository implementation that stores conversational history in Neo4j, allowing chat memory to outlast application restarts. section 5.4.1

Add the repository to a Spring Boot application in three steps:

  • Inject the autoconfigured ChatMemoryRepository into MessageWindowChatMemory. section 5.4.1

Inspecting stored conversations

Run Neo4j alongside the application, connect it through Spring properties, and inspect one or multiple persisted conversations in Neo4j Browser.

How Spring AI in Action covers it

How deep it goes
Explains dependency, database configuration, and bean wiring, but does not detail Neo4j’s storage schema or queries.
Examples
Uses a Dockerized Neo4j service, Spring connection properties, and browser visualizations of single and multiple conversations.
What it assumes
Assumes a Spring AI ChatMemory setup and an available Neo4j instance while autoconfiguration supplies the repository bean.
What you can do after
Operate/configure persistent chat memory by adding the Neo4j starter, connecting Neo4j, and wiring the repository into MessageWindowChatMemory.
How it connects
Connects ChatMemoryRepository with MessageWindowChatMemory, Spring AI autoconfiguration, Neo4j, and Neo4j Browser.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Spring AI in Action. The section links point to the parts of the book it draws on.