All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonTest.com.aallam.openai.client.TestModerations.kt Maven / Gradle / Ivy

There is a newer version: 4.0.0-beta01
Show newest version
package com.aallam.openai.client

import com.aallam.openai.api.moderation.ModerationRequest
import kotlinx.coroutines.test.runTest
import kotlin.test.Test
import kotlin.test.assertTrue

class TestModerations : TestOpenAI() {

    @Test
    fun moderations() = runTest {
        val response = openAI.moderations(
            request = ModerationRequest(
                input = "I want to kill them."
            )
        )

        val result = response.results.first()
        assertTrue(result.flagged)
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy