Skip to content

Commit c9a856e

Browse files
committed
feat: Add application/x-parquet support to clarify.ModelConfig
1 parent 89ac414 commit c9a856e

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

‎sagemaker-core/src/sagemaker/core/clarify/__init__.py‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -379,12 +379,13 @@
379379
"image/jpeg",
380380
"image/png",
381381
"application/x-npy",
382+
"application/x-parquet",
382383
),
383384
),
384385
SchemaOptional("accept_type"): And(
385386
str,
386387
Use(str.lower),
387-
lambda s: s in ("text/csv", "application/jsonlines", "application/json"),
388+
lambda s: s in ("text/csv", "application/jsonlines", "application/json", "application/x-parquet"),
388389
),
389390
SchemaOptional("label"): Or(str, int),
390391
SchemaOptional("probability"): Or(str, int),
@@ -1020,11 +1021,13 @@ def __init__(
10201021
Must be set with ``instance_count``, ``model_name``
10211022
accept_type (str): The model output format to be used for getting inferences with the
10221023
shadow endpoint. Valid values are ``"text/csv"`` for CSV,
1023-
``"application/jsonlines"`` for JSON Lines, and ``"application/json"`` for JSON.
1024+
``"application/jsonlines"`` for JSON Lines, ``"application/json"`` for JSON, and
1025+
``"application/x-parquet"`` for Parquet.
10241026
Default is the same as ``content_type``.
10251027
content_type (str): The model input format to be used for getting inferences with the
10261028
shadow endpoint. Valid values are ``"text/csv"`` for CSV,
1027-
``"application/jsonlines"`` for JSON Lines, and ``"application/json"`` for JSON.
1029+
``"application/jsonlines"`` for JSON Lines, ``"application/json"`` for JSON, and
1030+
``"application/x-parquet"`` for Parquet.
10281031
Default is the same as ``dataset_format``.
10291032
content_template (str): A template string to be used to construct the model input from
10301033
dataset instances. It is only used, and required, when ``model_content_type`` is
@@ -1160,10 +1163,10 @@ def __init__(
11601163
)
11611164
self.predictor_config["endpoint_name_prefix"] = endpoint_name_prefix
11621165
if accept_type is not None:
1163-
if accept_type not in ["text/csv", "application/jsonlines", "application/json"]:
1166+
if accept_type not in ["text/csv", "application/jsonlines", "application/json", "application/x-parquet"]:
11641167
raise ValueError(
11651168
f"Invalid accept_type {accept_type}."
1166-
f" Please choose text/csv or application/jsonlines."
1169+
f" Please choose text/csv, application/jsonlines, application/json, or application/x-parquet."
11671170
)
11681171
if time_series_model_config and accept_type == "text/csv":
11691172
raise ValueError(
@@ -1179,10 +1182,11 @@ def __init__(
11791182
"image/jpg",
11801183
"image/png",
11811184
"application/x-npy",
1185+
"application/x-parquet",
11821186
]:
11831187
raise ValueError(
11841188
f"Invalid content_type {content_type}."
1185-
f" Please choose text/csv or application/jsonlines."
1189+
f" Please choose a valid content_type."
11861190
)
11871191
if content_type == "application/jsonlines":
11881192
if content_template is None:

0 commit comments

Comments
 (0)