@@ -53,15 +53,21 @@ internal constructor(
53
53
) : InternalPart
54
54
}
55
55
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
+ */
56
62
public class CodeExecutionResultPart
57
63
internal constructor (
58
- public val outcome: String ,
64
+ public val outcome: Outcome ,
59
65
public val output: String ,
60
66
public override val isThought: Boolean ,
61
67
internal val thoughtSignature: String?
62
68
) : Part {
63
69
64
- public constructor (outcome: String , output: String ) : this (outcome, output, false , null )
70
+ public constructor (outcome: Outcome , output: String ) : this (outcome, output, false , null )
65
71
66
72
@Serializable
67
73
internal data class Internal (
@@ -72,12 +78,18 @@ internal constructor(
72
78
73
79
@Serializable
74
80
internal data class CodeExecutionResult (
75
- @SerialName(" outcome" ) val outcome : String ,
81
+ @SerialName(" outcome" ) val outcome : Outcome . Internal ,
76
82
val output : String
77
83
)
78
84
}
79
85
}
80
86
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
+ */
81
93
public class ExecutableCodePart
82
94
internal constructor (
83
95
public val language: String ,
@@ -354,7 +366,7 @@ internal fun Part.toInternal(): InternalPart {
354
366
)
355
367
is CodeExecutionResultPart ->
356
368
CodeExecutionResultPart .Internal (
357
- CodeExecutionResultPart .Internal .CodeExecutionResult (outcome, output),
369
+ CodeExecutionResultPart .Internal .CodeExecutionResult (outcome.toInternal() , output),
358
370
isThought,
359
371
thoughtSignature
360
372
)
@@ -410,7 +422,7 @@ internal fun InternalPart.toPublic(): Part {
410
422
)
411
423
is CodeExecutionResultPart .Internal ->
412
424
CodeExecutionResultPart (
413
- codeExecutionResult.outcome,
425
+ codeExecutionResult.outcome.toPublic() ,
414
426
codeExecutionResult.output,
415
427
thought ? : false ,
416
428
thoughtSignature
0 commit comments