CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes48downloads
moderations.d.mts295 linesDownload Raw Back to resources
1import { APIResource } from "../core/resource.mjs";2import { APIPromise } from "../core/api-promise.mjs";3import { RequestOptions } from "../internal/request-options.mjs";4export declare class Moderations extends APIResource {5    /**6     * Classifies if text and/or image inputs are potentially harmful. Learn more in7     * the [moderation guide](https://platform.openai.com/docs/guides/moderation).8     */9    create(body: ModerationCreateParams, options?: RequestOptions): APIPromise<ModerationCreateResponse>;10}11export interface Moderation {12    /**13     * A list of the categories, and whether they are flagged or not.14     */15    categories: Moderation.Categories;16    /**17     * A list of the categories along with the input type(s) that the score applies to.18     */19    category_applied_input_types: Moderation.CategoryAppliedInputTypes;20    /**21     * A list of the categories along with their scores as predicted by model.22     */23    category_scores: Moderation.CategoryScores;24    /**25     * Whether any of the below categories are flagged.26     */27    flagged: boolean;28}29export declare namespace Moderation {30    /**31     * A list of the categories, and whether they are flagged or not.32     */33    interface Categories {34        /**35         * Content that expresses, incites, or promotes harassing language towards any36         * target.37         */38        harassment: boolean;39        /**40         * Harassment content that also includes violence or serious harm towards any41         * target.42         */43        'harassment/threatening': boolean;44        /**45         * Content that expresses, incites, or promotes hate based on race, gender,46         * ethnicity, religion, nationality, sexual orientation, disability status, or47         * caste. Hateful content aimed at non-protected groups (e.g., chess players) is48         * harassment.49         */50        hate: boolean;51        /**52         * Hateful content that also includes violence or serious harm towards the targeted53         * group based on race, gender, ethnicity, religion, nationality, sexual54         * orientation, disability status, or caste.55         */56        'hate/threatening': boolean;57        /**58         * Content that includes instructions or advice that facilitate the planning or59         * execution of wrongdoing, or that gives advice or instruction on how to commit60         * illicit acts. For example, "how to shoplift" would fit this category.61         */62        illicit: boolean | null;63        /**64         * Content that includes instructions or advice that facilitate the planning or65         * execution of wrongdoing that also includes violence, or that gives advice or66         * instruction on the procurement of any weapon.67         */68        'illicit/violent': boolean | null;69        /**70         * Content that promotes, encourages, or depicts acts of self-harm, such as71         * suicide, cutting, and eating disorders.72         */73        'self-harm': boolean;74        /**75         * Content that encourages performing acts of self-harm, such as suicide, cutting,76         * and eating disorders, or that gives instructions or advice on how to commit such77         * acts.78         */79        'self-harm/instructions': boolean;80        /**81         * Content where the speaker expresses that they are engaging or intend to engage82         * in acts of self-harm, such as suicide, cutting, and eating disorders.83         */84        'self-harm/intent': boolean;85        /**86         * Content meant to arouse sexual excitement, such as the description of sexual87         * activity, or that promotes sexual services (excluding sex education and88         * wellness).89         */90        sexual: boolean;91        /**92         * Sexual content that includes an individual who is under 18 years old.93         */94        'sexual/minors': boolean;95        /**96         * Content that depicts death, violence, or physical injury.97         */98        violence: boolean;99        /**100         * Content that depicts death, violence, or physical injury in graphic detail.101         */102        'violence/graphic': boolean;103    }104    /**105     * A list of the categories along with the input type(s) that the score applies to.106     */107    interface CategoryAppliedInputTypes {108        /**109         * The applied input type(s) for the category 'harassment'.110         */111        harassment: Array<'text'>;112        /**113         * The applied input type(s) for the category 'harassment/threatening'.114         */115        'harassment/threatening': Array<'text'>;116        /**117         * The applied input type(s) for the category 'hate'.118         */119        hate: Array<'text'>;120        /**121         * The applied input type(s) for the category 'hate/threatening'.122         */123        'hate/threatening': Array<'text'>;124        /**125         * The applied input type(s) for the category 'illicit'.126         */127        illicit: Array<'text'>;128        /**129         * The applied input type(s) for the category 'illicit/violent'.130         */131        'illicit/violent': Array<'text'>;132        /**133         * The applied input type(s) for the category 'self-harm'.134         */135        'self-harm': Array<'text' | 'image'>;136        /**137         * The applied input type(s) for the category 'self-harm/instructions'.138         */139        'self-harm/instructions': Array<'text' | 'image'>;140        /**141         * The applied input type(s) for the category 'self-harm/intent'.142         */143        'self-harm/intent': Array<'text' | 'image'>;144        /**145         * The applied input type(s) for the category 'sexual'.146         */147        sexual: Array<'text' | 'image'>;148        /**149         * The applied input type(s) for the category 'sexual/minors'.150         */151        'sexual/minors': Array<'text'>;152        /**153         * The applied input type(s) for the category 'violence'.154         */155        violence: Array<'text' | 'image'>;156        /**157         * The applied input type(s) for the category 'violence/graphic'.158         */159        'violence/graphic': Array<'text' | 'image'>;160    }161    /**162     * A list of the categories along with their scores as predicted by model.163     */164    interface CategoryScores {165        /**166         * The score for the category 'harassment'.167         */168        harassment: number;169        /**170         * The score for the category 'harassment/threatening'.171         */172        'harassment/threatening': number;173        /**174         * The score for the category 'hate'.175         */176        hate: number;177        /**178         * The score for the category 'hate/threatening'.179         */180        'hate/threatening': number;181        /**182         * The score for the category 'illicit'.183         */184        illicit: number;185        /**186         * The score for the category 'illicit/violent'.187         */188        'illicit/violent': number;189        /**190         * The score for the category 'self-harm'.191         */192        'self-harm': number;193        /**194         * The score for the category 'self-harm/instructions'.195         */196        'self-harm/instructions': number;197        /**198         * The score for the category 'self-harm/intent'.199         */200        'self-harm/intent': number;201        /**202         * The score for the category 'sexual'.203         */204        sexual: number;205        /**206         * The score for the category 'sexual/minors'.207         */208        'sexual/minors': number;209        /**210         * The score for the category 'violence'.211         */212        violence: number;213        /**214         * The score for the category 'violence/graphic'.215         */216        'violence/graphic': number;217    }218}219/**220 * An object describing an image to classify.221 */222export interface ModerationImageURLInput {223    /**224     * Contains either an image URL or a data URL for a base64 encoded image.225     */226    image_url: ModerationImageURLInput.ImageURL;227    /**228     * Always `image_url`.229     */230    type: 'image_url';231}232export declare namespace ModerationImageURLInput {233    /**234     * Contains either an image URL or a data URL for a base64 encoded image.235     */236    interface ImageURL {237        /**238         * Either a URL of the image or the base64 encoded image data.239         */240        url: string;241    }242}243export type ModerationModel = 'omni-moderation-latest' | 'omni-moderation-2024-09-26' | 'text-moderation-latest' | 'text-moderation-stable';244/**245 * An object describing an image to classify.246 */247export type ModerationMultiModalInput = ModerationImageURLInput | ModerationTextInput;248/**249 * An object describing text to classify.250 */251export interface ModerationTextInput {252    /**253     * A string of text to classify.254     */255    text: string;256    /**257     * Always `text`.258     */259    type: 'text';260}261/**262 * Represents if a given text input is potentially harmful.263 */264export interface ModerationCreateResponse {265    /**266     * The unique identifier for the moderation request.267     */268    id: string;269    /**270     * The model used to generate the moderation results.271     */272    model: string;273    /**274     * A list of moderation objects.275     */276    results: Array<Moderation>;277}278export interface ModerationCreateParams {279    /**280     * Input (or inputs) to classify. Can be a single string, an array of strings, or281     * an array of multi-modal input objects similar to other models.282     */283    input: string | Array<string> | Array<ModerationMultiModalInput>;284    /**285     * The content moderation model you would like to use. Learn more in286     * [the moderation guide](https://platform.openai.com/docs/guides/moderation), and287     * learn about available models288     * [here](https://platform.openai.com/docs/models#moderation).289     */290    model?: (string & {}) | ModerationModel;291}292export declare namespace Moderations {293    export { type Moderation as Moderation, type ModerationImageURLInput as ModerationImageURLInput, type ModerationModel as ModerationModel, type ModerationMultiModalInput as ModerationMultiModalInput, type ModerationTextInput as ModerationTextInput, type ModerationCreateResponse as ModerationCreateResponse, type ModerationCreateParams as ModerationCreateParams, };294}295//# sourceMappingURL=moderations.d.mts.map
basant307/AI_Governance_Project · CoolFace