Skip to content

Commit

Permalink
feat: llm export - customize filter by asset status
Browse files Browse the repository at this point in the history
  • Loading branch information
baptiste-olivier committed Nov 15, 2024
1 parent 133f644 commit e13c193
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/kili/llm/presentation/client/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
)

from kili.adapters.kili_api_gateway.kili_api_gateway import KiliAPIGateway
from kili.domain.asset import AssetExternalId, AssetFilters, AssetId
from kili.domain.asset import AssetExternalId, AssetFilters, AssetId, AssetStatus
from kili.domain.label import LabelType
from kili.domain.llm import (
AzureOpenAICredentials,
Expand Down Expand Up @@ -47,6 +47,7 @@ def export(
external_ids: Optional[List[str]] = None,
include_sent_back_labels: Optional[bool] = False,
label_type_in: Optional[List[LabelType]] = None,
status_in: Optional[List[AssetStatus]] = None,
) -> Optional[List[Dict[str, Union[List[str], str]]]]:
# pylint: disable=line-too-long
"""Returns an export of llm assets with valid labels.
Expand All @@ -58,6 +59,8 @@ def export(
external_ids: Optional list of the assets external IDs from which to export the labels.
include_sent_back_labels: Include sent back labels if True.
label_type_in: Optional types of label to fetch, by default ["DEFAULT", "REVIEW"].
status_in: Returned assets should have a status that belongs to that list, if given.
Possible choices: `TODO`, `ONGOING`, `LABELED`, `TO_REVIEW` or `REVIEWED`.
!!! Example
```python
kili.llm.export("your_project_id")
Expand All @@ -83,6 +86,7 @@ def export(
project_id=ProjectId(project_id),
asset_id_in=resolved_asset_ids,
label_type_in=label_type_in,
status_in=status_in,
)

try:
Expand Down
1 change: 0 additions & 1 deletion src/kili/llm/services/export/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ def export( # pylint: disable=too-many-arguments, too-many-locals
input_type = project["inputType"]

fields = get_fields_to_fetch(input_type)
asset_filter.status_in = ["LABELED", "REVIEWED", "TO_REVIEW", "ONGOING"]
assets = list(
kili_api_gateway.list_assets(asset_filter, fields, QueryOptions(disable_tqdm=disable_tqdm))
)
Expand Down

0 comments on commit e13c193

Please sign in to comment.