@@ -53,15 +53,21 @@ internal constructor(
5353 ) : InternalPart
5454}
5555
56+ /* *
57+ * Represents the code execution result from the model.
58+ * @property outcome The result of the execution.
59+ * @property output The stdout from the code execution, or an error message if it failed.
60+ * @property isThought Indicates whether the response is a thought.
61+ */
5662public class CodeExecutionResultPart
5763internal constructor (
58- public val outcome: String ,
64+ public val outcome: Outcome ,
5965 public val output: String ,
6066 public override val isThought: Boolean ,
6167 internal val thoughtSignature: String?
6268) : Part {
6369
64- public constructor (outcome: String , output: String ) : this (outcome, output, false , null )
70+ public constructor (outcome: Outcome , output: String ) : this (outcome, output, false , null )
6571
6672 @Serializable
6773 internal data class Internal (
@@ -72,12 +78,18 @@ internal constructor(
7278
7379 @Serializable
7480 internal data class CodeExecutionResult (
75- @SerialName(" outcome" ) val outcome : String ,
81+ @SerialName(" outcome" ) val outcome : Outcome . Internal ,
7682 val output : String
7783 )
7884 }
7985}
8086
87+ /* *
88+ * Represents the code that is executed by the model.
89+ * @property language The programming language of the code.
90+ * @property code The source code to be executed.
91+ * @property isThought Indicates whether the response is a thought.
92+ */
8193public class ExecutableCodePart
8294internal constructor (
8395 public val language: String ,
@@ -354,7 +366,7 @@ internal fun Part.toInternal(): InternalPart {
354366 )
355367 is CodeExecutionResultPart ->
356368 CodeExecutionResultPart .Internal (
357- CodeExecutionResultPart .Internal .CodeExecutionResult (outcome, output),
369+ CodeExecutionResultPart .Internal .CodeExecutionResult (outcome.toInternal() , output),
358370 isThought,
359371 thoughtSignature
360372 )
@@ -410,7 +422,7 @@ internal fun InternalPart.toPublic(): Part {
410422 )
411423 is CodeExecutionResultPart .Internal ->
412424 CodeExecutionResultPart (
413- codeExecutionResult.outcome,
425+ codeExecutionResult.outcome.toPublic() ,
414426 codeExecutionResult.output,
415427 thought ? : false ,
416428 thoughtSignature
0 commit comments