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

- [feature] Added `modelVersion` property to `GenerateContentResponse` (#8227)

# 17.12.1

- [feature] Added the `retrievalConfig` argument to `TemplateToolConfig`. (#8107)
Expand Down
23 changes: 14 additions & 9 deletions ai-logic/firebase-ai/api.txt
Original file line number Diff line number Diff line change
Expand Up @@ -674,25 +674,30 @@ package com.google.firebase.ai.type {
}

public final class GenerateContentResponse {
ctor public GenerateContentResponse(java.util.List<com.google.firebase.ai.type.Candidate> candidates, com.google.firebase.ai.type.PromptFeedback? promptFeedback, com.google.firebase.ai.type.UsageMetadata? usageMetadata);
ctor public GenerateContentResponse(java.util.List<com.google.firebase.ai.type.Candidate> candidates, com.google.firebase.ai.type.PromptFeedback? promptFeedback, com.google.firebase.ai.type.UsageMetadata? usageMetadata, String? modelVersion);
method public java.util.List<com.google.firebase.ai.type.Candidate> getCandidates();
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 java.util.List<com.google.firebase.ai.type.TextPart>? getParts();
method public com.google.firebase.ai.type.PromptFeedback? getPromptFeedback();
method public String? getText();
method public String? getThoughtSummary();
method public com.google.firebase.ai.type.UsageMetadata? getUsageMetadata();
property public final java.util.List<com.google.firebase.ai.type.Candidate> candidates;
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 java.util.List<com.google.firebase.ai.type.TextPart>? parts;
property public final com.google.firebase.ai.type.PromptFeedback? promptFeedback;
property public final String? text;
property public final String? thoughtSummary;
property public final com.google.firebase.ai.type.UsageMetadata? usageMetadata;
}

public final class GenerateContentResponseKt {
method public static java.util.List<com.google.firebase.ai.type.FunctionCallPart> getFunctionCalls();
method public static java.util.List<com.google.firebase.ai.type.InlineDataPart> getInlineDataParts();
method public static String? getThoughtSummary();
property public static final java.util.List<com.google.firebase.ai.type.FunctionCallPart> functionCalls;
property public static final java.util.List<com.google.firebase.ai.type.InlineDataPart> inlineDataParts;
property public static final String? thoughtSummary;
}

public final class GenerateObjectResponse<T> {
method public T? getObject(int candidateIndex = 0);
method public com.google.firebase.ai.type.GenerateContentResponse getResponse();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ internal constructor(
public val inferenceSource: InferenceSource,
public val promptFeedback: PromptFeedback?,
public val usageMetadata: UsageMetadata?,
public val modelVersion: String?
) {

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

/**
* 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,
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