Skip to main content
Version: v1.6.8 🚧

Delete a Collection

Overview​

A user can delete a Collection.

caution
  • A deleted Collection is no longer accessible by other users. 
  • Deleting a Collection removes it from the servers. Once a Collection is deleted, there is no way to undo the action or recover the deleted Collection or its Document(s).

Example​

from h2ogpte import H2OGPTE

client = H2OGPTE(
address="https://h2ogpte.genai.h2o.ai",
api_key='sk-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
)

collections = client.list_recent_collections(offset=0, limit=1)
collection_id = collections[0].id

delete_collection_job = client.delete_collections(collection_ids=[collection_id])

print(
f"Canceled: {delete_collection_job.canceled}\n"
f"Completed: {delete_collection_job.completed}\n"
f"Date: {delete_collection_job.date}\n"
f"Duration: {delete_collection_job.duration}\n"
f"Duration seconds: {delete_collection_job.duration_seconds}\n"
f"Errors: {delete_collection_job.errors}\n"
f"Failed: {delete_collection_job.failed}\n"
f"ID: {delete_collection_job.id}\n"
f"Kind: {delete_collection_job.kind}\n"
f"Last update date: {delete_collection_job.last_update_date}\n"
f"Model computed fields: {delete_collection_job.model_computed_fields}\n"
f"Model config: {delete_collection_job.model_config}\n"
f"Model fields: {delete_collection_job.model_fields}\n"
f"Name: {delete_collection_job.name}\n"
f"Passed: {delete_collection_job.passed}\n"
f"Progress: {delete_collection_job.progress}\n"
f"Statuses: {delete_collection_job.statuses}"
)
Canceled: False
Completed: True
Date: 2024-10-31 04:53:26+00:00
Duration: 1s
Duration seconds: 1.0
Errors: []
Failed: 0.0
ID: 6e1a4c25-34d4-42a4-b1c6-70a4e4a94bbf
Kind: JobKind.DeleteCollectionsJob
Last update date: 2024-10-31 04:53:27+00:00
Model computed fields: {}
Model config: {}
Model fields: {'id': FieldInfo(annotation=str, required=True), 'name': FieldInfo(annotation=str, required=True), 'passed': FieldInfo(annotation=float, required=True), 'failed': FieldInfo(annotation=float, required=True), 'progress': FieldInfo(annotation=float, required=True), 'completed': FieldInfo(annotation=bool, required=True), 'canceled': FieldInfo(annotation=bool, required=True), 'date': FieldInfo(annotation=datetime, required=True), 'kind': FieldInfo(annotation=JobKind, required=True), 'statuses': FieldInfo(annotation=List[JobStatus], required=True), 'errors': FieldInfo(annotation=List[str], required=True), 'last_update_date': FieldInfo(annotation=datetime, required=True), 'duration': FieldInfo(annotation=str, required=True), 'duration_seconds': FieldInfo(annotation=float, required=True)}
Name: Deleting collections
Passed: 1.0
Progress: 1.0
Statuses: [JobStatus(id='b05c668133c148099e883e8655515aae', status='Deleting indexes...')]

Feedback