Skip to content

Neo4jVector doesn't work well with HuggingFaceEmbeddings when reusing the graph #24295

Closed Answered by dosubot bot
TripleCamellya asked this question in Q&A
Discussion options

You must be logged in to vote

Hello, @SeeleZaych! 👋 I'm here to help you with any bugs, questions, or contributions you have. Let's tackle this together!

To handle the IndexError that occurs when all nodes in your Neo4j database already have their embeddings, you can add a check for the length of the data list before proceeding with further operations. Here is an example of how you can modify the code to include this check:

while True:
    fetch_query = (
        f"MATCH (n:`{node_label}`) "
        f"WHERE n.{embedding_node_property} IS null "
        "AND any(k in $props WHERE n[k] IS NOT null) "
        f"RETURN elementId(n) AS id, reduce(str='',"
        "k IN $props | str + '\\n' + k + ':' + coalesce(n[k], '')) …

Replies: 5 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@TripleCamellya
Comment options

Answer selected by TripleCamellya
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@TripleCamellya
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants