Skip to content
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
1 change: 1 addition & 0 deletions ai-logic/firebase-ai/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Unreleased

- [feature] Added `modelVersion` property to `GenerateContentResponse` (#8227)
- [feature] Added the `retrievalConfig` argument to `TemplateToolConfig` (#8107)
- [fixed] Fixed citation indices to be native UTF-16 instead of UTF-8. (#8056)

Expand Down
2 changes: 2 additions & 0 deletions ai-logic/firebase-ai/api.txt
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,7 @@ package com.google.firebase.ai.type {
method public java.util.List<com.google.firebase.ai.type.FunctionCallPart> getFunctionCalls();
method public com.google.firebase.ai.InferenceSource getInferenceSource();
method public java.util.List<com.google.firebase.ai.type.InlineDataPart> getInlineDataParts();
method public String? getModelVersion();
method public com.google.firebase.ai.type.PromptFeedback? getPromptFeedback();
method public String? getText();
method public String? getThoughtSummary();
Expand All @@ -687,6 +688,7 @@ package com.google.firebase.ai.type {
property public final java.util.List<com.google.firebase.ai.type.FunctionCallPart> functionCalls;
property public final com.google.firebase.ai.InferenceSource inferenceSource;
property public final java.util.List<com.google.firebase.ai.type.InlineDataPart> inlineDataParts;
property public final String? modelVersion;
property public final com.google.firebase.ai.type.PromptFeedback? promptFeedback;
property public final String? text;
property public final String? thoughtSummary;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.google.firebase.ai.type

import com.google.firebase.ai.InferenceSource
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

/**
Expand All @@ -35,6 +36,7 @@ internal constructor(
public val inferenceSource: InferenceSource,
public val promptFeedback: PromptFeedback?,
public val usageMetadata: UsageMetadata?,
public val modelVersion: String? = null,
) {

// To maintain backwards compatibility with possible outside usage, we maintain a public
Expand All @@ -47,7 +49,7 @@ internal constructor(
candidates: List<Candidate>,
promptFeedback: PromptFeedback?,
usageMetadata: UsageMetadata?,
) : this(candidates, InferenceSource.IN_CLOUD, promptFeedback, usageMetadata)
) : this(candidates, InferenceSource.IN_CLOUD, promptFeedback, usageMetadata, null)

/**
* Convenience field representing all the text parts in the response as a single string.
Expand Down Expand Up @@ -118,13 +120,15 @@ internal constructor(
val candidates: List<Candidate.Internal>? = null,
val promptFeedback: PromptFeedback.Internal? = null,
val usageMetadata: UsageMetadata.Internal? = null,
@SerialName("model_version") val modelVersion: String? = null,
) : Response {
internal fun toPublic(): GenerateContentResponse {
return GenerateContentResponse(
candidates?.map { it.toPublic() }.orEmpty(),
InferenceSource.IN_CLOUD,
promptFeedback?.toPublic(),
usageMetadata?.toPublic()
usageMetadata?.toPublic(),
modelVersion
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ internal class SerializationTests {
},
"usageMetadata": {
"${'$'}ref": "UsageMetadata"
},
"model_version": {
"type": "string"
}
}
}
Expand Down
Loading