Skip to content

Commit f97e1eb

Browse files
committed
Improve documentation
1 parent b1ff6c0 commit f97e1eb

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

firebase-ai/src/main/kotlin/com/google/firebase/ai/type/GenerateContentResponse.kt

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,21 @@ public class GenerateContentResponse(
3232
public val usageMetadata: UsageMetadata?,
3333
) {
3434
/**
35-
* Convenience field representing all the text parts in the response as a single string, if they
36-
* exists.
35+
* Convenience field representing all the text parts in the response as a single string.
36+
*
37+
* The value is null if the response contains no [candidates].
3738
*/
3839
public val text: String? by lazy {
3940
candidates.firstOrNull()?.content?.parts?.filterIsInstance<TextPart>()?.joinToString(" ") {
4041
it.text
4142
}
4243
}
4344

44-
/** Convenience field to list all the [FunctionCallPart]s in the response, if they exist. */
45+
/**
46+
* Convenience field to list all the [FunctionCallPart]s in the response.
47+
*
48+
* The value is an empty list if the response contains no [candidates].
49+
*/
4550
public val functionCalls: List<FunctionCallPart> by lazy {
4651
candidates.firstOrNull()?.content?.parts?.filterIsInstance<FunctionCallPart>().orEmpty()
4752
}
@@ -50,6 +55,8 @@ public class GenerateContentResponse(
5055
* Convenience field representing all the [InlineDataPart]s in the first candidate, if they exist.
5156
*
5257
* This also includes any [ImagePart], but they will be represented as [InlineDataPart] instead.
58+
*
59+
* The value is an empty list if the response contains no [candidates].
5360
*/
5461
public val inlineDataParts: List<InlineDataPart> by lazy {
5562
candidates

0 commit comments

Comments
 (0)