Repository: langchain
Issue: dict[str, pydantic_model] annotation not working with structured output
Labels: 🤖:bug

### Checked other resources

- [X] I added a very descriptive title to this issue.
- [X] I searched the LangChain documentation with the integrated search.
- [X] I used the GitHub search to find a similar question and didn't find it.
- [X] I am sure that this is a bug in LangChain rather than my code.
- [X] The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).

### Example Code

```python 
from __future__ import annotations

from typing import Optional
from unittest import TestCase

from dotenv import load_dotenv
from langchain_openai import ChatOpenAI
from pydantic import Field, BaseModel

load_dotenv()
class CustomTestExtractorPropertiesCreation(TestCase):
    def test_with_structured_output_dict(self):
        class Joke(BaseModel):
            """Joke to tell user."""

            setup: str = Field(description="The setup of the joke")
            punchline: str = Field(description="The punchline to the joke")
            rating: Optional[int] = Field(
                default=None, description="How funny the joke is, from 1 to 10"
            )
        class MultipleJokes(BaseModel):
            name_joke_pairs: dict[str, Joke] = Field(description="Dictionary of joke_name and joke pairs")

        ChatOpenAI(name="gpt-4o-mini").with_structured_output(
            MultipleJokes).invoke("Generate a number of name-joke pairs")
```

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

Error
Traceback (most recent call last):
  File "/home/filip/work/llm-bot-framework/llm-bot-framework/tests/integration/conversations/custom_test_extractor_properties_creation.py", line 25, in test_with_structured_output_dict
    MultipleJokes).invoke("Generate a number of name-joke pairs")
  File "/home/filip/work/llm-bot-framework/llm-bot-framework/.venv/lib/python3.10/site-packages/langchain_core/runnables/base.py", line 3024, in invoke
    input = context.run(step.invoke, input, config)
  File "/home/filip/work/llm-bot-framework/llm-bot-framework/.venv/lib/python3.10/site-packages/langchain_core/output_parsers/base.py", line 193, in invoke
    return self._call_with_config(
  File "/home/filip/work/llm-bot-framework/llm-bot-framework/.venv/lib/python3.10/site-packages/langchain_core/runnables/base.py", line 1927, in _call_with_config
    context.run(
  File "/home/filip/work/llm-bot-framework/llm-bot-framework/.venv/lib/python3.10/site-packages/langchain_core/runnables/config.py", line 396, in call_func_with_variable_args
    return func(input, **kwargs)  # type: ignore[call-arg]
  File "/home/filip/work/llm-bot-framework/llm-bot-framework/.venv/lib/python3.10/site-packages/langchain_core/output_parsers/base.py", line 194, in <lambda>
    lambda inner_input: self.parse_result(
  File "/home/filip/work/llm-bot-framework/llm-bot-framework/.venv/lib/python3.10/site-packages/langchain_core/output_parsers/openai_tools.py", line 298, in parse_result
    raise e
  File "/home/filip/work/llm-bot-framework/llm-bot-framework/.venv/lib/python3.10/site-packages/langchain_core/output_parsers/openai_tools.py", line 293, in parse_result
    pydantic_objects.append(name_dict[res["type"]](**res["args"]))
  File "/home/filip/work/llm-bot-framework/llm-bot-framework/.venv/lib/python3.10/site-packages/pydantic/main.py", line 212, in __init__
    validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
pydantic_core._pydantic_core.ValidationError: 1 validation error for MultipleJokes
name_joke_pairs
  Field required [type=missing, input_value={}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.9/v/missing

### Description

I am trying to create MultipleJokes Pydantic Model (example). 
**Expected result:**
MultipleJokes object is created no error is returned
**Actual result:**
Missing field exception is raised on Pydantic validation  

### System Info

System Information
------------------
> OS:  Linux
> OS Version:  #48-Ubuntu SMP PREEMPT_DYNAMIC Fri Sep 27 14:04:52 UTC 2024
> Python Version:  3.10.15 (main, Sep  7 2024, 18:35:38) [GCC 13.2.0]

Package Information
-------------------
> langchain_core: 0.3.15
> langchain: 0.3.7
> langsmith: 0.1.134
> langchain_anthropic: 0.2.3
> langchain_google_genai: 2.0.1
> langchain_groq: 0.2.0
> langchain_nvidia: Installed. No version info available.
> langchain_nvidia_ai_endpoints: 0.3.0
> langchain_openai: 0.2.2
> langchain_text_splitters: 0.3.0
> langgraph: 0.2.38

Optional packages not installed
-------------------------------
> langserve

Other Dependencies
------------------
> aiohttp: 3.10.10
> anthropic: 0.36.0
> async-timeout: 4.0.3
> defusedxml: 0.7.1
> google-generativeai: 0.8.3
> groq: 0.11.0
> httpx: 0.26.0
> jsonpatch: 1.33
> langgraph-checkpoint: 2.0.1
> langgraph-sdk: 0.1.33
> numpy: 1.26.4
> openai: 1.51.2
> orjson: 3.10.7
> packaging: 24.1
> pillow: 10.4.0
> pydantic: 2.9.2
> PyYAML: 6.0.2
> requests: 2.32.3
> requests-toolbelt: 1.0.0
> SQLAlchemy: 2.0.35
> tenacity: 8.5.0
> tiktoken: 0.8.0
> typing-extensions: 4.12.2