Table of Contents

Class Interaction

Namespace
GenerativeAI.Types
Assembly
GenerativeAI.dll

The Interaction resource returned by the Interactions API (/interactions). The output is exposed as Steps; OutputText, OutputImage, OutputAudio and OutputVideo are convenience accessors computed from the steps, like python-genai's helpers.

public sealed class Interaction
Inheritance
Interaction
Inherited Members
Extension Methods

Properties

Agent

The agent that served the interaction.

[JsonPropertyName("agent")]
public string? Agent { get; set; }

Property Value

string

AgentConfig

The agent configuration.

[JsonPropertyName("agent_config")]
public InteractionAgentConfig? AgentConfig { get; set; }

Property Value

InteractionAgentConfig

CachedContent

Deprecated in the API. The cached content used as context.

[JsonPropertyName("cached_content")]
public string? CachedContent { get; set; }

Property Value

string

ContinuationToken

Opaque token to resume a long decode. Set when Status is RequiresContinuation; pass it back unchanged to continue decoding.

[JsonPropertyName("continuation_token")]
public string? ContinuationToken { get; set; }

Property Value

string

Created

Output only. Creation time in ISO 8601 format.

[JsonPropertyName("created")]
public string? Created { get; set; }

Property Value

string

Environment

The environment configuration of the interaction.

[JsonPropertyName("environment")]
public InteractionEnvironmentReference? Environment { get; set; }

Property Value

InteractionEnvironmentReference

EnvironmentId

Output only. The environment ID, when an environment was configured.

[JsonPropertyName("environment_id")]
public string? EnvironmentId { get; set; }

Property Value

string

Errors

Output only. Diagnostic faults or platform errors recorded on the interaction.

[JsonPropertyName("errors")]
public List<InteractionError>? Errors { get; set; }

Property Value

List<InteractionError>

ExtensionData

Fields returned by the API that this SDK does not model yet.

[JsonExtensionData]
public Dictionary<string, JsonElement>? ExtensionData { get; set; }

Property Value

Dictionary<string, JsonElement>

FunctionCalls

The function calls of the trailing model turn (after the last user input), which the client must answer with InteractionFunctionResultSteps when Status is RequiresAction.

[JsonIgnore]
public IReadOnlyList<InteractionFunctionCallStep> FunctionCalls { get; }

Property Value

IReadOnlyList<InteractionFunctionCallStep>

GenerationConfig

The generation configuration.

[JsonPropertyName("generation_config")]
public InteractionGenerationConfig? GenerationConfig { get; set; }

Property Value

InteractionGenerationConfig

Id

Output only. A unique identifier for the interaction.

[JsonPropertyName("id")]
public string? Id { get; set; }

Property Value

string

Input

The input of the interaction (only returned when requested with include_input).

[JsonPropertyName("input")]
public InteractionInput? Input { get; set; }

Property Value

InteractionInput

Labels

User-defined labels.

[JsonPropertyName("labels")]
public Dictionary<string, string>? Labels { get; set; }

Property Value

Dictionary<string, string>

Model

The model that served the interaction.

[JsonPropertyName("model")]
public string? Model { get; set; }

Property Value

string

Object

Output only. The resource type. Only present on interactions embedded in streaming events.

[JsonPropertyName("object")]
public string? Object { get; set; }

Property Value

string

OutputAudio

The last generated audio of the model output steps, or null.

[JsonIgnore]
public InteractionAudioContent? OutputAudio { get; }

Property Value

InteractionAudioContent

OutputImage

The last generated image of the model output steps, or null.

[JsonIgnore]
public InteractionImageContent? OutputImage { get; }

Property Value

InteractionImageContent

OutputText

Concatenated text of the trailing model output, after the last user input (thought steps are skipped); an empty string when there is none. Mirrors python-genai's Interaction.output_text.

[JsonIgnore]
public string OutputText { get; }

Property Value

string

OutputVideo

The last generated video of the model output steps, or null. The video is either inline (Data, see GetDataBytes()) or referenced by Uri.

[JsonIgnore]
public InteractionVideoContent? OutputVideo { get; }

Property Value

InteractionVideoContent

PreviousInteractionId

The ID of the previous interaction, if any.

[JsonPropertyName("previous_interaction_id")]
public string? PreviousInteractionId { get; set; }

Property Value

string

ResponseFormat

The requested response format(s).

[JsonPropertyName("response_format")]
[JsonConverter(typeof(InteractionResponseFormatListConverter))]
public List<InteractionResponseFormat>? ResponseFormat { get; set; }

Property Value

List<InteractionResponseFormat>

ResponseMimeType

Deprecated in the API. The MIME type of the response.

[JsonPropertyName("response_mime_type")]
public string? ResponseMimeType { get; set; }

Property Value

string

ResponseModalities

Deprecated in the API. The requested response modalities (see InteractionModalities).

[JsonPropertyName("response_modalities")]
public List<string>? ResponseModalities { get; set; }

Property Value

List<string>

SafetySettings

Safety settings.

[JsonPropertyName("safety_settings")]
public List<InteractionSafetySetting>? SafetySettings { get; set; }

Property Value

List<InteractionSafetySetting>

ServiceTier

The service tier (see InteractionServiceTiers).

[JsonPropertyName("service_tier")]
public string? ServiceTier { get; set; }

Property Value

string

Status

Output only. The status of the interaction (see InteractionStatuses).

[JsonPropertyName("status")]
public string? Status { get; set; }

Property Value

string

Steps

Output only. The steps that make up the interaction, when included in the response.

[JsonPropertyName("steps")]
public List<InteractionStep>? Steps { get; set; }

Property Value

List<InteractionStep>

SystemInstruction

The system instruction.

[JsonPropertyName("system_instruction")]
public string? SystemInstruction { get; set; }

Property Value

string

Tools

The tools available to the model.

[JsonPropertyName("tools")]
public List<InteractionTool>? Tools { get; set; }

Property Value

List<InteractionTool>

Updated

Output only. Last update time in ISO 8601 format.

[JsonPropertyName("updated")]
public string? Updated { get; set; }

Property Value

string

Usage

Statistics on the interaction's token usage.

[JsonPropertyName("usage")]
public InteractionUsage? Usage { get; set; }

Property Value

InteractionUsage

WebhookConfig

Webhook configuration.

[JsonPropertyName("webhook_config")]
public InteractionWebhookConfig? WebhookConfig { get; set; }

Property Value

InteractionWebhookConfig