Skip to content

Commit 38e7e86

Browse files
committed
update code execution part
1 parent 6868ce5 commit 38e7e86

File tree

1 file changed

+21
-2
lines changed
  • firebase-ai/src/main/kotlin/com/google/firebase/ai/type

1 file changed

+21
-2
lines changed

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

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,21 @@ public class TextPart(public val text: String) : Part {
3939
@Serializable internal data class Internal(val text: String) : InternalPart
4040
}
4141

42-
public class CodeExecutionResultPart(public val outcome: String, public val output: String) : Part {
42+
/* Represents the result of the code execution */
43+
public enum class Outcome {
44+
OUTCOME_UNSPECIFIED,
45+
OUTCOME_OK,
46+
OUTCOME_FAILED,
47+
OUTCOME_DEADLINE_EXCEEDED
48+
}
49+
50+
/**
51+
* Represents the code execution result from the model.
52+
* @property outcome The result of the execution.
53+
* @property output The stdout from the code execution, or an error message if it failed.
54+
*/
55+
public class CodeExecutionResultPart(public val outcome: Outcome, public val output: String) :
56+
Part {
4357

4458
@Serializable
4559
internal data class Internal(
@@ -48,12 +62,17 @@ public class CodeExecutionResultPart(public val outcome: String, public val outp
4862

4963
@Serializable
5064
internal data class CodeExecutionResult(
51-
@SerialName("outcome") val outcome: String,
65+
@SerialName("outcome") val outcome: Outcome,
5266
val output: String
5367
)
5468
}
5569
}
5670

71+
/**
72+
* Represents the code that is executed by the model.
73+
* @property language The programming language of the code.
74+
* @property code The source code to be executed.
75+
*/
5776
public class ExecutableCodePart(public val language: String, public val code: String) : Part {
5877

5978
@Serializable

0 commit comments

Comments
 (0)