Table of Contents

Class FunctionCall

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

A predicted FunctionCall returned from the model that contains a string representing the FunctionDeclaration.name and a structured JSON object containing the parameters and their values.

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

Properties

Args

Optional. The function parameters and values in JSON object format. See FunctionDeclaration.parameters for parameter details.

[JsonPropertyName("args")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public Dictionary<string, object>? Args { get; set; }

Property Value

Dictionary<string, object>

Id

Optional. The unique id of the function call. If populated, the client to execute the function_call and return the response with the matching id.

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

Property Value

string

Name

Optional. The name of the function to call. Matches FunctionDeclaration.name.

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

Property Value

string

PartialArgs

Optional. The partial argument value of the function call. If provided, represents the arguments/fields that are streamed incrementally. This field is not supported in Gemini API.

[JsonPropertyName("partialArgs")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<PartialArg>? PartialArgs { get; set; }

Property Value

List<PartialArg>

WillContinue

Optional. Whether this is the last part of the FunctionCall. If true, another partial message for the current FunctionCall is expected to follow. This field is not supported in Gemini API.

[JsonPropertyName("willContinue")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public bool? WillContinue { get; set; }

Property Value

bool?

Methods

FromJson(string, JsonSerializerOptions?)

Deserializes a JSON string to a FunctionCall object.

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

Parameters

jsonString string

The JSON string to deserialize.

options JsonSerializerOptions

Optional JsonSerializerOptions.

Returns

FunctionCall

The deserialized FunctionCall object, or null if deserialization fails.