-
Notifications
You must be signed in to change notification settings - Fork 493
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
When making a guard from a pydantic model, if a Dict has type arguments on it, it transpiles into XML in a way that doesn't work.
Relevant Discord thread:
https://discord.com/channels/1085077079697150023/1149032565844475965/1149296871517470810
To Reproduce
from pydantic import BaseModel
from guardrails import Guard
class CorrectAnswers(BaseModel):
all_of: Dict[str, str] = {}
any_of_groups: List[Dict[str, str]] = []
not_all_of_groups: List[Dict[str, str]] = []
not_any_of: Dict[str, str] = {}
Guard.from_pydantic(CorrectAnswers)Expected behavior
XML guards don't support specifying types in objects with arbitrary elements, so it should probably just act like this:
class CorrectAnswers(BaseModel):
all_of: Dict = {}
any_of_groups: List[Dict] = []
not_all_of_groups: List[Dict] = []
not_any_of: Dict = {}Library version:
0.2.0
Additional context
This bug will probably be fixed when we migrate to XML-invariant internals.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working