| 68 | raise Exception(f"Failed to create TF-IDF index: {response.text}") |
| 69 | |
| 70 | def create_transaction(name): |
| 71 | url = f"{client.base_url}/collections/{name}/transactions" |
| 72 | response = requests.post( |
| 73 | url, |
| 74 | headers=client._get_headers(), |
| 75 | verify=client.verify_ssl, |
| 76 | ) |
| 77 | |
| 78 | if response.status_code not in [200, 201]: |
| 79 | raise Exception(f"Failed to create transaction: {response.text}") |
| 80 | |
| 81 | result = response.json() |
| 82 | transaction_id = result["transaction_id"] |
| 83 | return transaction_id |
| 84 | |
| 85 | def commit_transaction(name, txn_id): |
| 86 | url = f"{client.base_url}/collections/{name}/transactions/{txn_id}/commit" |