# Quản lý các bộ sưu tập

Xem trang tài liệu [HfApi](/docs/huggingface_hub/v2.4.0/vi/package_reference/hf_api#huggingface_hub.HfApi) để tham khảo các phương thức quản lý Space của bạn trên Hub.

- Lấy nội dung bộ sưu tập: [get_collection()](/docs/huggingface_hub/v2.4.0/vi/package_reference/hf_api#huggingface_hub.HfApi.get_collection)
- Tạo bộ sưu tập mới: [create_collection()](/docs/huggingface_hub/v2.4.0/vi/package_reference/hf_api#huggingface_hub.HfApi.create_collection)
- Cập nhật một bộ sưu tập: [update_collection_metadata()](/docs/huggingface_hub/v2.4.0/vi/package_reference/hf_api#huggingface_hub.HfApi.update_collection_metadata)
- Cập nhật nhóm tài nguyên của bộ sưu tập: [update_collection_resource_group()](/docs/huggingface_hub/v2.4.0/vi/package_reference/hf_api#huggingface_hub.HfApi.update_collection_resource_group)
- Xóa một bộ sưu tập: [delete_collection()](/docs/huggingface_hub/v2.4.0/vi/package_reference/hf_api#huggingface_hub.HfApi.delete_collection)
- Thêm một mục vào bộ sưu tập: [add_collection_item()](/docs/huggingface_hub/v2.4.0/vi/package_reference/hf_api#huggingface_hub.HfApi.add_collection_item)
- Cập nhật một mục trong bộ sưu tập: [update_collection_item()](/docs/huggingface_hub/v2.4.0/vi/package_reference/hf_api#huggingface_hub.HfApi.update_collection_item)
- Xóa một mục khỏi bộ sưu tập: [delete_collection_item()](/docs/huggingface_hub/v2.4.0/vi/package_reference/hf_api#huggingface_hub.HfApi.delete_collection_item)

### Bộ sưu tập[[huggingface_hub.Collection]]

#### huggingface_hub.Collection[[huggingface_hub.Collection]]

```python
huggingface_hub.Collection(**kwargs)
```

[Nguồn](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/hf_api.py#L1381)

**Tham số:**

slug (`str`) : Slug của bộ sưu tập. Ví dụ: `"TheBloke/recent-models-64f9a55bb3115b4f513ec026"`.

title (`str`) : Tiêu đề của bộ sưu tập. Ví dụ: `"Recent models"`.

owner (`str`) : Chủ sở hữu của bộ sưu tập. Ví dụ: `"TheBloke"`.

items (`list[CollectionItem]`) : Danh sách các mục trong bộ sưu tập.

last_updated (`datetime`) : Ngày cập nhật cuối cùng của bộ sưu tập.

position (`int`) : Vị trí của bộ sưu tập trong danh sách các bộ sưu tập của chủ sở hữu.

private (`bool`) : Cho biết bộ sưu tập có phải là riêng tư hay không.

theme (`str`) : Chủ đề của bộ sưu tập. Ví dụ: `"green"`.

upvotes (`int`) : Số lượt bình chọn tích cực của bộ sưu tập.

description (`str`, *tùy chọn*) : Mô tả của bộ sưu tập, dưới dạng văn bản thuần túy.

url (`str`) : (property) URL của bộ sưu tập trên Hub.

Chứa thông tin về một Collection trên Hub.

### CollectionItem[[huggingface_hub.CollectionItem]]

#### huggingface_hub.CollectionItem[[huggingface_hub.CollectionItem]]

```python
huggingface_hub.CollectionItem(_id: str, id: str, type: CollectionItemType_T, position: int, note: dict | None = None, **kwargs)
```

[Nguồn](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/hf_api.py#L1333)

**Tham số:**

item_object_id (`str`) : ID duy nhất của mục trong bộ sưu tập.

item_id (`str`) : ID của đối tượng cơ bản trên Hub. Có thể là repo_id, paper id, collection slug hoặc bucket id. Ví dụ: `"jbilcke-hf/ai-comic-factory"`, `"2307.09288"`, `"celinah/cerebras-function-calling-682607169c35fbfa98b30b9a"`.

item_type (`str`) : Kiểu của đối tượng cơ sở. Có thể là một trong `"model"`, `"dataset"`, `"space"`, `"paper"`, `"collection"` hoặc `"bucket"`.

position (`int`) : Vị trí của mục trong bộ sưu tập.

note (`str`, *tùy chọn*) : Ghi chú liên quan đến mục, dưới dạng văn bản thuần túy.

Chứa thông tin về một mục của một Collection (mô hình, dataset, Space, bài báo, collection hoặc bucket).

