Table of Contents

Class Content

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

Contains the multi-part content of a message.

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

Properties

Parts

List of parts that constitute a single message. Each part may have a different IANA MIME type.

[JsonPropertyName("parts")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<Part>? Parts { get; set; }

Property Value

List<Part>

Role

Optional. The producer of the content. Must be either 'user' or 'model'. If not set, the service will default to 'user'.

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

Property Value

string

Methods

FromJson(string, JsonSerializerOptions?)

Deserializes a JSON string to a Content object.

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

Parameters

jsonString string

The JSON string to deserialize.

options JsonSerializerOptions

Optional JsonSerializerOptions.

Returns

Content

The deserialized Content object, or null if deserialization fails.