-
Notifications
You must be signed in to change notification settings - Fork 10
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
refactor: Content filter helper function #441
base: main
Are you sure you want to change the base?
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.
Concept looks good and even allows for adding streaming options.
LGTM, after making the adjustments Deeksha has requested.
Proposed API looks good to me too, although I didn't like it that the user has to explicitly wrap the calls inside an array even for using a single filter. I feel typing An alternate I could think of was: filtering: {
input: ContentFilters.azure({ Hate: 4, SelfHarm: 0 }),
// or
input: ContentFilters.llamaGuard({ ... }),
// or
input: ContentFilters.addMultipleFilters(
ContentFilters.azure({ Hate: 4, SelfHarm: 0 }),
ContentFilters.llamaGuard({ ... })
)
} WDY think? |
I get your point. But as you mentioned, we then need some kind of |
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 for me.
Agreed that the 2 import behaviors should be documented
But, @deekshas8 also wrote this, can you check with her what needs to be documented here?
Personally for me though I would prefer if the user always uses it via the ContentFilters
for better discoverability of other functions too.
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.
Some behaviour changes have been made to buildAzureContentFilter
(The old convenience function). This has to be reverted as it's a breaking change.
Done now. |
Context
SAP/ai-sdk-js-backlog#202.
What this PR does and why it is needed
Deprecate
buildAzureContentFilter()
because it restricts filtering to have only one filter.Implement
ContentFilters.azure()
. New filters can be added toContentFilters
constant.