Issue: can't use llm sagemaker endpoint as load_qa_chain
Labels: name: auto:bug, name: area: models, name: integration: aws

I've deployed 'mistralai/Mistral-7B-v0.1' model to sagemaker and wanna use it as load_qa_chain

```
from langchain.chains.question_answering import load_qa_chain
from langchain.llms.sagemaker_endpoint import SagemakerEndpoint

content_handler = ContentHandler()

llm = SagemakerEndpoint(
    endpoint_name=endpoint_name,
    region_name="eu-west-2",
    model_kwargs={
        "temperature": 0,
        "maxTokens": 1024,
        "numResults": 2
    },
    content_handler=content_handler
)

chain = load_qa_chain(llm=llm, chain_type="stuff")
```

Now, running chain for Doc QA.

`chain.run(input_documents = docs, question = "what is dollarama")`

```
---------------------------------------------------------------------------
ValidationError                           Traceback (most recent call last)
Cell In[56], line 1
----> 1 chain.run(input_documents = docs, question = "what is dollarama")

File ~/anaconda3/envs/tensorflow2_p310/lib/python3.10/site-packages/langchain/chains/base.py:506, in Chain.run(self, callbacks, tags, metadata, *args, **kwargs)
    501     return self(args[0], callbacks=callbacks, tags=tags, metadata=metadata)[
    502         _output_key
    503     ]
    505 if kwargs and not args:
--> 506     return self(kwargs, callbacks=callbacks, tags=tags, metadata=metadata)[
    507         _output_key
    508     ]
    510 if not kwargs and not args:
    511     raise ValueError(
    512         "`run` supported with either positional arguments or keyword arguments,"
    513         " but none were provided."
    514     )

File ~/anaconda3/envs/tensorflow2_p310/lib/python3.10/site-packages/langchain/chains/base.py:306, in Chain.__call__(self, inputs, return_only_outputs, callbacks, tags, metadata, run_name, include_run_info)
    304 except BaseException as e:
    305     run_manager.on_chain_error(e)
--> 306     raise e
    307 run_manager.on_chain_end(outputs)
    308 final_outputs: Dict[str, Any] = self.prep_outputs(
    309     inputs, outputs, return_only_outputs
    310 )

File ~/anaconda3/envs/tensorflow2_p310/lib/python3.10/site-packages/langchain/chains/base.py:300, in Chain.__call__(self, inputs, return_only_outputs, callbacks, tags, metadata, run_name, include_run_info)
    293 run_manager = callback_manager.on_chain_start(
    294     dumpd(self),
    295     inputs,
    296     name=run_name,
    297 )
    298 try:
    299     outputs = (
--> 300         self._call(inputs, run_manager=run_manager)
    301         if new_arg_supported
    302         else self._call(inputs)
    303     )
    304 except BaseException as e:
    305     run_manager.on_chain_error(e)

File ~/anaconda3/envs/tensorflow2_p310/lib/python3.10/site-packages/langchain/chains/combine_documents/base.py:119, in BaseCombineDocumentsChain._call(self, inputs, run_manager)
    117 # Other keys are assumed to be needed for LLM prediction
    118 other_keys = {k: v for k, v in inputs.items() if k != self.input_key}
--> 119 output, extra_return_dict = self.combine_docs(
    120     docs, callbacks=_run_manager.get_child(), **other_keys
    121 )
    122 extra_return_dict[self.output_key] = output
    123 return extra_return_dict

File ~/anaconda3/envs/tensorflow2_p310/lib/python3.10/site-packages/langchain/chains/combine_documents/stuff.py:171, in StuffDocumentsChain.combine_docs(self, docs, callbacks, **kwargs)
    169 inputs = self._get_inputs(docs, **kwargs)
    170 # Call predict on the LLM.
--> 171 return self.llm_chain.predict(callbacks=callbacks, **inputs), {}

File ~/anaconda3/envs/tensorflow2_p310/lib/python3.10/site-packages/langchain/chains/llm.py:257, in LLMChain.predict(self, callbacks, **kwargs)
    242 def predict(self, callbacks: Callbacks = None, **kwargs: Any) -> str:
    243     """Format prompt with kwargs and pass to LLM.
    244 
    245     Args:
   (...)
    255             completion = llm.predict(adjective="funny")
    256     """
--> 257     return self(kwargs, callbacks=callbacks)[self.output_key]

File ~/anaconda3/envs/tensorflow2_p310/lib/python3.10/site-packages/langchain/chains/base.py:306, in Chain.__call__(self, inputs, return_only_outputs, callbacks, tags, metadata, run_name, include_run_info)
    304 except BaseException as e:
    305     run_manager.on_chain_error(e)
--> 306     raise e
    307 run_manager.on_chain_end(outputs)
    308 final_outputs: Dict[str, Any] = self.prep_outputs(
    309     inputs, outputs, return_only_outputs
    310 )

File ~/anaconda3/envs/tensorflow2_p310/lib/python3.10/site-packages/langchain/chains/base.py:300, in Chain.__call__(self, inputs, return_only_outputs, callbacks, tags, metadata, run_name, include_run_info)
    293 run_manager = callback_manager.on_chain_start(
    294     dumpd(self),
    295     inputs,
    296     name=run_name,
    297 )
    298 try:
    299     outputs = (
--> 300         self._call(inputs, run_manager=run_manager)
    301         if new_arg_supported
    302         else self._call(inputs)
    303     )
    304 except BaseException as e:
    305     run_manager.on_chain_error(e)

File ~/anaconda3/envs/tensorflow2_p310/lib/python3.10/site-packages/langchain/chains/llm.py:93, in LLMChain._call(self, inputs, run_manager)
     88 def _call(
     89     self,
     90     inputs: Dict[str, Any],
     91     run_manager: Optional[CallbackManagerForChainRun] = None,
     92 ) -> Dict[str, str]:
---> 93     response = self.generate([inputs], run_manager=run_manager)
     94     return self.create_outputs(response)[0]

File ~/anaconda3/envs/tensorflow2_p310/lib/python3.10/site-packages/langchain/chains/llm.py:103, in LLMChain.generate(self, input_list, run_manager)
    101 """Generate LLM result from inputs."""
    102 prompts, stop = self.prep_prompts(input_list, run_manager=run_manager)
--> 103 return self.llm.generate_prompt(
    104     prompts,
    105     stop,
    106     callbacks=run_manager.get_child() if run_manager else None,
    107     **self.llm_kwargs,
    108 )

File ~/anaconda3/envs/tensorflow2_p310/lib/python3.10/site-packages/langchain/llms/base.py:498, in BaseLLM.generate_prompt(self, prompts, stop, callbacks, **kwargs)
    490 def generate_prompt(
    491     self,
    492     prompts: List[PromptValue],
   (...)
    495     **kwargs: Any,
    496 ) -> LLMResult:
    497     prompt_strings = [p.to_string() for p in prompts]
--> 498     return self.generate(prompt_strings, stop=stop, callbacks=callbacks, **kwargs)

File ~/anaconda3/envs/tensorflow2_p310/lib/python3.10/site-packages/langchain/llms/base.py:647, in BaseLLM.generate(self, prompts, stop, callbacks, tags, metadata, run_name, **kwargs)
    632         raise ValueError(
    633             "Asked to cache, but no cache found at `langchain.cache`."
    634         )
    635     run_managers = [
    636         callback_manager.on_llm_start(
    637             dumpd(self),
   (...)
    645         )
    646     ]
--> 647     output = self._generate_helper(
    648         prompts, stop, run_managers, bool(new_arg_supported), **kwargs
    649     )
    650     return output
    651 if len(missing_prompts) > 0:

File ~/anaconda3/envs/tensorflow2_p310/lib/python3.10/site-packages/langchain/llms/base.py:535, in BaseLLM._generate_helper(self, prompts, stop, run_managers, new_arg_supported, **kwargs)
    533     for run_manager in run_managers:
    534         run_manager.on_llm_error(e)
--> 535     raise e
    536 flattened_outputs = output.flatten()
    537 for manager, flattened_output in zip(run_managers, flattened_outputs):

File ~/anaconda3/envs/tensorflow2_p310/lib/python3.10/site-packages/langchain/llms/base.py:522, in BaseLLM._generate_helper(self, prompts, stop, run_managers, new_arg_supported, **kwargs)
    512 def _generate_helper(
    513     self,
    514     prompts: List[str],
   (...)
    518     **kwargs: Any,
    519 ) -> LLMResult:
    520     try:
    521         output = (
--> 522             self._generate(
    523                 prompts,
    524                 stop=stop,
    525                 # TODO: support multiple run managers
    526                 run_manager=run_managers[0] if run_managers else None,
    527                 **kwargs,
    528             )
    529             if new_arg_supported
    530             else self._generate(prompts, stop=stop)
    531         )
    532     except BaseException as e:
    533         for run_manager in run_managers:

File ~/anaconda3/envs/tensorflow2_p310/lib/python3.10/site-packages/langchain/llms/base.py:1048, in LLM._generate(self, prompts, stop, run_manager, **kwargs)
   1042 for prompt in prompts:
   1043     text = (
   1044         self._call(prompt, stop=stop, run_manager=run_manager, **kwargs)
   1045         if new_arg_supported
   1046         else self._call(prompt, stop=stop, **kwargs)
   1047     )
-> 1048     generations.append([Generation(text=text)])
   1049 return LLMResult(generations=generations)

File ~/anaconda3/envs/tensorflow2_p310/lib/python3.10/site-packages/langchain/load/serializable.py:97, in Serializable.__init__(self, **kwargs)
     96 def __init__(self, **kwargs: Any) -> None:
---> 97     super().__init__(**kwargs)
     98     self._lc_kwargs = kwargs

File ~/anaconda3/envs/tensorflow2_p310/lib/python3.10/site-packages/pydantic/main.py:341, in pydantic.main.BaseModel.__init__()

ValidationError: 1 validation error for Generation
text
  str type expected (type=type_error.str)
```

### Suggestion:

When I'm using openai api, it works but, only sagemaker endpoint is problem.