AsyncMock not preserved when passed to custom Chain
Labels: name: auto:bug, name: area: models

### System Info

Dependencies:

    langchain == 0.0.285
    pytest ~= 7.4.0
    pytest-asyncio ~= 0.21.1
    pytest-mock ~= 3.11.1

Using Python 3.11

### Who can help?

@agola11

### Information

- [ ] The official example notebooks/scripts
- [X] My own modified scripts

### Related Components

- [ ] LLMs/Chat Models
- [ ] Embedding Models
- [ ] Prompts / Prompt Templates / Prompt Selectors
- [ ] Output Parsers
- [ ] Document Loaders
- [ ] Vector Stores / Retrievers
- [ ] Memory
- [ ] Agents / Agent Executors
- [ ] Tools / Toolkits
- [X] Chains
- [ ] Callbacks/Tracing
- [X] Async

### Reproduction

The following Python script is self-contained. It features:
- A custom `Chain` implementation that uses an `LLMChain` internally, `bar`
    - We don't care about its inputs or outputs
    - We simply care that it takes an `LLMChain` and uses that to compute its output.
- A test (`async` using the `pytest-asyncio` library) where:
    - I mocked the `LLMChain` using an `AsyncMock` with spec `LLMChain`
    - I mocked the return value of the `arun` function in the `LLMChain`

### Self-contained Python Script

<details>
<summary>Self-contained Python Script</summary>

```py
from langchain.chains.base import Chain
from langchain import LLMChain
from typing import Any
from langchain.callbacks.manager import AsyncCallbackManagerForChainRun, CallbackManagerForChainRun
from unittest.mock import AsyncMock

from pydantic import BaseModel, Extra


class CustomChain(Chain):
    bar: LLMChain

    class Config:
        """Configuration for this pydantic object."""

        extra = Extra.forbid
        arbitrary_types_allowed = True
        allow_population_by_field_name = True

    @property
    def input_schema(self) -> type[BaseModel]:
        return BaseModel  # we don't care about the inputs here

    @property
    def input_keys(self) -> list[str]:
        return []

    @property
    def output_keys(self) -> list[str]:
        return ["output"]

    async def _acall(
        self,
        inputs: dict[str, Any],
        run_manager: AsyncCallbackManagerForChainRun | None = None,
    ) -> dict[str, Any]:
        intermediary_result = await self.bar.arun(message="hello")
        return {"output": intermediary_result}

    def _call(self, inputs: dict[str, Any], run_manager: CallbackManagerForChainRun | None = None) -> dict[str, Any]:
        raise NotImplementedError("Only supports async")


async def test_custom_chain():
    bar = AsyncMock(LLMChain)
    bar.arun.return_value = "Hi there!"

    custom_chain = CustomChain(bar=bar)
    await custom_chain._acall(inputs={})

    bar.arun.assert_awaited_once()
```
</details>

### Observed Output

The test should naturally succeed. Problem is that _somewhere_ in the initialization of the `CustomChain`, `bar` is changed from being an `AsyncMock` to a `MagicMock`. This is the inexplicable bit to me.

Placing a debugger breakpoint right before the initialization of `CustomChain` in the test function:

```
    custom_chain = CustomChain(bar=bar)
```

It shows that `bar` is `<AsyncMock spec='LLMChain' id='5218712656'>`, however from inside `CustomChain._acall` function, `self.bar` is a `<MagicMock name='mock._copy_and_set_values()' id='5221083792'>`.

<details>
<summary>Full test output</summary>

```
    async def test_custom_chain():
        bar = AsyncMock(LLMChain)
        bar.arun.return_value = "Hi there!"

        custom_chain = CustomChain(bar=bar)
>       await custom_chain._acall(inputs={})

test/brain/test_foo.py:49:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = CustomChain(memory=None, callbacks=None, callback_manager=None, verbose=False, tags=None, metadata=None, bar=<MagicMock name='mock._copy_and_set_values()' id='5099464528'>)
inputs = {}, run_manager = None

    async def _acall(
        self,
        inputs: dict[str, Any],
        run_manager: AsyncCallbackManagerForChainRun | None = None,
    ) -> dict[str, Any]:
>       intermediary_result = await self.bar.arun(message="hello")
E       TypeError: object MagicMock can't be used in 'await' expression

test/brain/test_foo.py:37: TypeError
```
</details>


### Expected behavior

Naturally, I would expect the parameter to my custom chain to be exactly what I passed, unmodified at any point. Hence, I would expect the test and its assertion to succeed.

_Please note_: I tried reproducing the issue outside of LangChain, just by creating a similar class - just inheriting from a Pydantic `BaseModel` rather than LangChain's `Chain`. The test succeeded just as expected.