-
Notifications
You must be signed in to change notification settings - Fork 548
Fix: Handle unescaped quotes in generate_value using safe_eval #946
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: Handle unescaped quotes in generate_value using safe_eval #946
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @milk333445 for your contribution 👍🏻 Please make the minor changes requested then we are good to merge
48d8baf
to
f305ca9
Compare
The requested changes have been implemented as follows:
|
@milk333445 thanks a lot, it was fast 👍🏻 Just make sure that you sign your commits: you can do an interactive rebase and just sign them, then do a force push. |
556268d
to
cccc62f
Compare
I have signed all the commits, and they are now verified. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 👍🏻
Description
This PR improves the
generate_value
function inNeMo-Guardrails/nemoguardrails/actions/llm/generation.py
to handle strings with unescaped single and double quotes more robustly. The updated implementation ensures that:literal_eval
.Additionally, new test cases have been added
NeMo-Guardrails/tests/test_generate_value_safe_eval.py
to verify the correctness ofsafe_eval
across different scenarios, including:All existing and new tests were successfully executed locally using
pytest
to ensure the changes do not introduce any regressions.Related Issue(s)
Checklist