Table of Contents

Class InteractionInput

Namespace
GenerativeAI.Types
Assembly
GenerativeAI.dll

The input of an interaction: a string, a single content block, a list of content blocks, or a list of steps (for example the previous turns plus function results).

[JsonConverter(typeof(InteractionInputConverter))]
public sealed class InteractionInput
Inheritance
InteractionInput
Inherited Members
Extension Methods

Constructors

InteractionInput(InteractionContent)

Creates an input made of a single content block.

public InteractionInput(InteractionContent content)

Parameters

content InteractionContent

The content block.

InteractionInput(string)

Creates a text input.

public InteractionInput(string text)

Parameters

text string

The text.

Properties

Content

The input content, when the input is a single content block.

public InteractionContent? Content { get; }

Property Value

InteractionContent

Contents

The input contents, when the input is a list of content blocks.

public List<InteractionContent>? Contents { get; }

Property Value

List<InteractionContent>

Steps

The input steps, when the input is a list of steps.

public List<InteractionStep>? Steps { get; }

Property Value

List<InteractionStep>

Text

The input text, when the input is a string.

public string? Text { get; }

Property Value

string

Methods

FromContents(IEnumerable<InteractionContent>)

Creates an input from content blocks (e.g. text plus an image).

public static InteractionInput FromContents(IEnumerable<InteractionContent> contents)

Parameters

contents IEnumerable<InteractionContent>

The content blocks.

Returns

InteractionInput

The input.

FromSteps(IEnumerable<InteractionStep>)

Creates an input from steps (e.g. function results).

public static InteractionInput FromSteps(IEnumerable<InteractionStep> steps)

Parameters

steps IEnumerable<InteractionStep>

The steps.

Returns

InteractionInput

The input.

FromString(string)

Creates a text input (same as FromText(string)).

public static InteractionInput FromString(string text)

Parameters

text string

The text.

Returns

InteractionInput

The input.

FromText(string)

Creates a text input.

public static InteractionInput FromText(string text)

Parameters

text string

The text.

Returns

InteractionInput

The input.

Operators

implicit operator InteractionInput(string)

Creates a text input.

public static implicit operator InteractionInput(string text)

Parameters

text string

The text.

Returns

InteractionInput