Skip to content

Add missing experimentalApi annotations to vertex tests #6541

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

Merged
merged 3 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import io.kotest.matchers.types.shouldBeInstanceOf
import io.ktor.http.HttpStatusCode
import kotlin.time.Duration.Companion.seconds
import kotlinx.coroutines.withTimeout
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.Serializable
import kotlinx.serialization.json.JsonPrimitive
import org.junit.Test
Expand All @@ -44,6 +45,7 @@ import org.junit.Test
internal class UnarySnapshotTests {
private val testTimeout = 5.seconds

@OptIn(ExperimentalSerializationApi::class)
@Test
fun `short reply`() =
goldenUnaryFile("success-basic-reply-short.json") {
Expand All @@ -57,6 +59,7 @@ internal class UnarySnapshotTests {
}
}

@OptIn(ExperimentalSerializationApi::class)
@Test
fun `long reply`() =
goldenUnaryFile("success-basic-reply-long.json") {
Expand Down Expand Up @@ -219,6 +222,7 @@ internal class UnarySnapshotTests {
}
}

@OptIn(ExperimentalSerializationApi::class)
@Test
fun `properly translates json text`() =
goldenUnaryFile("success-constraint-decoding-json.json") {
Expand Down Expand Up @@ -305,6 +309,7 @@ internal class UnarySnapshotTests {
}
}

@OptIn(ExperimentalSerializationApi::class)
@Test
fun `function call contains null param`() =
goldenUnaryFile("success-function-call-null.json") {
Expand All @@ -317,6 +322,7 @@ internal class UnarySnapshotTests {
}
}

@OptIn(ExperimentalSerializationApi::class)
@Test
fun `function call contains json literal`() =
goldenUnaryFile("success-function-call-json-literal.json") {
Expand All @@ -335,6 +341,7 @@ internal class UnarySnapshotTests {
}
}

@OptIn(ExperimentalSerializationApi::class)
@Test
fun `function call has no arguments field`() =
goldenUnaryFile("success-function-call-empty-arguments.json") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import io.ktor.utils.io.close
import io.ktor.utils.io.writeFully
import java.io.File
import kotlinx.coroutines.launch
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.encodeToString

private val TEST_CLIENT_ID = "genai-android/test"
Expand All @@ -48,6 +49,7 @@ internal fun prepareStreamingResponse(response: List<GenerateContentResponse>):
internal fun prepareResponse(response: GenerateContentResponse) =
JSON.encodeToString(response).toByteArray()

@OptIn(ExperimentalSerializationApi::class)
internal fun createRequest(vararg text: String): GenerateContentRequest {
val contents = text.map { Content(parts = listOf(TextPart(it))) }

Expand All @@ -56,6 +58,7 @@ internal fun createRequest(vararg text: String): GenerateContentRequest {

internal fun createResponse(text: String) = createResponses(text).single()

@OptIn(ExperimentalSerializationApi::class)
internal fun createResponses(vararg text: String): List<GenerateContentResponse> {
val candidates = text.map { Candidate(Content(parts = listOf(TextPart(it)))) }

Expand Down
Loading