File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
firebase-ai/src/main/kotlin/com/google/firebase/ai/type Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -32,16 +32,21 @@ public class GenerateContentResponse(
32
32
public val usageMetadata : UsageMetadata ? ,
33
33
) {
34
34
/* *
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].
37
38
*/
38
39
public val text: String? by lazy {
39
40
candidates.firstOrNull()?.content?.parts?.filterIsInstance<TextPart >()?.joinToString(" " ) {
40
41
it.text
41
42
}
42
43
}
43
44
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
+ */
45
50
public val functionCalls: List <FunctionCallPart > by lazy {
46
51
candidates.firstOrNull()?.content?.parts?.filterIsInstance<FunctionCallPart >().orEmpty()
47
52
}
@@ -50,6 +55,8 @@ public class GenerateContentResponse(
50
55
* Convenience field representing all the [InlineDataPart]s in the first candidate, if they exist.
51
56
*
52
57
* 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].
53
60
*/
54
61
public val inlineDataParts: List <InlineDataPart > by lazy {
55
62
candidates
You can’t perform that action at this time.
0 commit comments