You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sagemaker Runtime service sends the body as a JSON Object with key "Body" and invocation body in value. This is different from boto3 where the content is sent as is (no extra JSON Object wrapping the payload).
Example:
using AWS:@service@service Sagemaker_Runtime
body =Dict("feature1"=>"value1")
response = Sagemaker_Runtime.invoke_endpoint(body, "sagemaker-endpoint")
# the content sent is `{"Body": {"feature1": "value1"}}` but the endpoint expects `{"feature1": "value1"}`
Workaround:
using AWS
using AWS.AWSServices: sagemaker_runtime
functioninvoke_endpoint(
Body, EndpointName; aws_config::AbstractAWSConfig=global_aws_config()
)
returnsagemaker_runtime(
"POST",
"/endpoints/$(EndpointName)/invocations",
Body;
aws_config=aws_config,
)
end
body =Dict("feature1"=>"value1")
response =invoke_endpoint(payload, "sagemaker-endpoint")
# the endpoint receives `{"feature1": "value1"}`
Sagemaker Runtime service sends the body as a JSON Object with key "Body" and invocation body in value. This is different from boto3 where the content is sent as is (no extra JSON Object wrapping the payload).
Example:
Workaround:
Looking the code, there are two parts:
https://github.com/JuliaCloud/AWS.jl/blob/v1.78.0/src/services/sagemaker_runtime.jl#L72
https://github.com/JuliaCloud/AWS.jl/blob/v1.78.0/src/services/sagemaker_runtime.jl#L86
https://github.com/JuliaCloud/AWS.jl/blob/v1.78.0/src/AWS.jl#L426
Per AWS Documentation, body could be other formats than JSON not supported with
sagemaker_runtime
as aRestJSONService
.https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_runtime_InvokeEndpoint.html#API_runtime_InvokeEndpoint_RequestBody
https://docs.aws.amazon.com/sagemaker/latest/dg/cdf-inference.html#ir-serialization
I can give a try to fix this issue. Let me know if there is an approach that make more sense.
The text was updated successfully, but these errors were encountered: