(collection_name, transaction_id, vector)
| 114 | |
| 115 | |
| 116 | def create_vector_in_transaction(collection_name, transaction_id, vector): |
| 117 | url = f"{base_url}/collections/{collection_name}/transactions/{transaction_id}/vectors" |
| 118 | data = {"id": vector["id"], "dense_values": vector["values"], "metadata": {}} |
| 119 | print(f"Request URL: {url}") |
| 120 | print(f"Request Data: {json.dumps(data)}") |
| 121 | response = requests.post( |
| 122 | url, headers=generate_headers(), data=json.dumps(data), verify=False |
| 123 | ) |
| 124 | print(f"Response Status: {response.status_code}") |
| 125 | print(f"Response Text: {response.text}") |
| 126 | if response.status_code not in [200, 204]: |
| 127 | raise Exception(f"Failed to create vector: {response.status_code}") |
| 128 | return response.json() if response.text else None |
| 129 | |
| 130 | |
| 131 | def upsert_in_transaction(collection_name, transaction_id, vectors): |
nothing calls this directly
no test coverage detected