Class Content
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
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
Methods
FromJson(string, JsonSerializerOptions?)
Deserializes a JSON string to a Content object.
public static Content? FromJson(string jsonString, JsonSerializerOptions? options = null)
Parameters
jsonStringstringThe JSON string to deserialize.
optionsJsonSerializerOptionsOptional JsonSerializerOptions.
Returns
- Content
The deserialized Content object, or null if deserialization fails.