Repository navigation
feat: Add application/x-parquet support to clarify.ModelConfig (Issue #3450) #6068
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
c9a856e
5202e17
d3b4674
168202c
55f3e64
7a2a9e9
d057cfa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -380,12 +380,19 @@ | |
| "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), | ||
|
|
@@ -1021,11 +1028,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 | ||
|
|
@@ -1161,10 +1170,15 @@ 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( | ||
|
|
@@ -1180,10 +1194,11 @@ def __init__( | |
| "image/jpg", | ||
| "image/png", | ||
| "application/x-npy", | ||
| "application/x-parquet", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟠 Medium: The validation now accepts |
||
| ]: | ||
| raise ValueError( | ||
| f"Invalid content_type {content_type}." | ||
| f" Please choose text/csv or application/jsonlines." | ||
| f" Please choose text/csv, application/jsonlines, application/json, image/jpeg, image/jpg, image/png, application/x-npy, or application/x-parquet." | ||
| ) | ||
| if content_type == "application/jsonlines": | ||
| if content_template is None: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟠 Medium: No unit test was added for the newly accepted
application/x-parquetvalue. The existing tests intests/unit/test_clarify.pyonly assert that invalid types raise, so this new acceptance path is untested. The guidance for this change notes: "Add unit tests when introducing new accepted values to ModelConfig content_type and accept_type validation to prevent regressions." (Source: #6068). Please add positive tests that construct aModelConfigwithcontent_type="application/x-parquet"andaccept_type="application/x-parquet".