MCPcopy Create free account
hub / github.com/cosdata/cosdata / upsert_in_transaction

Function upsert_in_transaction

tests/test-sparse-vector.py:76–90  ·  view source on GitHub ↗

Upsert vectors to the collection using transaction

(collection, transaction, vectors)

Source from the content-addressed store, hash-verified

74
75
76def upsert_in_transaction(collection, transaction, vectors):
77 """
78 Upsert vectors to the collection using transaction
79 """
80 # Convert to the format expected by the client
81 formatted_vectors = [
82 {
83 "id": vector["id"],
84 "sparse_values": vector["values"],
85 "sparse_indices": vector["indices"],
86 }
87 for vector in vectors
88 ]
89
90 transaction.batch_upsert_vectors(formatted_vectors)
91
92
93def commit_transaction(transaction):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected