(collection_name, transaction_id, vector)
| 122 | |
| 123 | |
| 124 | def 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 | |
| 139 | def upsert_in_transaction(collection_name, transaction_id, vectors): |
nothing calls this directly
no test coverage detected