Table of Contents

Class ExecutableCode

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

Code generated by the model that is meant to be executed, and the result returned to the model. Generated when using the CodeExecution tool, in which the code will be automatically executed, and a corresponding CodeExecutionResult will also be generated.

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

Properties

Code

The code to be executed.

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

Property Value

string

Id

Optional. Unique identifier of the ExecutableCode part. The server returns the CodeExecutionResult with the matching id. This field is not supported in Vertex AI.

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

Property Value

string

Language

Programming language of the code.

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

Property Value

Language?

Methods

FromJson(string, JsonSerializerOptions?)

Deserializes a JSON string to a ExecutableCode object.

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

Parameters

jsonString string

The JSON string to deserialize.

options JsonSerializerOptions

Optional JsonSerializerOptions.

Returns

ExecutableCode

The deserialized ExecutableCode object, or null if deserialization fails.