Skip to content

Conversation

King-Chau
Copy link
Contributor

Add Spring Boot auto-configuration for Neo4j vector store

@King-Chau
Copy link
Contributor Author

King-Chau commented Dec 22, 2023

@tzolov #114 Please review, thank you.

Copy link
Contributor

@tzolov tzolov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @King-Chau
It looks great! I have few minor recommendations about the code style and one important concern about exposing the org.neo4j.* in the spring-ai API.

Btw, your PR made me review the other vector stores and I've tried to clean the similar issues there.

/**
* @author Jingzhou Ou
*/
@ConfigurationProperties(CONFIG_PREFIX)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change to @ConfigurationProperties(Neo4jVectorStoreProperties.CONFIG_PREFIX) to ged rid of the static import.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point, will change

* @author Jingzhou Ou
*/
@ConfigurationProperties(CONFIG_PREFIX)
public class Neo4jDriverProperties {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use Neo4jDriverProperties.CONFIG_PREFIX inside the annotation and remove the static import.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point, will change


package org.springframework.ai.autoconfigure.neo4j;

import org.neo4j.driver.AuthToken;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a bad practice to expose 3rd party API (e.g. org.neo4j) directly in your own API.
Can we hide those behind spring-ai abstractions?
Also I wonder how different is this from the existing neo4j spring boot autoconfig?

Copy link
Contributor Author

@King-Chau King-Chau Dec 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I already removed the org.neo4j.* APIs in Neo4jDriverProperties.
The properties are the same as the existing neo4j spring boot autoconfig.

@King-Chau King-Chau requested a review from tzolov December 23, 2023 16:23
@tzolov
Copy link
Contributor

tzolov commented Dec 24, 2023

LGTM, thank you @King-Chau

@tzolov
Copy link
Contributor

tzolov commented Dec 24, 2023

Rebased, squashed and merged at: b625ab1

@tzolov tzolov closed this Dec 24, 2023
@markpollack markpollack added this to the 0.8.0 milestone Jan 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants