Table of Contents

Class FileData

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

URI-based data. A FileData message contains a URI pointing to data of a specific media type. It is used to represent images, audio, and video stored in Google Cloud Storage.

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

Properties

DisplayName

Optional. The display name of the file. Used to provide a label or filename to distinguish files. This field is only returned in PromptMessage for prompt management. It is used in the Gemini calls only when server side tools (code_execution, google_search, and url_context) are enabled. This field is not supported in Gemini API.

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

Property Value

string

FileUri

The URI of the file in Google Cloud Storage.

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

Property Value

string

MimeType

The IANA standard MIME type of the source data.

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

Property Value

string

Methods

FromJson(string, JsonSerializerOptions?)

Deserializes a JSON string to a FileData object.

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

Parameters

jsonString string

The JSON string to deserialize.

options JsonSerializerOptions

Optional JsonSerializerOptions.

Returns

FileData

The deserialized FileData object, or null if deserialization fails.