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

Support for pydantic classes in align statements #34

Closed
MartBakler opened this issue Nov 3, 2023 · 0 comments
Closed

Support for pydantic classes in align statements #34

MartBakler opened this issue Nov 3, 2023 · 0 comments

Comments

@MartBakler
Copy link
Collaborator

This currently errors out during parsing of aligns

class Location(BaseModel):
    """A representation of a US city and state"""

    city: str = Field(description="The city's proper name")
    state: str = Field(description="The state's two-letter abbreviation (e.g. NY)")


@Monkey.patch
def construct_object_1(input: str) -> Location:
    """
    Using the input, construct the output model in the type hint
    """

@Monkey.align
def align():
	assert construct_object_1("The Windy City") == Location(city="Chicago", state="IL")

Reason is it is saved as this into the align dataset
"{'args': ('The Windy City',), 'kwargs': {}, 'output': Location(city='Chicago', state='IL')}\r"

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

No branches or pull requests

1 participant