Class Blob
A content blob. A Blob contains data of a specific media type. It is used to represent images, audio, and video.
public record Blob : IEquatable<Blob>
- Inheritance
-
Blob
- Implements
- Inherited Members
Properties
Data
The raw bytes of the data.
[JsonPropertyName("data")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public byte[]? Data { get; set; }
Property Value
- byte[]
DisplayName
Optional. The display name of the blob. Used to provide a label or filename to distinguish
blobs. 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
MimeType
The IANA standard MIME type of the source data.
[JsonPropertyName("mimeType")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? MimeType { get; set; }
Property Value
Methods
FromJson(string, JsonSerializerOptions?)
Deserializes a JSON string to a Blob object.
public static Blob? FromJson(string jsonString, JsonSerializerOptions? options = null)
Parameters
jsonStringstringThe JSON string to deserialize.
optionsJsonSerializerOptionsOptional JsonSerializerOptions.
Returns
- Blob
The deserialized Blob object, or null if deserialization fails.