Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions sagemaker-core/src/sagemaker/core/clarify/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,12 +379,13 @@
"image/jpeg",
"image/png",
"application/x-npy",
"application/x-parquet",
),
),
SchemaOptional("accept_type"): And(
str,
Use(str.lower),
lambda s: s in ("text/csv", "application/jsonlines", "application/json"),
lambda s: s in ("text/csv", "application/jsonlines", "application/json", "application/x-parquet"),
),
SchemaOptional("label"): Or(str, int),
SchemaOptional("probability"): Or(str, int),
Expand Down Expand Up @@ -1020,11 +1021,13 @@ def __init__(
Must be set with ``instance_count``, ``model_name``
accept_type (str): The model output format to be used for getting inferences with the
shadow endpoint. Valid values are ``"text/csv"`` for CSV,
``"application/jsonlines"`` for JSON Lines, and ``"application/json"`` for JSON.
``"application/jsonlines"`` for JSON Lines, ``"application/json"`` for JSON, and
``"application/x-parquet"`` for Parquet.
Default is the same as ``content_type``.
content_type (str): The model input format to be used for getting inferences with the
shadow endpoint. Valid values are ``"text/csv"`` for CSV,
``"application/jsonlines"`` for JSON Lines, and ``"application/json"`` for JSON.
``"application/jsonlines"`` for JSON Lines, ``"application/json"`` for JSON, and
``"application/x-parquet"`` for Parquet.
Default is the same as ``dataset_format``.
content_template (str): A template string to be used to construct the model input from
dataset instances. It is only used, and required, when ``model_content_type`` is
Expand Down Expand Up @@ -1160,10 +1163,10 @@ def __init__(
)
self.predictor_config["endpoint_name_prefix"] = endpoint_name_prefix
if accept_type is not None:
if accept_type not in ["text/csv", "application/jsonlines", "application/json"]:
if accept_type not in ["text/csv", "application/jsonlines", "application/json", "application/x-parquet"]:
raise ValueError(
f"Invalid accept_type {accept_type}."
f" Please choose text/csv or application/jsonlines."
f" Please choose text/csv, application/jsonlines, application/json, or application/x-parquet."
)
if time_series_model_config and accept_type == "text/csv":
raise ValueError(
Expand All @@ -1179,10 +1182,11 @@ def __init__(
"image/jpg",
"image/png",
"application/x-npy",
"application/x-parquet",
]:
raise ValueError(
f"Invalid content_type {content_type}."
f" Please choose text/csv or application/jsonlines."
f" Please choose a valid content_type."
)
if content_type == "application/jsonlines":
if content_template is None:
Expand Down
Loading