diff --git a/openai-client/src/commonMain/kotlin/com.aallam.openai.client/OpenAIConfig.kt b/openai-client/src/commonMain/kotlin/com.aallam.openai.client/OpenAIConfig.kt index a3e20d7b..28a02a2c 100644 --- a/openai-client/src/commonMain/kotlin/com.aallam.openai.client/OpenAIConfig.kt +++ b/openai-client/src/commonMain/kotlin/com.aallam.openai.client/OpenAIConfig.kt @@ -99,6 +99,11 @@ public class OpenAIHost( */ public val OpenAI: OpenAIHost = OpenAIHost(baseUrl = "https://api.openai.com/v1/") + /** + * A pre-configured instance of [OpenAIHost] for Google Gemini`. + */ + public val Gemini: OpenAIHost = OpenAIHost(baseUrl = "https://generativelanguage.googleapis.com/v1beta/openai/") + /** * Creates an instance of [OpenAIHost] configured for Azure hosting with the given resource name, deployment ID, * and API version. diff --git a/openai-core/src/commonMain/kotlin/com.aallam.openai.api/chat/ChatCompletion.kt b/openai-core/src/commonMain/kotlin/com.aallam.openai.api/chat/ChatCompletion.kt index eb0c94b8..5f8285ae 100644 --- a/openai-core/src/commonMain/kotlin/com.aallam.openai.api/chat/ChatCompletion.kt +++ b/openai-core/src/commonMain/kotlin/com.aallam.openai.api/chat/ChatCompletion.kt @@ -15,7 +15,7 @@ public data class ChatCompletion( /** * A unique id assigned to this completion */ - @SerialName("id") public val id: String, + @SerialName("id") public val idOrNull: String? = null, /** * The creation time in epoch milliseconds. */ @@ -43,4 +43,9 @@ public data class ChatCompletion( * might impact determinism. */ @SerialName("system_fingerprint") public val systemFingerprint: String? = null, -) + + @SerialName("citations") public val citations: List? = null, +) { + val id: String + get() = requireNotNull(idOrNull) +} diff --git a/openai-core/src/commonMain/kotlin/com.aallam.openai.api/chat/ChatCompletionChunk.kt b/openai-core/src/commonMain/kotlin/com.aallam.openai.api/chat/ChatCompletionChunk.kt index bdde1808..c4fe5364 100644 --- a/openai-core/src/commonMain/kotlin/com.aallam.openai.api/chat/ChatCompletionChunk.kt +++ b/openai-core/src/commonMain/kotlin/com.aallam.openai.api/chat/ChatCompletionChunk.kt @@ -16,7 +16,7 @@ public data class ChatCompletionChunk( * A unique id assigned to this completion */ @SerialName("id") - public val id: String, + public val id: String? = null, /** * The creation time in epoch milliseconds. @@ -48,4 +48,7 @@ public data class ChatCompletionChunk( */ @SerialName("system_fingerprint") public val systemFingerprint: String? = null, + + @SerialName("citations") + public val citations: List? = null, )