Skip to content

Commit

Permalink
change enum to a value class with companion object values
Browse files Browse the repository at this point in the history
  • Loading branch information
gh-abhay committed Feb 14, 2024
1 parent 4356af7 commit fe3b800
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,16 @@ public data class ChatCompletionChunk(
public val usage: Usage? = null,

/**
* Content filtering results for zero or more prompts in the request. In a streaming request,
* results for different prompts may arrive at different times or in different orders.
*/
@SerialName("prompt_filter_results")
val promptFilterResults: List<ContentFilterResultsForPrompt>? = null
* This fingerprint represents the backend configuration that the model runs with. Can be used in conjunction with
* the `seed` request parameter to understand when backend changes have been made that might impact determinism.
*/

@SerialName("system_fingerprint")
public val systemFingerprint: String? = null,

/**
* Content filtering results for zero or more prompts in the request. In a streaming request,
* results for different prompts may arrive at different times or in different orders.
*/
@SerialName("prompt_filter_results")
val promptFilterResults: List<ContentFilterResultsForPrompt>? = null,
)
Original file line number Diff line number Diff line change
@@ -1,44 +1,41 @@
package com.aallam.openai.azure.api.filtering

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

/**
* Ratings for the intensity and risk level of harmful content.
*/
@Serializable
public enum class ContentFilterSeverity(@Serializable public val value: String) {
@JvmInline
public value class ContentFilterSeverity(public val value: String) {
public companion object {
/**
* Content may be related to violence, self-harm, sexual, or hate categories but the terms
* are used in general, journalistic, scientific, medical, and similar professional contexts,
* which are appropriate for most audiences.
*/
public val SAFE: ContentFilterSeverity = ContentFilterSeverity("safe")

/**
* Content may be related to violence, self-harm, sexual, or hate categories but the terms
* are used in general, journalistic, scientific, medical, and similar professional contexts,
* which are appropriate for most audiences.
*/
@SerialName("safe")
SAFE("safe"),
/**
* Content that expresses prejudiced, judgmental, or opinionated views, includes offensive
* use of language, stereotyping, use cases exploring a fictional world (for example, gaming,
* literature) and depictions at low intensity.
*/
public val LOW: ContentFilterSeverity = ContentFilterSeverity("low")

/**
* Content that expresses prejudiced, judgmental, or opinionated views, includes offensive
* use of language, stereotyping, use cases exploring a fictional world (for example, gaming,
* literature) and depictions at low intensity.
*/
@SerialName("low")
LOW("low"),
/**
* Content that uses offensive, insulting, mocking, intimidating, or demeaning language
* towards specific identity groups, includes depictions of seeking and executing harmful
* instructions, fantasies, glorification, promotion of harm at medium intensity.
*/
public val MEDIUM: ContentFilterSeverity = ContentFilterSeverity("medium")

/**
* Content that uses offensive, insulting, mocking, intimidating, or demeaning language
* towards specific identity groups, includes depictions of seeking and executing harmful
* instructions, fantasies, glorification, promotion of harm at medium intensity.
*/
@SerialName("medium")
MEDIUM("medium"),

/**
* Content that displays explicit and severe harmful instructions, actions,
* damage, or abuse; includes endorsement, glorification, or promotion of severe
* harmful acts, extreme or illegal forms of harm, radicalization, or non-consensual
* power exchange or abuse.
*/
@SerialName("high")
HIGH("high")
}
/**
* Content that displays explicit and severe harmful instructions, actions,
* damage, or abuse; includes endorsement, glorification, or promotion of severe
* harmful acts, extreme or illegal forms of harm, radicalization, or non-consensual
* power exchange or abuse.
*/
public val HIGH: ContentFilterSeverity = ContentFilterSeverity("high")
}
}

0 comments on commit fe3b800

Please sign in to comment.