Skip to content

[bug] Include @description value in Pydantic type #2882

@Sidd065

Description

@Sidd065

Product

BAML

Describe the bug

Text written inside of @description is not included in the Pydantic type generated by baml. Therefore when using model_json_schema() the generated schema doesn't contain the description.

This is how types are currently generated:

class Resume(BaseModel):
    name: str
    email: str
    experience: typing.List[str]
    skills: typing.List[str]
Resume.model_json_schema()
# {"properties": {"name": {"title": "Name", "type": "string"}, "email": {"title": "Email", "type": "string"}, "experience": {"items": {"type": "string"}, "title": "Experience", "type": "array"}, "skills": {"items": {"type": "string"}, "title": "Skills", "type": "array"}}, "required": ["name", "email", "experience", "skills"], "title": "Resume", "type": "object"}

Reproduction Steps

Run baml-cli init, baml-cli generate and run

from baml_client.types import Resume
print(Resume.model_json_schema())

BAML Version

0.215.2

Language/Framework

Python

LLM Provider

None

LLM Model

No response

Operating System

None

Browser

None

Code Editor

None

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions