Issue with Sagemaker 
Labels: name: auto:bug, name: stale, name: area: models, name: integration: aws

### System Info

python3

### Who can help?

_No response_

### Information

- [ ] The official example notebooks/scripts
- [ ] My own modified scripts

### Related Components

- [X] LLMs/Chat Models
- [ ] Embedding Models
- [ ] Prompts / Prompt Templates / Prompt Selectors
- [ ] Output Parsers
- [ ] Document Loaders
- [ ] Vector Stores / Retrievers
- [ ] Memory
- [ ] Agents / Agent Executors
- [ ] Tools / Toolkits
- [ ] Chains
- [ ] Callbacks/Tracing
- [ ] Async

### Reproduction

```
import boto3
import json

PROFILE_NAME = 'PROFILE'
REGION_NAME = 'REGION'
ENDPOINT_NAME = 'ENDPOINT'
CONTENT_TYPE = 'application/json'
CUSTOM_ATTRIBUTES = 'accept_eula=true'

TEMPERATURE = 0.001
MAX_LENGTH = 1000

def build_llama2_prompt(message):
    startPrompt = "

 "
    endPrompt = " 
"
    conversation = []
    if message["role"] == "system":
        conversation.append(f"
\n{message['content']}\n
\n\n")
    elif message["role"] == "user":
        conversation.append(message["content"].strip())
    else:
        conversation.append(f" 
 {message['content'].strip()}


 ")

    return startPrompt + "".join(conversation) + endPrompt

def transform_input(prompt):
        payload = {
            "inputs": [
                [
                    {"role": "user", "content": prompt},
                ],
                ],
                "parameters": {"max_new_tokens": 1000, "top_p": 0.6, "temperature": 0.1},
        }

        input_str = json.dumps(
            payload,
        )
        
        return input_str

def invoke_sagemaker_endpoint(profile_name, region_name, endpoint_name, content_type, custom_attributes, payload):
    session = boto3.Session(profile_name=profile_name, region_name=region_name)
    sagemaker = session.client('sagemaker-runtime')
    
    response = sagemaker.invoke_endpoint(
        EndpointName=endpoint_name,
        ContentType=content_type,
        Body=json.dumps(payload),
        CustomAttributes=custom_attributes
    )
    
    body = response['Body']
    prediction_result = json.loads(body.read().decode('utf-8'))
    
    return prediction_result

def pretty_print_result(result):
    text = result[0]['generated_text']
    
    print(f"{ANSI_GREEN}Prediction Result:{ANSI_RESET}")
    print(f"{ANSI_GREEN}{text}{ANSI_RESET}")

if __name__ == "__main__":
          input_text = 'String'

          print("prompt")
          print(input_text)

          prompt = transform_input(input_text)

          request_payload = {
              'inputs': prompt,
              'parameters': {
                "do_sample": True,
                "top_p": 0.6,
                "temperature": 0.9,
                "top_k": 50,
                "max_new_tokens": 512,
                "repetition_penalty": 1.03,
                "stop": ["
"]
              }
          }

          prediction_result = invoke_sagemaker_endpoint(PROFILE_NAME, REGION_NAME, ENDPOINT_NAME, CONTENT_TYPE, CUSTOM_ATTRIBUTES, request_payload)
          pretty_print_result(prediction_result)

```

### Expected behavior

bugging, leading to error:
`    raise error_class(parsed_response, operation_name)
botocore.errorfactory.ModelError: An error occurred (ModelError) when calling the InvokeEndpoint operation: Received client error (424) from primary with message "{
  "code":424,
  "message":"prediction failure",
  "error":"string indices must be integers"
`