ml-commons provides a set of common machine learning algorithms, e.g. k-means, or linear regression, to help developers build ML related features within OpenSearch.
Apache License 2.0
88
stars
125
forks
source link
[FEATURE] Improve error message when parameters are missing in predict request #1704
{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Invalid JSON in payload"}],"type":"illegal_argument_exception","reason":"Invalid JSON in payload"},"status":400}%
But Invalid JSON in payload is not helpful because the request payload contains a valid JSON.
Is your feature request related to a problem? Connector setup:
Request:
Response:
But
Invalid JSON in payload
is not helpful because the request payload contains a valid JSON.What solution would you like? Show a better error message in https://github.com/opensearch-project/ml-commons/blob/d1986404463df55850a0fa28b789c121f8b19e4a/common/src/main/java/org/opensearch/ml/common/connector/HttpConnector.java#L291-L295. Currently it throws
Invalid JSON in payload
because{"prompt":"\n\nHuman: hi\n\nAssistant:", "max_tokens_to_sample":${parameters.max_tokens_to_sample}, "temperature":${parameters.temperature}, "anthropic_version":"bedrock-2023-05-31" }
is not valid JSON, but it should mention it's because some parameters are missing.What alternatives have you considered? Fill non-supplied parameters with empty/default values
Do you have any additional context? I'm using
feature/agent_framework_dev
branch, not sure if other branches have different behaviors.