API Gateway returns TARGET_MODEL_HEADER_MISSING

0

Hi everybody

I have a deployed endpoint for a Sagemaker MultiDataModel. I can call it succesfully from my local computer using boto3.
I've set up an API Gateway to this Sagemaker MultiDataModel and I am trying to retrieve predictions from the model using a https request. But I keep getting a TARGET_MODEL_HEADER_MISSING-error.

My https request looks like this:
headers = {
'X-Amzn-SageMaker-Target-Model':'/jobtitles-exact'
}
response = requests.request("POST"
, "https://XXXXXXXXXX.execute-api.eu-north-1.amazonaws.com/v1/predicted-job-titles"
, headers = headers
, data = data
)

According to the documentation here:
https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_runtime_InvokeEndpoint.html
and the source code here:
https://github.com/aws/sagemaker-python-sdk/blob/master/src/sagemaker/local/local_session.py
it seems like I am providing the header with the target model correctly. But this is obvously not the case.

How am I supposed to provide the target model in the header with the https-request?

Best regards
Elias

질문됨 3년 전224회 조회
1개 답변

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인