Table of Contents

Class CodeExecutionResult

Namespace
Google.GenAI.Types
Assembly
Google.GenAI.dll

Result of executing the ExecutableCode. Generated only when the CodeExecution tool is used.

public record CodeExecutionResult : IEquatable<CodeExecutionResult>
Inheritance
CodeExecutionResult
Implements
Inherited Members

Properties

Id

Optional. The identifier of the ExecutableCode part this result is for. Only populated if the corresponding ExecutableCode has an id. This field is not supported in Vertex AI.

[JsonPropertyName("id")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? Id { get; set; }

Property Value

string

Outcome

Outcome of the code execution.

[JsonPropertyName("outcome")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public Outcome? Outcome { get; set; }

Property Value

Outcome?

Output

Optional. Contains stdout when code execution is successful, stderr or other description otherwise.

[JsonPropertyName("output")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? Output { get; set; }

Property Value

string

Methods

FromJson(string, JsonSerializerOptions?)

Deserializes a JSON string to a CodeExecutionResult object.

public static CodeExecutionResult? FromJson(string jsonString, JsonSerializerOptions? options = null)

Parameters

jsonString string

The JSON string to deserialize.

options JsonSerializerOptions

Optional JsonSerializerOptions.

Returns

CodeExecutionResult

The deserialized CodeExecutionResult object, or null if deserialization fails.