openai.UnprocessableEntityError when tools return empty list(`[]`) in Agents based on `ChatDeepSeek`

### Checked other resources

- [x] This is a bug, not a usage question. For questions, please use GitHub Discussions.
- [x] I added a clear and detailed title that summarizes the issue.
- [x] I read what a minimal reproducible example is (https://stackoverflow.com/help/minimal-reproducible-example).
- [x] I included a self-contained, minimal example that demonstrates the issue INCLUDING all the relevant imports. The code run AS IS to reproduce the issue.

### Example Code

```python
from langchain_deepseek import ChatDeepSeek
from langchain_core.messages import HumanMessage
from langgraph.prebuilt import create_react_agent
import getpass
import os

def test():
    '''A test function. call it if and only if the user ask you to do.'''
    return []

tools = [test]
prompt = (
    "You are an AI Agent based on an LLM with tools available. "
    "Be sure you understand the tools provided. "
    "Help the user finish the task with rigth tools "
)

class BugAgent():
    def __init__(self):
        self.model = ChatDeepSeek(model='deepseek-chat')
        self.config = {"configurable": {"thread_id": "abc123"}}
        self.agent_excutor = create_react_agent(model=self.model, tools=tools, prompt=prompt)
        
    def answer(self, message) -> str:
        ans = self.agent_excutor.invoke(
            {"messages": [HumanMessage(content=message)]}, 
            config=self.config,
            stream_mode='values'
        )
        return ans["messages"][-1].content
        
if __name__ == '__main__':
    if not os.environ.get("DEEPSEEK_API_KEY"):
        os.environ["DEEPSEEK_API_KEY"] = getpass.getpass("Enter API key for DeepSeek: ")
    
    bugAgent = BugAgent()
    print(bugAgent.answer('Hello, what tools do you have?'))
    print(bugAgent.answer('Call the test function.'))
```

### Error Message and Stack Trace (if applicable)

```shell
I currently have access to the following tool:

1. **test**: A test function that I can call if and only if you explicitly ask me to do so. It doesn't perform any specific task but serves as a placeholder for testing purposes.

Let me know if you'd like me to use this tool or assist you with anything else!
Traceback (most recent call last):
  File "/home/vdack/WorkSpace/MachineLearning/DLProject/bugAgent.py", line 49, in <module>
    print(bugAgent.answer(message2))
          ~~~~~~~~~~~~~~~^^^^^^^^^^
  File "/home/vdack/WorkSpace/MachineLearning/DLProject/bugAgent.py", line 30, in answer
    ans = self.agent_excutor.invoke(
        {"messages": [HumanMessage(content=message)]},
        config=self.config,
        stream_mode='values'
    )
  File "/home/vdack/miniconda3/envs/agent/lib/python3.13/site-packages/langgraph/pregel/__init__.py", line 2823, in invoke
    for chunk in self.stream(
                 ~~~~~~~~~~~^
        input,
        ^^^^^^
    ...<7 lines>...
        **kwargs,
        ^^^^^^^^^
    ):
    ^
  File "/home/vdack/miniconda3/envs/agent/lib/python3.13/site-packages/langgraph/pregel/__init__.py", line 2461, in stream
    for _ in runner.tick(
             ~~~~~~~~~~~^
        loop.tasks.values(),
        ^^^^^^^^^^^^^^^^^^^^
    ...<2 lines>...
        get_waiter=get_waiter,
        ^^^^^^^^^^^^^^^^^^^^^^
    ):
    ^
  File "/home/vdack/miniconda3/envs/agent/lib/python3.13/site-packages/langgraph/prebuilt/chat_agent_executor.py", line 745, in call_model
    response = cast(AIMessage, model_runnable.invoke(state, config))
                               ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
  File "/home/vdack/miniconda3/envs/agent/lib/python3.13/site-packages/langchain_core/runnables/base.py", line 3034, in invoke
    input = context.run(step.invoke, input, config)
  File "/home/vdack/miniconda3/envs/agent/lib/python3.13/site-packages/langchain_core/runnables/base.py", line 5416, in invoke
    return self.bound.invoke(
           ~~~~~~~~~~~~~~~~~^
        input,
        ^^^^^^
        self._merge_configs(config),
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        **{**self.kwargs, **kwargs},
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/vdack/miniconda3/envs/agent/lib/python3.13/site-packages/langchain_core/language_models/chat_models.py", line 370, in invoke
    self.generate_prompt(
    ~~~~~~~~~~~~~~~~~~~~^
        [self._convert_input(input)],
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
        **kwargs,
        ^^^^^^^^^
    ).generations[0][0],
    ^
  File "/home/vdack/miniconda3/envs/agent/lib/python3.13/site-packages/langchain_core/language_models/chat_models.py", line 947, in generate_prompt
    return self.generate(prompt_messages, stop=stop, callbacks=callbacks, **kwargs)
           ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vdack/miniconda3/envs/agent/lib/python3.13/site-packages/langchain_core/language_models/chat_models.py", line 766, in generate
    self._generate_with_cache(
    ~~~~~~~~~~~~~~~~~~~~~~~~~^
        m,
        ^^
    ...<2 lines>...
        **kwargs,
        ^^^^^^^^^
    )
    ^
  File "/home/vdack/miniconda3/envs/agent/lib/python3.13/site-packages/langchain_core/language_models/chat_models.py", line 1012, in _generate_with_cache
    result = self._generate(
        messages, stop=stop, run_manager=run_manager, **kwargs
    )
  File "/home/vdack/miniconda3/envs/agent/lib/python3.13/site-packages/langchain_deepseek/chat_models.py", line 296, in _generate
    return super()._generate(
           ~~~~~~~~~~~~~~~~~^
        messages, stop=stop, run_manager=run_manager, **kwargs
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/vdack/miniconda3/envs/agent/lib/python3.13/site-packages/langchain_openai/chat_models/base.py", line 959, in _generate
    response = self.client.create(**payload)
  File "/home/vdack/miniconda3/envs/agent/lib/python3.13/site-packages/openai/_utils/_utils.py", line 287, in wrapper
    return func(*args, **kwargs)
  File "/home/vdack/miniconda3/envs/agent/lib/python3.13/site-packages/openai/resources/chat/completions/completions.py", line 925, in create
    return self._post(
           ~~~~~~~~~~^
        "/chat/completions",
        ^^^^^^^^^^^^^^^^^^^^
    ...<43 lines>...
        stream_cls=Stream[ChatCompletionChunk],
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/vdack/miniconda3/envs/agent/lib/python3.13/site-packages/openai/_base_client.py", line 1239, in post
    return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
                           ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vdack/miniconda3/envs/agent/lib/python3.13/site-packages/openai/_base_client.py", line 1034, in request
    raise self._make_status_error_from_response(err.response) from None
openai.UnprocessableEntityError: Failed to deserialize the JSON body into the target type: messages[5]: invalid type: sequence, expected a string at line 1 column 904
During task with name 'agent' and id 'f71ec259-1b97-e0d3-2254-58ed5819a040'
```

### Description

I encountered an issue while creating an Agent using `ChatDeepSeek` and `create_react_agent`.

When the Agent invokes a tool that returns an empty list (`[]`), it results in an `openai.UnprocessableEntityError` due to a failure in deserializing the JSON body.

However, when using `ChatGoogleGenerativeAI` with `gemini`, the same scenario works as expected. The response is:

```
I have access to the `default_api` tool, which allows me to run a test function. Would you like me to run it?
The test function has been executed. The output is:

\```
{"test_response": {"output": []}}
\```
Is there anything else I can help you with?
```

So I guess it is bug. This suggests that the issue may be related to how `ChatDeepSeek` handles empty JSON responses from tools. 

### System Info

`python bugAgent.py `

Labels: bug
State: closed