Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: pydantic schema parser now supports nested objects #911

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

inchoate
Copy link

fix: fixes pydantic parser to support nested objects.
fix: small update to docs

This fails before the PR and succeeds afterward:

from pydantic import BaseModel
from typing import List, Optional

from crewai.utilities.pydantic_schema_parser import PydanticSchemaParser


# Define test models
class InnerModel(BaseModel):
    inner_field: int


class TestModel(BaseModel):
    simple_field: str
    list_field: List[int]
    optional_field: Optional[str]
    nested_model: InnerModel


print(PydanticSchemaParser(model=InnerModel).get_schema())   # works
print(PydanticSchemaParser(model=TestModel).get_schema())    # fails

@e4stwood
Copy link

e4stwood commented Aug 4, 2024

Thanks for this. Struggling with this error atm. Hopefully this is merged.

@theCyberTech theCyberTech added documentation Improvements or additions to documentation improvement labels Aug 10, 2024
@joaomdmoura
Copy link
Collaborator

Nice! I see there are some conlicts, I'll try to fix it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants