-
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
feat: Add descriptive constants for Azure content filter configuration - Option 1 #462
Conversation
* A descriptive type for AzureThreshold input. | ||
* @internal | ||
*/ | ||
export interface AzureContentSafetyThresholdType { |
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.
This is also another option:
export type AzureContentSafetyThresholdKeys =
| 'ALLOW_SAFE'
| 'ALLOW_SAFE_LOW'
| 'ALLOW_SAFE_LOW_MEDIUM'
| 'ALLOW_ALL';
export const AzureFilterThreshold: Record<
AzureContentSafetyThresholdKeys,
AzureThreshold
> = {
ALLOW_SAFE: 0,
ALLOW_SAFE_LOW: 2,
ALLOW_SAFE_LOW_MEDIUM: 4,
ALLOW_ALL: 6
};
But then autocomplete looks like this (It doesn't give the value hints, even if I add comments):
And I didn't find a convenient way to use enum
and map it to the values of AzureThreshold
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.
[q] Any reason why we are not using enum here and modify the type for, e.g., Hate
to that enum? Otherwise user would need to know this constant exist without autocompletion's help.
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.
Would modifying the type be a breaking change?
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.
I discussed with @ZhongpinWang, modifying the type doesn't seem to be a breaking change as in the end they would both resolve to be the same code in JS.
Closing this PR, in favour of #476, introducing an |
Closed in favour of #485 |
Context
Closes SAP/ai-sdk-js-backlog#181.
What this PR does and why it is needed
This PR adds self descriptive constansts for improving Azure content filter configuration.
Autocompletion works with the string key values of
AzureFilterThreshold
and the numeric allowed values 0,2,4 and 6 coming up in hints.