def _nested_model_instantiate(
    column_values: dict[str, Any], model: type["BaseModel"], prefix: str = ""
) -> "BaseModel":
    """Instantiate the given model and all sub-models/fields based on the provided
    column values."""
    vals_dict = {}
    for field, field_info in model.model_fields.items():
        anno = field_info.annotation
        cur_path = f"{prefix}.{field}" if prefix else field
        if ModelStore.is_pydantic(anno):
            vals_dict[field] = _nested_model_instantiate(
                column_values,
                anno,  # type: ignore[arg-type]
                prefix=cur_path,
            )
        elif cur_path in column_values:
            vals_dict[field] = column_values[cur_path]
    return model(**vals_dict)
Instantiate the given model and all sub-models/fields based on the provided
    column values.
src/datachain/lib/arrow.py