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
gefragt vor 2 Monaten142 Aufrufe
1 Antwort
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
beantwortet vor 2 Monaten
profile picture
EXPERTE
überprüft vor 2 Monaten

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen