(collection_name, transaction_id, vectors)
| 129 | |
| 130 | |
| 131 | def upsert_in_transaction(collection_name, transaction_id, vectors): |
| 132 | url = ( |
| 133 | f"{base_url}/collections/{collection_name}/transactions/{transaction_id}/upsert" |
| 134 | ) |
| 135 | vectors = [ |
| 136 | {"id": vector["id"], "dense_values": vector["values"]} for vector in vectors |
| 137 | ] |
| 138 | data = {"vectors": vectors} |
| 139 | response = requests.post( |
| 140 | url, headers=generate_headers(), data=json.dumps(data), verify=False |
| 141 | ) |
| 142 | if response.status_code not in [200, 204]: |
| 143 | raise Exception(f"Failed to create vector: {response.status_code}") |
| 144 | |
| 145 | |
| 146 | def commit_transaction(collection_name, transaction_id): |
no test coverage detected