Table of Contents

Class InteractionMediaContent

Namespace
GenerativeAI.Types
Assembly
GenerativeAI.dll

Base class for media content blocks (image, audio, video, document), which carry either inline base64 Data or a Uri.

public abstract class InteractionMediaContent : InteractionContent
Inheritance
InteractionMediaContent
Derived
Inherited Members
Extension Methods

Constructors

InteractionMediaContent(string)

Initializes a new media content block with the given discriminator.

protected InteractionMediaContent(string type)

Parameters

type string

The type discriminator.

Properties

Data

The base64-encoded media bytes (inline delivery).

[JsonPropertyName("data")]
public string? Data { get; set; }

Property Value

string

MimeType

The MIME type of the media.

[JsonPropertyName("mime_type")]
public string? MimeType { get; set; }

Property Value

string

Uri

The URI of the media (URI delivery, uploaded files, Cloud Storage, etc.).

[JsonPropertyName("uri")]
public string? Uri { get; set; }

Property Value

string

Methods

GetDataBytes()

Decodes Data, or returns null when the media was delivered by Uri.

public byte[]? GetDataBytes()

Returns

byte[]

The media bytes, or null.