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

Add missing serial names on ImagesGenerationRequest #65

Merged
merged 4 commits into from
May 16, 2023
Merged
Changes from 2 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
@@ -8,7 +8,7 @@ import com.xebia.functional.xef.httpClient
import io.ktor.client.HttpClient
import io.ktor.client.call.body
import io.ktor.client.engine.HttpClientEngine
import io.ktor.client.plugins.*
import io.ktor.client.plugins.timeout
import io.ktor.client.request.post
import io.ktor.client.statement.HttpResponse
import io.ktor.http.path
@@ -25,8 +25,8 @@ interface OpenAIClient {
@Serializable
data class ImagesGenerationRequest(
val prompt: String,
val numberImages: Int = 1,
val imageSize: String = "1024x1024",
@SerialName("n") val numberImages: Int = 1,
@SerialName("size") val imageSize: String = "1024x1024",
realdavidvega marked this conversation as resolved.
Show resolved Hide resolved
@SerialName("response_format") val responseFormat: String = "url",
val user: String? = null
)
@@ -39,8 +39,7 @@ data class ImagesGenerationResponse(val created: Long, val data: List<ImageGener
suspend fun ResourceScope.KtorOpenAIClient(
config: OpenAIConfig,
engine: HttpClientEngine? = null
): OpenAIClient =
com.xebia.functional.xef.llm.openai.KtorOpenAIClient(httpClient(engine, config.baseUrl), config)
): OpenAIClient = KtorOpenAIClient(httpClient(engine, config.baseUrl), config)

private class KtorOpenAIClient(
private val httpClient: HttpClient,