You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The issue I'm facing is sometimes the model does not even output 'dogs': [] when the model thinks that there are no dogs in the prompt.
Quick Fix
I added
if not value:
return validation
In the List and Object classes in guardrails/datatypes.py to workaround this. However, I'm not sure if there are potential risks by doing so.
class List(NonScalarType):
"""Element tag: `<list>`"""
tag = "list"
def collect_validation(
self,
key: str,
value: Any,
schema: Dict,
) -> FieldValidation:
# Validators in the main list data type are applied to the list overall.
validation = self._constructor_validation(key, value)
if len(self._children) == 0:
return validation
if not value:
return validation
The text was updated successfully, but these errors were encountered:
For example:
When I ask the model to output People, currently Guard accepts this
But not this
The issue I'm facing is sometimes the model does not even output
'dogs': []
when the model thinks that there are no dogs in the prompt.Quick Fix
I added
In the
List
andObject
classes inguardrails/datatypes.py
to workaround this. However, I'm not sure if there are potential risks by doing so.The text was updated successfully, but these errors were encountered: