Skip to content
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

Fixes 3971: Check how to integrate vector databases via rest APIs #446

Closed
wants to merge 10 commits into from

Conversation

vga91
Copy link
Owner

@vga91 vga91 commented Mar 14, 2024

Issue https://github.com/neo4j-contrib/neo4j-apoc-procedures/issues/3971

Changes

Created procedures for chroma and qdrant.

Emulate the https://neo4j.com/docs/cypher-manual/current/indexes/semantic-indexes/vector-indexes/ commands.

  • create vector index --> apoc.vectordb.qdrant.createCollection
  • drop vector index --> apoc.vectordb.qdrant.deleteCollection
  • add vector node/rel--> apoc.vectordb.qdrant.upsert
  • db.index.vector.queryNodes / db.index.vector.queryRelationships --> apoc.vectordb.qdrant.get and apoc.vectordb.qdrant.query
  • drop vector node/rel --> apoc.vectordb.qdrant.delete

And the same for the chroma procedures.

NOTE: Like the apoc.ml ones, the chroma and qdrand procedures are implemented in such a way that they have the same signature, even though under the hood they have different bodies/methods/etc.

And 2 custom procedures apoc.vectordb.qdrant.get and apoc.vectordb.custom to handle other vector databases (like Pinecone tested in PineconeTest).

Using the apoc.vectordb.*.get and apoc.vectordb.*.query procedures, we can auto-create neo4j vector indexes and entities, using the mapping config.

To evaluate

  • apoc.vectordb.custom could be changed to a more generic naming, e.g. apoc.restapi.custom(<conf>), since it could be used with other rest APIs
  • move RestAPIConfig to util package

Additional notes (after neo4j-contrib PR creation)

  • Open a follow-up issue:

  • Test / custom procedures with other databases (like Pinecone)

  • Problem with Pinecone, create a PR after neo4j-contrib PR creation...
    We cannot execute Pinecone fetch API, due to these 2 pieces of apoc core codes:

    • setDoOutput(true)
    • http.setChunkedStreamingMode(1024 * 1024);
      In both cases, we receive a 200OK, but with no results.

@vga91 vga91 marked this pull request as draft March 14, 2024 09:45
@vga91 vga91 force-pushed the issue-3971 branch 4 times, most recently from 08588a5 to aeaa48b Compare April 22, 2024 12:08
@vga91 vga91 marked this pull request as ready for review April 22, 2024 15:09

.Example results
[opts="header"]
|===
Copy link
Collaborator

Choose a reason for hiding this comment

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

rivedere questo score che forse non serve


.Example results
[opts="header"]
|===
Copy link
Collaborator

Choose a reason for hiding this comment

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

rivedere questo score

@vga91 vga91 closed this May 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.

2 participants