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

Update verbalizer error message to include the relevant template string #414

Merged
merged 6 commits into from
Mar 3, 2025

Conversation

mynhardtburger
Copy link
Contributor

Update the exception message to include the template field which is the cause for the error.

Signed-off-by: Mynhardt Burger <mynhardt@gmail.com>
)
return source_object[index_object]

if not hasattr(source_object, index_object):
error(
"<NLP97715112E>",
AttributeError(
"Requested template string is not a valid property of type"
"Requested template string '%s' is not a valid property of type",
index_object,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also we should check if this index_object is actually a string, otherwise might cause problem without explicit stringification

Copy link
Contributor Author

@mynhardtburger mynhardtburger Mar 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it is possible for the fstring to fail no matter the type of index_object, unless the __str__ dunder method was overwritten and that raises an exception.

By default str() is used to serialize the object. At worst the the output might be in repr() format.

mynhardtburger and others added 5 commits February 28, 2025 14:38
Co-authored-by: Gaurav Kumbhat <kumbhat.gaurav@gmail.com>
Signed-off-by: Mynhardt Burger <mynhardt@gmail.com>
Co-authored-by: Gaurav Kumbhat <kumbhat.gaurav@gmail.com>
Signed-off-by: Mynhardt Burger <mynhardt@gmail.com>
Signed-off-by: Mynhardt Burger <mynhardt@gmail.com>
Signed-off-by: Mynhardt Burger <mynhardt@gmail.com>
Signed-off-by: Mynhardt Burger <mynhardt@gmail.com>
Copy link
Collaborator

@gkumbhat gkumbhat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@gkumbhat gkumbhat merged commit 928fb84 into caikit:main Mar 3, 2025
5 checks passed
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

Successfully merging this pull request may close these issues.

None yet

2 participants