Skip to main content

client.slices.list()

List all slices for a given owner.
owner
str
required
Username or organization slug
limit
int
Maximum number of slices to return
cursor
str
Pagination cursor from a previous response
data
CursorPage[Slice]
Paginated list of slices
from avala import Avala

client = Avala(api_key="your-api-key")

slices = client.slices.list(owner="username")
for slice in slices:
    print(slice.name)

client.slices.get()

Retrieve a specific slice by owner and slug.
owner
str
required
Username or organization slug
slug
str
required
Slice identifier slug
response
Slice
The requested slice object
slice = client.slices.get(
    owner="username",
    slug="my-slice"
)
print(slice.name)

client.slices.create()

Create a new slice.
name
str
required
Name of the slice
visibility
str
required
Visibility setting (e.g., “public”, “private”)
sub_slices
List[Dict[str, Any]]
required
List of sub-slice configurations
organization
str
Organization slug to create the slice under
random_selection_count
int
Number of items to randomly select from the slice
response
Slice
The newly created slice object
slice = client.slices.create(
    name="Training Set",
    visibility="private",
    sub_slices=[
        {
            "dataset": "username/dataset-slug",
            "filters": {"split": "train"}
        }
    ],
    organization="my-org"
)

client.slices.list_items()

List all items in a specific slice.
owner
str
required
Username or organization slug
slug
str
required
Slice identifier slug
limit
int
Maximum number of items to return
cursor
str
Pagination cursor from a previous response
data
CursorPage[SliceItem]
Paginated list of slice items
items = client.slices.list_items(
    owner="username",
    slug="my-slice"
)
for item in items:
    print(item.uid)

client.slices.get_item()

Retrieve a specific item from a slice.
owner
str
required
Username or organization slug
slug
str
required
Slice identifier slug
item_uid
str
required
Unique identifier of the slice item
response
SliceItem
The requested slice item object
item = client.slices.get_item(
    owner="username",
    slug="my-slice",
    item_uid="item-123"
)
print(item.uid)

Async Methods

All methods are available in async form via client.slices when using AsyncAvala:
from avala import AsyncAvala

async with AsyncAvala(api_key="your-api-key") as client:
    slices = await client.slices.list(owner="username")
    
    slice = await client.slices.get(
        owner="username",
        slug="my-slice"
    )
    
    new_slice = await client.slices.create(
        name="Training Set",
        visibility="private",
        sub_slices=[...]
    )
    
    items = await client.slices.list_items(
        owner="username",
        slug="my-slice"
    )
    
    item = await client.slices.get_item(
        owner="username",
        slug="my-slice",
        item_uid="item-123"
    )

Build docs developers (and LLMs) love