-
Notifications
You must be signed in to change notification settings - Fork 2
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 content filtering #33
Conversation
With formatting though the proposed API still looks verbose, WDY think? is this an issue: client.chatCompletion({
deploymentConfiguration: { deploymentId: 'id' },
llmConfig: {
model_name: 'gpt-35-turbo-16k',
model_params: { max_tokens: 50, temperature: 0.1 }
},
prompt: {
template: [{ role: 'user', content: 'Hello!' }],
messages_history: [{ role: 'system', content: 'Test system message' }]
},
filterConfig: {
input: {
AzureContentSafety: {
Hate: 0,
SelfHarm: 2
}
},
output: [
{
AzureContentSafety: {
Sexual: 4,
Violence: 6
}
},
{
SomeOtherFilterServiceProvider: {
Hate: 0,
SelfHarm: 2,
Sexual: 4,
Violence: 6
}
}
]
}
})
); |
Suggestion: filterConfig: {
input: { azureContentSafety: { Hate: 0, SelfHarm: 2 }},
output: {
azureContentSafety: { Sexual: 4, Violence: 6 },
someOtherFilterServiceProvider: { Hate: 0, SelfHarm: 2 }
}
} |
To be honest I am not happy with either of the options. If we simplify whatever is passed in the config, I think it is confusing if it is this close to the original, but still different. That opens potential for errors. I don't know whether this was already discussed before, but I would suggest one of the following options:
or
|
I would have the following:
This looks similar to what Marika mentioned. |
|
input.filterConfig?.input && | ||
input.filterConfig?.output && |
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 think this is an issue, because only setting one of the two, or even setting none is allowed. But the current code leave the filter config empty, if one of the two is not defined, right?
/** | ||
* Input configuration for filtering provider. | ||
*/ | ||
input?: FilterServiceProvider; |
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.
We could consider:
input?: FilterServiceProvider; | |
input?: FilterServiceProvider | [FilterServiceProvider]; |
That would also allow:
filterConfig: {
input: [] as FilterServiceProvider,
Not sure how to best implement this internally, but using if (Array.isArray(config.input))
was what copilot suggested me 😉
Only downside I can think of is that the type signature becomes a bit more complex.
@@ -0,0 +1,15 @@ | |||
/* |
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.
Is this really generated code? I am wondering why it is being added just now?
The latest state as per Junjie's recommendations are #58 |
Proposed Content filtering API:
Option 1: (Current approach)
This is based on the assumption that the orchestration service only respects the first configuration provided for a filter service provider.
Other options:
Option 2:
Option 3: