insert vector embedding to an node in aws neptune

0

response = client.execute_query( graphIdentifier='g-4c9vlm5rg5', queryString=f""" MATCH (user:User {{user_id: 'string'}}) MERGE (chunk:Chunk {{text: "{text}", , embeddings: {list(embeddings)}}}) MERGE (user)-[:Has_chunk]->(chunk) """, language='OPEN_CYPHER',

)

error:

ValidationException: An error occurred (ValidationException) when calling the ExecuteQuery operation: Expected a simple literal but found CType.

lalit
asked 2 months ago132 views
1 Answer
0

From our example notebook on using Vector Embeddings in Neptune Analytics (https://github.com/aws/graph-notebook/blob/main/src/graph_notebook/notebooks/02-Neptune-Analytics/02-Graph-Algorithms/06-Vector-Similarity-Algorithms.ipynb):

Manage an Embedding

In Neptune Analytics, the embedding for each node is stored as a kind of "hidden" property that is not returned using standard openCypher. To manage these embeddings, we provide several algorithms to perform standard CRUD operations:

  • neptune.algo.vectors.get: This will retrieve and return the specified node's embedding.

  • neptune.algo.vectors.upsert: This will update or insert the provided embedding to the specified node.

  • neptune.algo.vectors.remove: This will remove the specified node's embedding.

These algorithms can be combined with other openCypher clauses to perform more complex patterns, such as upserting a node with an externally generated embedding at the time of creation.

Using our air routes data, let's show how to return the embeddings of both the Seattle and Anchorage airports.

%%oc

MATCH (n) 
WHERE n.code in ['SEA', 'ANC']
CALL neptune.algo.vectors.get(n)
YIELD node, embedding
RETURN n.code, embedding
profile pictureAWS
answered 2 months ago
profile picture
EXPERT
reviewed a month ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions