> This page is for SDKs, version Legacy.
> For other versions, use one of these documentation indexes:
> - Current (default): https://buildwithfern.com/learn/sdks/current/llms.txt
> - Legacy: https://buildwithfern.com/learn/sdks/legacy/llms.txt

> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://buildwithfern.com/learn/llms.txt.

## 5.0.6

**`(fix):`** Fix `construct_type` to resolve `ForwardRef` annotations in nested model fields
and use strict Literal discriminant matching for undiscriminated unions.

Under Pydantic v2 with `from __future__ import annotations`, field annotations
like `List["Block"]` remain as `list[ForwardRef('Block')]` even after
`model_rebuild`. `construct_type` now resolves these ForwardRefs via the host
model's module, ensuring nested data is recursively constructed into proper model
instances instead of staying as raw dicts.

Additionally, undiscriminated union resolution now requires Literal-typed
discriminant fields to be present AND matching before accepting a candidate type.
This prevents models with all-optional fields (e.g. `FigureDetails`) from greedily
matching inputs that belong to a different variant or to a plain-dict fallback.

## 5.0.5

**`(fix):`** Add enum handling to `construct_type()` to prevent Pydantic serialization warnings
when enum values pass through untyped model construction paths.