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
feita há 2 meses142 visualizações
1 Resposta
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
respondido há 2 meses
profile picture
ESPECIALISTA
avaliado há 2 meses

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas