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

Function create_vector_in_transaction

tests/load-test.py:124–136  ·  view source on GitHub ↗
(collection_name, transaction_id, vector)

Source from the content-addressed store, hash-verified

122
123
124def create_vector_in_transaction(collection_name, transaction_id, vector):
125 url = f"{base_url}/collections/{collection_name}/transactions/{transaction_id}/vectors"
126 data = {"id": vector["id"], "dense_values": vector["values"], "metadata": {}}
127 print(f"Request URL: {url}")
128 print(f"Request Data: {json.dumps(data)}")
129 response = requests.post(
130 url, headers=generate_headers(), data=json.dumps(data), verify=False
131 )
132 print(f"Response Status: {response.status_code}")
133 print(f"Response Text: {response.text}")
134 if response.status_code not in [200, 204]:
135 raise Exception(f"Failed to create vector: {response.status_code}")
136 return response.json() if response.text else None
137
138
139def upsert_in_transaction(collection_name, transaction_id, vectors):

Callers

nothing calls this directly

Calls 1

generate_headersFunction · 0.70

Tested by

no test coverage detected