Skip to content

Update to work with Google Gemini #428

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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 @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 id: String? = null, // gemini doesn't provide back an id
/**
* The creation time in epoch milliseconds.
*/
Expand Down Expand Up @@ -43,4 +43,6 @@ public data class ChatCompletion(
* might impact determinism.
*/
@SerialName("system_fingerprint") public val systemFingerprint: String? = null,

@SerialName("citations") public val citations: List<String>? = null,
)
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -48,4 +48,7 @@ public data class ChatCompletionChunk(
*/
@SerialName("system_fingerprint")
public val systemFingerprint: String? = null,

@SerialName("citations")
public val citations: List<String>? = null,
)