-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fix: Ensure output_guardrail provides function name instead of defaulting to None #1003
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
base: main
Are you sure you want to change the base?
Fix: Ensure output_guardrail provides function name instead of defaulting to None #1003
Conversation
…efaulting to None
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.
actually hang on i dont get it - OutputGuardrail.get_name
already does this. Whats the issue this fixes?
@rm-openai Moreover, The thing you mentioned about OutputGuardrail.get_name() doing the same is true, but the issue is that get_name() is not used in the decorator. As a result, the name remains None until we explicitly define it, like @output_guardrail(name='guardrail_name'). |
That makes sense, but what's the underlying problem that causes? |
I was not getting the name of the guardrails in my result.input_guardrail_results |
Can you fix the lint error if you have time for it?
|
@seratch |
This PR improves the output_guardrail feature by ensuring that a valid function name is always provided. Previously, if the name attribute was missing, it defaulted to None. This change introduces a fallback name to avoid unexpected behavior or errors in downstream processes.