andreyhabla
08/08/2025, 5:46 AMclass TestPdfWrapper {
content pdf
}
My main problem, is that if I try to pass the content like the following statements
——
pdf_data = Pdf.from_base64(base64=amazing_user_pdf_file_on_base_64)
TestPdfWrapper(
content= pdf_data
)
—
I get a multiple validation errors by pydantic
File —— line 253, in __init__
validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
pydantic_core._pydantic_core.ValidationError: 2 validation errors for TestPdfWrapper
content.model-fields
Input should be a valid dictionary or instance of Model [type=model_type, input_value=BamlPdfPy(base64=JVBERi0x...ia_type=application/pdf), input_type=BamlPdfPy]
For further information visit https://errors.pydantic.dev/2.11/v/model_type
content.model-fields
Input should be a valid dictionary or instance of Model [type=model_type, input_value=BamlPdfPy(base64=JVBERi0x...ia_type=application/pdf), input_type=BamlPdfPy]
For further information visit https://errors.pydantic.dev/2.11/v/model_type
————
I already check the baml_cli type for the wrapper and seems to be right:
—
class TestPdfWrapper(BaseModel):
content: baml_py.Pdf
—
I also tested, by creating a baml function that directly ask for a pdf and not a type with a pdf inside:
—-
function TestPdfType(description: pdf) -> string{…}
—-
And it actually worked, but… for future purposes I will need to be able to handle the pdf type on the class
Am I doing something wrong? I there any other way to handle this type?Vaibhav (BAML 🐑)
08/08/2025, 6:30 AMVaibhav (BAML 🐑)
08/08/2025, 6:31 AMbaml_py.Pdf type for some reason. We had to do some work for the baml_py.Image types and i had thought we did that on the Pdf types as wellVaibhav (BAML 🐑)
08/08/2025, 6:31 AMVaibhav (BAML 🐑)
08/08/2025, 6:31 AMVaibhav (BAML 🐑)
08/08/2025, 6:32 AMandreyhabla
08/08/2025, 2:11 PMEgor
08/08/2025, 6:40 PMandreyhabla
08/08/2025, 6:41 PMaaronv (BAML)
08/14/2025, 7:00 PM