-
Notifications
You must be signed in to change notification settings - Fork 222
feat: Neo4j vector index method support #1111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: Neo4j vector index method support #1111
Conversation
This commit introduces support for specifying vector index methods (HNSW) for Neo4j targets. - Modified `src/base/spec.rs` to derive `Eq` for `VectorIndexMethod`. - Modified `src/ops/targets/neo4j.rs` to: - Allow `VectorIndexMethod` to be passed to `IndexDef::from_vector_index_def`. - Store `VectorIndexMethod` in `IndexDef::VectorIndex`. - Implement error handling for unsupported `VectorIndexMethod` (IVFFlat). - Update `SetupComponentOperator::describe_state` to display the method. - Update `SetupComponentOperator::create` to include HNSW parameters in the Cypher query.
@georgeh0 kindly review the PR when you have time. |
Thanks @belloibrahv just to check - have you get a chance to bring up neo4j and test it end to end with an example? Here is an example - https://cocoindex.io/docs/examples/knowledge-graph-for-docs#query-and-test-your-index |
Hi @badmonster0, Thanks for the suggestion! I've successfully brought up a Neo4j instance using Docker and identified the |
got it and make sense, thanks a lot for setting it up @belloibrahv ! https://cocoindex.io/docs/ai/llm#llm-api-types there's different kinds of api that we support, ollama is completely on-prems free if you have any question to wire it, please let us know! |
@badmonster0, Following your valuable feedback, I've successfully configured the During execution, I encountered a This indicates that the cocoindex library, when generating the Cypher query for Neo4j HNSW vector index creation, is using hnsw.ef_construction and hnsw.m as parameter keys. However, Neo4j explicitly expects these parameters to be prefixed with vector., i.e., vector.hnsw.ef_construction and vector.hnsw.m. This suggests that the internal mapping within the Could you please confirm the intended parameter naming convention for Neo4j HNSW indexes within Once this adjustment is made within the Thank you for your guidance. |
@belloibrahv Thanks for testing and debugging! These property names (like |
- Updated docs_to_knowledge_graph example to use Ollama instead of OpenAI - Added alternative configuration comments for OpenAI usage - Enables end-to-end testing without requiring OpenAI API key - Supports the Neo4j vector index method implementation
Hi @badmonster0 @georgeh0,
|
if parts.is_empty() { | ||
"".to_string() | ||
} else { | ||
format!(", {}", parts.join(", ")) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic is a little bit fragile. A slightly simpler way is to put all index config fields into parts
(i.e. for existing ones like "vector.dimensions
: {vector_size}" also put into parts
. Then we only need a simple parts.join(", ")
at last, which will make our logic simpler and more clear.
This PR introduces support for specifying the HNSW VectorIndexMethod when creating vector indexes in Neo4j.
Key changes include:
Eq
trait forVectorIndexMethod
insrc/base/spec.rs
.src/ops/targets/neo4j.rs
) to:VectorIndexMethod
parameters.VectorIndexMethod
in Neo4j #1053 (comment).Resolves #1053.