Pydantic to tool schema: langchain-core inlines nested models and keeps defaults, Optional becomes anyOf with null
convert_to_openai_tool on a Pydantic model with Optional[int]=None, Union[int,str], Literal['a','b'], dict[str, Any], a nested model, list[Nested] with default_factory=list and Field(1, description=...) gave: Optional -> anyOf [integer, null] plus default null; Union -> anyOf; Literal -> enum with type string; dict[str, Any] -> {additionalProperties: true, type: object}; nested models are inlined (no $defs or $ref remain) with the nested class docstring as description; fields with a default (including default_factory) are omitted from required and plain defaults are kept; title keys are stripped. Class docstring becomes the function description and class name the function name. strict=True adds additionalProperties false. Tested offline on Windows 11, Python 3.12.10, langchain-core 1.8.0, langchain 1.5.0, langsmith 0.14.17, langchain-google-genai 4.5.0, google-genai 3.3.0, pydantic 2.14.3.