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
已提問 2 個月前檢視次數 142 次
1 個回答
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
已回答 2 個月前
profile picture
專家
已審閱 2 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南