Skip to content
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

release: 0.4.0 #70

Open
wants to merge 37 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
5e52131
feat(api): api update (#50)
Nov 6, 2024
c8a8e0e
feat(api): api update (#52)
stainless-app[bot] Oct 22, 2024
b3c1bb2
feat(api): api update (#53)
stainless-app[bot] Oct 23, 2024
9a85a86
feat(api): api update (#54)
stainless-app[bot] Oct 23, 2024
1aff44c
chore: rebuild project due to codegen change (#55)
stainless-app[bot] Oct 25, 2024
e16106b
chore: rebuild project due to codegen change (#56)
stainless-app[bot] Oct 25, 2024
3a5fc1c
chore: rebuild project due to codegen change (#57)
stainless-app[bot] Oct 25, 2024
a98c90c
chore(api): manual updates (#58)
stainless-app[bot] Oct 28, 2024
fe5e454
chore: rebuild project due to codegen change (#59)
stainless-app[bot] Oct 28, 2024
619fdf9
chore: rebuild project due to codegen change (#60)
stainless-app[bot] Oct 30, 2024
34224b4
chore: rebuild project due to codegen change (#61)
stainless-app[bot] Oct 30, 2024
8d3804c
chore: rebuild project due to codegen change (#62)
stainless-app[bot] Oct 30, 2024
e941f87
chore: rebuild project due to codegen change (#63)
stainless-app[bot] Oct 30, 2024
5b393df
chore: rebuild project due to codegen change (#64)
stainless-app[bot] Nov 1, 2024
c86f18b
chore: rebuild project due to codegen change (#65)
stainless-app[bot] Nov 1, 2024
ffdfb6b
chore: rebuild project due to codegen change (#66)
stainless-app[bot] Nov 1, 2024
ba8f527
chore: rebuild project due to codegen change (#67)
stainless-app[bot] Nov 4, 2024
d852b92
chore: rebuild project due to codegen change (#68)
stainless-app[bot] Nov 5, 2024
7a303e4
chore: rebuild project due to codegen change (#69)
stainless-app[bot] Nov 5, 2024
f7b50d0
chore: rebuild project due to codegen change (#71)
Nov 7, 2024
d08c8b7
chore: rebuild project due to codegen change (#73)
stainless-app[bot] Nov 7, 2024
2ac019c
chore: rebuild project due to codegen change (#74)
stainless-app[bot] Nov 12, 2024
8f7b570
feat(api): manual updates (#75)
Nov 20, 2024
8732e08
feat(api): manual updates (#77)
Nov 20, 2024
0e42094
codegen metadata
stainless-bot Nov 15, 2024
f067007
chore: rebuild project due to codegen change (#78)
stainless-app[bot] Nov 19, 2024
5b6c4e5
feat(api): manual updates (#79)
stainless-app[bot] Nov 19, 2024
ecaf2ae
feat(api): manual updates (#80)
stainless-app[bot] Nov 19, 2024
72e13e2
feat(api): manual updates (#81)
stainless-app[bot] Nov 19, 2024
b54f251
feat(api): manual updates (#82)
stainless-app[bot] Nov 20, 2024
456fe14
feat(api): manual updates (#83)
stainless-app[bot] Nov 20, 2024
7849b85
feat(api): manual updates (#84)
stainless-app[bot] Nov 20, 2024
95066db
chore(deps): bump jackson to 2.18.1 (#86)
stainless-app[bot] Nov 21, 2024
58407f3
chore(internal): codegen related update (#87)
stainless-app[bot] Nov 21, 2024
e2385b2
chore(internal): codegen related update (#88)
stainless-app[bot] Nov 23, 2024
7a1838c
chore(internal): codegen related update (#89)
Dec 2, 2024
5e077a2
release: 0.4.0
stainless-app[bot] Dec 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat(api): manual updates (#79)
  • Loading branch information
stainless-app[bot] authored and Stainless Bot committed Nov 20, 2024
commit 5b6c4e511b61d00cbf7ffbab6bdbd8848211b43a
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
// File generated from our OpenAPI spec by Stainless.

package com.braintrustdata.api.models

import com.braintrustdata.api.core.BaseDeserializer
import com.braintrustdata.api.core.BaseSerializer
import com.braintrustdata.api.core.JsonValue
import com.braintrustdata.api.core.getOrThrow
import com.braintrustdata.api.errors.BraintrustInvalidDataException
import com.fasterxml.jackson.core.JsonGenerator
import com.fasterxml.jackson.core.ObjectCodec
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.SerializerProvider
import com.fasterxml.jackson.databind.annotation.JsonDeserialize
import com.fasterxml.jackson.databind.annotation.JsonSerialize
import com.fasterxml.jackson.module.kotlin.jacksonTypeRef
import java.util.Objects

@JsonDeserialize(using = ChatCompletionContent.Deserializer::class)
@JsonSerialize(using = ChatCompletionContent.Serializer::class)
class ChatCompletionContent
private constructor(
private val text: String? = null,
private val array: List<ChatCompletionContentPart>? = null,
private val _json: JsonValue? = null,
) {

private var validated: Boolean = false

fun text(): String? = text

fun array(): List<ChatCompletionContentPart>? = array

fun isText(): Boolean = text != null

fun isArray(): Boolean = array != null

fun asText(): String = text.getOrThrow("text")

fun asArray(): List<ChatCompletionContentPart> = array.getOrThrow("array")

fun _json(): JsonValue? = _json

fun <T> accept(visitor: Visitor<T>): T {
return when {
text != null -> visitor.visitText(text)
array != null -> visitor.visitArray(array)
else -> visitor.unknown(_json)
}
}

fun validate(): ChatCompletionContent = apply {
if (!validated) {
if (text == null && array == null) {
throw BraintrustInvalidDataException("Unknown ChatCompletionContent: $_json")
}
validated = true
}
}

override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}

return /* spotless:off */ other is ChatCompletionContent && this.text == other.text && this.array == other.array /* spotless:on */
}

override fun hashCode(): Int {
return /* spotless:off */ Objects.hash(text, array) /* spotless:on */
}

override fun toString(): String {
return when {
text != null -> "ChatCompletionContent{text=$text}"
array != null -> "ChatCompletionContent{array=$array}"
_json != null -> "ChatCompletionContent{_unknown=$_json}"
else -> throw IllegalStateException("Invalid ChatCompletionContent")
}
}

companion object {

fun ofText(text: String) = ChatCompletionContent(text = text)

fun ofArray(array: List<ChatCompletionContentPart>) = ChatCompletionContent(array = array)
}

interface Visitor<out T> {

fun visitText(text: String): T

fun visitArray(array: List<ChatCompletionContentPart>): T

fun unknown(json: JsonValue?): T {
throw BraintrustInvalidDataException("Unknown ChatCompletionContent: $json")
}
}

class Deserializer : BaseDeserializer<ChatCompletionContent>(ChatCompletionContent::class) {

override fun ObjectCodec.deserialize(node: JsonNode): ChatCompletionContent {
val json = JsonValue.fromJsonNode(node)

tryDeserialize(node, jacksonTypeRef<String>())?.let {
return ChatCompletionContent(text = it, _json = json)
}
tryDeserialize(node, jacksonTypeRef<List<ChatCompletionContentPart>>())?.let {
return ChatCompletionContent(array = it, _json = json)
}

return ChatCompletionContent(_json = json)
}
}

class Serializer : BaseSerializer<ChatCompletionContent>(ChatCompletionContent::class) {

override fun serialize(
value: ChatCompletionContent,
generator: JsonGenerator,
provider: SerializerProvider
) {
when {
value.text != null -> generator.writeObject(value.text)
value.array != null -> generator.writeObject(value.array)
value._json != null -> generator.writeObject(value._json)
else -> throw IllegalStateException("Invalid ChatCompletionContent")
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
// File generated from our OpenAPI spec by Stainless.

package com.braintrustdata.api.models

import com.braintrustdata.api.core.BaseDeserializer
import com.braintrustdata.api.core.BaseSerializer
import com.braintrustdata.api.core.JsonValue
import com.braintrustdata.api.core.getOrThrow
import com.braintrustdata.api.errors.BraintrustInvalidDataException
import com.fasterxml.jackson.core.JsonGenerator
import com.fasterxml.jackson.core.ObjectCodec
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.SerializerProvider
import com.fasterxml.jackson.databind.annotation.JsonDeserialize
import com.fasterxml.jackson.databind.annotation.JsonSerialize
import com.fasterxml.jackson.module.kotlin.jacksonTypeRef
import java.util.Objects

@JsonDeserialize(using = ChatCompletionContentPart.Deserializer::class)
@JsonSerialize(using = ChatCompletionContentPart.Serializer::class)
class ChatCompletionContentPart
private constructor(
private val chatCompletionContentPartText: ChatCompletionContentPartText? = null,
private val chatCompletionContentPartImage: ChatCompletionContentPartImage? = null,
private val _json: JsonValue? = null,
) {

private var validated: Boolean = false

fun chatCompletionContentPartText(): ChatCompletionContentPartText? =
chatCompletionContentPartText

fun chatCompletionContentPartImage(): ChatCompletionContentPartImage? =
chatCompletionContentPartImage

fun isChatCompletionContentPartText(): Boolean = chatCompletionContentPartText != null

fun isChatCompletionContentPartImage(): Boolean = chatCompletionContentPartImage != null

fun asChatCompletionContentPartText(): ChatCompletionContentPartText =
chatCompletionContentPartText.getOrThrow("chatCompletionContentPartText")

fun asChatCompletionContentPartImage(): ChatCompletionContentPartImage =
chatCompletionContentPartImage.getOrThrow("chatCompletionContentPartImage")

fun _json(): JsonValue? = _json

fun <T> accept(visitor: Visitor<T>): T {
return when {
chatCompletionContentPartText != null ->
visitor.visitChatCompletionContentPartText(chatCompletionContentPartText)
chatCompletionContentPartImage != null ->
visitor.visitChatCompletionContentPartImage(chatCompletionContentPartImage)
else -> visitor.unknown(_json)
}
}

fun validate(): ChatCompletionContentPart = apply {
if (!validated) {
if (chatCompletionContentPartText == null && chatCompletionContentPartImage == null) {
throw BraintrustInvalidDataException("Unknown ChatCompletionContentPart: $_json")
}
chatCompletionContentPartText?.validate()
chatCompletionContentPartImage?.validate()
validated = true
}
}

override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}

return /* spotless:off */ other is ChatCompletionContentPart && this.chatCompletionContentPartText == other.chatCompletionContentPartText && this.chatCompletionContentPartImage == other.chatCompletionContentPartImage /* spotless:on */
}

override fun hashCode(): Int {
return /* spotless:off */ Objects.hash(chatCompletionContentPartText, chatCompletionContentPartImage) /* spotless:on */
}

override fun toString(): String {
return when {
chatCompletionContentPartText != null ->
"ChatCompletionContentPart{chatCompletionContentPartText=$chatCompletionContentPartText}"
chatCompletionContentPartImage != null ->
"ChatCompletionContentPart{chatCompletionContentPartImage=$chatCompletionContentPartImage}"
_json != null -> "ChatCompletionContentPart{_unknown=$_json}"
else -> throw IllegalStateException("Invalid ChatCompletionContentPart")
}
}

companion object {

fun ofChatCompletionContentPartText(
chatCompletionContentPartText: ChatCompletionContentPartText
) = ChatCompletionContentPart(chatCompletionContentPartText = chatCompletionContentPartText)

fun ofChatCompletionContentPartImage(
chatCompletionContentPartImage: ChatCompletionContentPartImage
) =
ChatCompletionContentPart(
chatCompletionContentPartImage = chatCompletionContentPartImage
)
}

interface Visitor<out T> {

fun visitChatCompletionContentPartText(
chatCompletionContentPartText: ChatCompletionContentPartText
): T

fun visitChatCompletionContentPartImage(
chatCompletionContentPartImage: ChatCompletionContentPartImage
): T

fun unknown(json: JsonValue?): T {
throw BraintrustInvalidDataException("Unknown ChatCompletionContentPart: $json")
}
}

class Deserializer :
BaseDeserializer<ChatCompletionContentPart>(ChatCompletionContentPart::class) {

override fun ObjectCodec.deserialize(node: JsonNode): ChatCompletionContentPart {
val json = JsonValue.fromJsonNode(node)

tryDeserialize(node, jacksonTypeRef<ChatCompletionContentPartText>()) { it.validate() }
?.let {
return ChatCompletionContentPart(
chatCompletionContentPartText = it,
_json = json
)
}
tryDeserialize(node, jacksonTypeRef<ChatCompletionContentPartImage>()) { it.validate() }
?.let {
return ChatCompletionContentPart(
chatCompletionContentPartImage = it,
_json = json
)
}

return ChatCompletionContentPart(_json = json)
}
}

class Serializer : BaseSerializer<ChatCompletionContentPart>(ChatCompletionContentPart::class) {

override fun serialize(
value: ChatCompletionContentPart,
generator: JsonGenerator,
provider: SerializerProvider
) {
when {
value.chatCompletionContentPartText != null ->
generator.writeObject(value.chatCompletionContentPartText)
value.chatCompletionContentPartImage != null ->
generator.writeObject(value.chatCompletionContentPartImage)
value._json != null -> generator.writeObject(value._json)
else -> throw IllegalStateException("Invalid ChatCompletionContentPart")
}
}
}
}
Loading