Class Content
- Namespace
- GenerativeAI.Types
- Assembly
- GenerativeAI.dll
The base structured datatype containing multi-part content of a message. A Content includes a Role field designating the producer of the Content and a Parts field containing multi-part data that contains the content of the message turn.
public sealed class Content
- Inheritance
-
Content
- Inherited Members
- Extension Methods
Constructors
Content()
Represents a piece of content, including parts and an optional role.
public Content()
Content(IEnumerable<Part>, string?)
Represents the structured multi-part content of a message, including the role of the producer. This type is utilized for handling and managing the content within message exchanges.
public Content(IEnumerable<Part> parts, string? role)
Parameters
partsIEnumerable<Part>rolestring
Content(string, string?)
Represents the content of a message with multiple parts and a specific role.
public Content(string prompt, string? role)
Parameters
Remarks
This class encapsulates a multi-part message structure. Each piece of the message content is encapsulated within the Parts property as a collection of Part objects. The Role property designates the entity responsible for producing the content of the message. This content may include plain text, execution results, file data, and more.
Properties
Parts
Ordered Parts that constitute a single message. Parts may have different MIME types.
[JsonPropertyName("parts")]
public List<Part> Parts { get; set; }
Property Value
Role
Optional. The producer of the content. Must be either 'user' or 'model'. Useful to set for multi-turn conversations, otherwise can be left blank or unset.
[JsonPropertyName("role")]
public string? Role { get; set; }