Skip to content

Commit

Permalink
style(internal): make enum value definitions less verbose (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored Dec 11, 2024
1 parent c2b2586 commit 48375c1
Show file tree
Hide file tree
Showing 52 changed files with 216 additions and 228 deletions.
18 changes: 9 additions & 9 deletions openai-java-core/src/main/kotlin/com/openai/models/Batch.kt
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ private constructor(

companion object {

@JvmField val BATCH = Object(JsonField.of("batch"))
@JvmField val BATCH = of("batch")

@JvmStatic fun of(value: String) = Object(JsonField.of(value))
}
Expand Down Expand Up @@ -531,21 +531,21 @@ private constructor(

companion object {

@JvmField val VALIDATING = Status(JsonField.of("validating"))
@JvmField val VALIDATING = of("validating")

@JvmField val FAILED = Status(JsonField.of("failed"))
@JvmField val FAILED = of("failed")

@JvmField val IN_PROGRESS = Status(JsonField.of("in_progress"))
@JvmField val IN_PROGRESS = of("in_progress")

@JvmField val FINALIZING = Status(JsonField.of("finalizing"))
@JvmField val FINALIZING = of("finalizing")

@JvmField val COMPLETED = Status(JsonField.of("completed"))
@JvmField val COMPLETED = of("completed")

@JvmField val EXPIRED = Status(JsonField.of("expired"))
@JvmField val EXPIRED = of("expired")

@JvmField val CANCELLING = Status(JsonField.of("cancelling"))
@JvmField val CANCELLING = of("cancelling")

@JvmField val CANCELLED = Status(JsonField.of("cancelled"))
@JvmField val CANCELLED = of("cancelled")

@JvmStatic fun of(value: String) = Status(JsonField.of(value))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ constructor(

companion object {

@JvmField val _24H = CompletionWindow(JsonField.of("24h"))
@JvmField val _24H = of("24h")

@JvmStatic fun of(value: String) = CompletionWindow(JsonField.of(value))
}
Expand Down Expand Up @@ -476,11 +476,11 @@ constructor(

companion object {

@JvmField val V1_CHAT_COMPLETIONS = Endpoint(JsonField.of("/v1/chat/completions"))
@JvmField val V1_CHAT_COMPLETIONS = of("/v1/chat/completions")

@JvmField val V1_EMBEDDINGS = Endpoint(JsonField.of("/v1/embeddings"))
@JvmField val V1_EMBEDDINGS = of("/v1/embeddings")

@JvmField val V1_COMPLETIONS = Endpoint(JsonField.of("/v1/completions"))
@JvmField val V1_COMPLETIONS = of("/v1/completions")

@JvmStatic fun of(value: String) = Endpoint(JsonField.of(value))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -444,15 +444,15 @@ private constructor(

companion object {

@JvmField val STOP = FinishReason(JsonField.of("stop"))
@JvmField val STOP = of("stop")

@JvmField val LENGTH = FinishReason(JsonField.of("length"))
@JvmField val LENGTH = of("length")

@JvmField val TOOL_CALLS = FinishReason(JsonField.of("tool_calls"))
@JvmField val TOOL_CALLS = of("tool_calls")

@JvmField val CONTENT_FILTER = FinishReason(JsonField.of("content_filter"))
@JvmField val CONTENT_FILTER = of("content_filter")

@JvmField val FUNCTION_CALL = FinishReason(JsonField.of("function_call"))
@JvmField val FUNCTION_CALL = of("function_call")

@JvmStatic fun of(value: String) = FinishReason(JsonField.of(value))
}
Expand Down Expand Up @@ -658,7 +658,7 @@ private constructor(

companion object {

@JvmField val CHAT_COMPLETION = Object(JsonField.of("chat.completion"))
@JvmField val CHAT_COMPLETION = of("chat.completion")

@JvmStatic fun of(value: String) = Object(JsonField.of(value))
}
Expand Down Expand Up @@ -709,9 +709,9 @@ private constructor(

companion object {

@JvmField val SCALE = ServiceTier(JsonField.of("scale"))
@JvmField val SCALE = of("scale")

@JvmField val DEFAULT = ServiceTier(JsonField.of("default"))
@JvmField val DEFAULT = of("default")

@JvmStatic fun of(value: String) = ServiceTier(JsonField.of(value))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ private constructor(

companion object {

@JvmField val ASSISTANT = Role(JsonField.of("assistant"))
@JvmField val ASSISTANT = of("assistant")

@JvmStatic fun of(value: String) = Role(JsonField.of(value))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,15 @@ private constructor(

companion object {

@JvmField val WAV = Format(JsonField.of("wav"))
@JvmField val WAV = of("wav")

@JvmField val MP3 = Format(JsonField.of("mp3"))
@JvmField val MP3 = of("mp3")

@JvmField val FLAC = Format(JsonField.of("flac"))
@JvmField val FLAC = of("flac")

@JvmField val OPUS = Format(JsonField.of("opus"))
@JvmField val OPUS = of("opus")

@JvmField val PCM16 = Format(JsonField.of("pcm16"))
@JvmField val PCM16 = of("pcm16")

@JvmStatic fun of(value: String) = Format(JsonField.of(value))
}
Expand Down Expand Up @@ -237,21 +237,21 @@ private constructor(

companion object {

@JvmField val ALLOY = Voice(JsonField.of("alloy"))
@JvmField val ALLOY = of("alloy")

@JvmField val ASH = Voice(JsonField.of("ash"))
@JvmField val ASH = of("ash")

@JvmField val BALLAD = Voice(JsonField.of("ballad"))
@JvmField val BALLAD = of("ballad")

@JvmField val CORAL = Voice(JsonField.of("coral"))
@JvmField val CORAL = of("coral")

@JvmField val ECHO = Voice(JsonField.of("echo"))
@JvmField val ECHO = of("echo")

@JvmField val SAGE = Voice(JsonField.of("sage"))
@JvmField val SAGE = of("sage")

@JvmField val SHIMMER = Voice(JsonField.of("shimmer"))
@JvmField val SHIMMER = of("shimmer")

@JvmField val VERSE = Voice(JsonField.of("verse"))
@JvmField val VERSE = of("verse")

@JvmStatic fun of(value: String) = Voice(JsonField.of(value))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -792,13 +792,13 @@ private constructor(

companion object {

@JvmField val SYSTEM = Role(JsonField.of("system"))
@JvmField val SYSTEM = of("system")

@JvmField val USER = Role(JsonField.of("user"))
@JvmField val USER = of("user")

@JvmField val ASSISTANT = Role(JsonField.of("assistant"))
@JvmField val ASSISTANT = of("assistant")

@JvmField val TOOL = Role(JsonField.of("tool"))
@JvmField val TOOL = of("tool")

@JvmStatic fun of(value: String) = Role(JsonField.of(value))
}
Expand Down Expand Up @@ -1123,7 +1123,7 @@ private constructor(

companion object {

@JvmField val FUNCTION = Type(JsonField.of("function"))
@JvmField val FUNCTION = of("function")

@JvmStatic fun of(value: String) = Type(JsonField.of(value))
}
Expand Down Expand Up @@ -1210,15 +1210,15 @@ private constructor(

companion object {

@JvmField val STOP = FinishReason(JsonField.of("stop"))
@JvmField val STOP = of("stop")

@JvmField val LENGTH = FinishReason(JsonField.of("length"))
@JvmField val LENGTH = of("length")

@JvmField val TOOL_CALLS = FinishReason(JsonField.of("tool_calls"))
@JvmField val TOOL_CALLS = of("tool_calls")

@JvmField val CONTENT_FILTER = FinishReason(JsonField.of("content_filter"))
@JvmField val CONTENT_FILTER = of("content_filter")

@JvmField val FUNCTION_CALL = FinishReason(JsonField.of("function_call"))
@JvmField val FUNCTION_CALL = of("function_call")

@JvmStatic fun of(value: String) = FinishReason(JsonField.of(value))
}
Expand Down Expand Up @@ -1424,7 +1424,7 @@ private constructor(

companion object {

@JvmField val CHAT_COMPLETION_CHUNK = Object(JsonField.of("chat.completion.chunk"))
@JvmField val CHAT_COMPLETION_CHUNK = of("chat.completion.chunk")

@JvmStatic fun of(value: String) = Object(JsonField.of(value))
}
Expand Down Expand Up @@ -1475,9 +1475,9 @@ private constructor(

companion object {

@JvmField val SCALE = ServiceTier(JsonField.of("scale"))
@JvmField val SCALE = of("scale")

@JvmField val DEFAULT = ServiceTier(JsonField.of("default"))
@JvmField val DEFAULT = of("default")

@JvmStatic fun of(value: String) = ServiceTier(JsonField.of(value))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,11 @@ private constructor(

companion object {

@JvmField val AUTO = Detail(JsonField.of("auto"))
@JvmField val AUTO = of("auto")

@JvmField val LOW = Detail(JsonField.of("low"))
@JvmField val LOW = of("low")

@JvmField val HIGH = Detail(JsonField.of("high"))
@JvmField val HIGH = of("high")

@JvmStatic fun of(value: String) = Detail(JsonField.of(value))
}
Expand Down Expand Up @@ -316,7 +316,7 @@ private constructor(

companion object {

@JvmField val IMAGE_URL = Type(JsonField.of("image_url"))
@JvmField val IMAGE_URL = of("image_url")

@JvmStatic fun of(value: String) = Type(JsonField.of(value))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,9 @@ private constructor(

companion object {

@JvmField val WAV = Format(JsonField.of("wav"))
@JvmField val WAV = of("wav")

@JvmField val MP3 = Format(JsonField.of("mp3"))
@JvmField val MP3 = of("mp3")

@JvmStatic fun of(value: String) = Format(JsonField.of(value))
}
Expand Down Expand Up @@ -299,7 +299,7 @@ private constructor(

companion object {

@JvmField val INPUT_AUDIO = Type(JsonField.of("input_audio"))
@JvmField val INPUT_AUDIO = of("input_audio")

@JvmStatic fun of(value: String) = Type(JsonField.of(value))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ private constructor(

companion object {

@JvmField val REFUSAL = Type(JsonField.of("refusal"))
@JvmField val REFUSAL = of("refusal")

@JvmStatic fun of(value: String) = Type(JsonField.of(value))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ private constructor(

companion object {

@JvmField val TEXT = Type(JsonField.of("text"))
@JvmField val TEXT = of("text")

@JvmStatic fun of(value: String) = Type(JsonField.of(value))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1733,9 +1733,9 @@ constructor(

companion object {

@JvmField val NONE = Behavior(JsonField.of("none"))
@JvmField val NONE = of("none")

@JvmField val AUTO = Behavior(JsonField.of("auto"))
@JvmField val AUTO = of("auto")

@JvmStatic fun of(value: String) = Behavior(JsonField.of(value))
}
Expand Down Expand Up @@ -2207,9 +2207,9 @@ constructor(

companion object {

@JvmField val AUTO = ServiceTier(JsonField.of("auto"))
@JvmField val AUTO = of("auto")

@JvmField val DEFAULT = ServiceTier(JsonField.of("default"))
@JvmField val DEFAULT = of("default")

@JvmStatic fun of(value: String) = ServiceTier(JsonField.of(value))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ private constructor(

companion object {

@JvmField val FUNCTION = Role(JsonField.of("function"))
@JvmField val FUNCTION = of("function")

@JvmStatic fun of(value: String) = Role(JsonField.of(value))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ private constructor(

companion object {

@JvmField val ASSISTANT = Role(JsonField.of("assistant"))
@JvmField val ASSISTANT = of("assistant")

@JvmStatic fun of(value: String) = Role(JsonField.of(value))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ private constructor(

companion object {

@JvmField val FUNCTION = Type(JsonField.of("function"))
@JvmField val FUNCTION = of("function")

@JvmStatic fun of(value: String) = Type(JsonField.of(value))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ private constructor(

companion object {

@JvmField val TEXT = ChatCompletionModality(JsonField.of("text"))
@JvmField val TEXT = of("text")

@JvmField val AUDIO = ChatCompletionModality(JsonField.of("audio"))
@JvmField val AUDIO = of("audio")

@JvmStatic fun of(value: String) = ChatCompletionModality(JsonField.of(value))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ private constructor(

companion object {

@JvmField val FUNCTION = Type(JsonField.of("function"))
@JvmField val FUNCTION = of("function")

@JvmStatic fun of(value: String) = Type(JsonField.of(value))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ private constructor(

companion object {

@JvmField val CONTENT = Type(JsonField.of("content"))
@JvmField val CONTENT = of("content")

@JvmStatic fun of(value: String) = Type(JsonField.of(value))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ private constructor(

companion object {

@JvmField val SYSTEM = ChatCompletionRole(JsonField.of("system"))
@JvmField val SYSTEM = of("system")

@JvmField val USER = ChatCompletionRole(JsonField.of("user"))
@JvmField val USER = of("user")

@JvmField val ASSISTANT = ChatCompletionRole(JsonField.of("assistant"))
@JvmField val ASSISTANT = of("assistant")

@JvmField val TOOL = ChatCompletionRole(JsonField.of("tool"))
@JvmField val TOOL = of("tool")

@JvmField val FUNCTION = ChatCompletionRole(JsonField.of("function"))
@JvmField val FUNCTION = of("function")

@JvmStatic fun of(value: String) = ChatCompletionRole(JsonField.of(value))
}
Expand Down
Loading

0 comments on commit 48375c1

Please sign in to comment.