@@ -8,10 +8,7 @@ export class Safety extends APIResource {
88 /**
99 * Classifies if text and/or image inputs are potentially harmful.
1010 */
11- openaiModerations (
12- body : SafetyOpenAIModerationsParams ,
13- options ?: Core . RequestOptions ,
14- ) : Core . APIPromise < OpenAIModerationsResponse > {
11+ create ( body : SafetyCreateParams , options ?: Core . RequestOptions ) : Core . APIPromise < CreateResponse > {
1512 return this . _client . post ( '/v1/openai/v1/moderations' , { body, ...options } ) ;
1613 }
1714
@@ -26,7 +23,7 @@ export class Safety extends APIResource {
2623/**
2724 * A moderation object.
2825 */
29- export interface OpenAIModerationsResponse {
26+ export interface CreateResponse {
3027 /**
3128 * The unique identifier for the moderation request.
3229 */
@@ -40,40 +37,45 @@ export interface OpenAIModerationsResponse {
4037 /**
4138 * A list of moderation objects
4239 */
43- results : Array < OpenAIModerationsResponse . Result > ;
40+ results : Array < CreateResponse . Result > ;
4441}
4542
46- export namespace OpenAIModerationsResponse {
43+ export namespace CreateResponse {
4744 /**
4845 * A moderation object.
4946 */
5047 export interface Result {
5148 /**
52- * A list of the categories, and whether they are flagged or not .
49+ * Whether any of the below categories are flagged.
5350 */
54- categories : { [ key : string ] : boolean } ;
51+ flagged : boolean ;
5552
56- category_applied_input_types : { [ key : string ] : Array < string > } ;
53+ metadata : { [ key : string ] : boolean | number | string | Array < unknown > | unknown | null } ;
5754
58- category_messages : { [ key : string ] : string } ;
55+ /**
56+ * A list of the categories, and whether they are flagged or not.
57+ */
58+ categories ?: { [ key : string ] : boolean } ;
5959
6060 /**
61- * A list of the categories along with their scores as predicted by model .
61+ * A list of the categories along with the input type(s) that the score applies to .
6262 */
63- category_scores : { [ key : string ] : number } ;
63+ category_applied_input_types ? : { [ key : string ] : Array < string > } ;
6464
6565 /**
66- * Whether any of the below categories are flagged .
66+ * A list of the categories along with their scores as predicted by model .
6767 */
68- flagged : boolean ;
68+ category_scores ?: { [ key : string ] : number } ;
69+
70+ user_message ?: string ;
6971 }
7072}
7173
7274export interface RunShieldResponse {
7375 violation ?: Shared . SafetyViolation ;
7476}
7577
76- export interface SafetyOpenAIModerationsParams {
78+ export interface SafetyCreateParams {
7779 /**
7880 * Input (or inputs) to classify. Can be a single string, an array of strings, or
7981 * an array of multi-modal input objects similar to other models.
@@ -83,7 +85,7 @@ export interface SafetyOpenAIModerationsParams {
8385 /**
8486 * The content moderation model you would like to use.
8587 */
86- model ? : string ;
88+ model : string ;
8789}
8890
8991export interface SafetyRunShieldParams {
@@ -105,9 +107,9 @@ export interface SafetyRunShieldParams {
105107
106108export declare namespace Safety {
107109 export {
108- type OpenAIModerationsResponse as OpenAIModerationsResponse ,
110+ type CreateResponse as CreateResponse ,
109111 type RunShieldResponse as RunShieldResponse ,
110- type SafetyOpenAIModerationsParams as SafetyOpenAIModerationsParams ,
112+ type SafetyCreateParams as SafetyCreateParams ,
111113 type SafetyRunShieldParams as SafetyRunShieldParams ,
112114 } ;
113115}
0 commit comments