Table of Contents

Class GENTask<TSelf, TOptions, TPrompt, TResult>

Namespace
Glitch9.AIDevKit

Abstract base class for all generative AI tasks (text, image, audio). Supports text, image, and audio prompts with fluent configuration methods.

public abstract class GENTask<TSelf, TOptions, TPrompt, TResult> : TaskBase<TSelf, TResult>, IGENTask where TSelf : GENTask<TSelf, TOptions, TPrompt, TResult> where TOptions : IGENOptions where TResult : IGeneratedResult

Type Parameters

TSelf
TOptions
TPrompt
TResult
Inheritance
object
TaskBase<TSelf, TResult>
GENTask<TSelf, TOptions, TPrompt, TResult>
Implements
Derived
Inherited Members

Constructors

GENTask()

protected GENTask()

GENTask(TPrompt)

protected GENTask(TPrompt prompt)

Parameters

prompt TPrompt

Properties

Api

public override Api Api { get; set; }

Property Value

Api

MaxN

public int MaxN { get; }

Property Value

int

ModelId

public string ModelId { get; }

Property Value

string

N

public int N { get; }

Property Value

int

Options

public TOptions Options { get; set; }

Property Value

TOptions

OutputFileNote

public string OutputFileNote { get; }

Property Value

string

OutputFilePath

public string OutputFilePath { get; }

Property Value

string

Prompt

public TPrompt Prompt { get; set; }

Property Value

TPrompt

RecordHistory

public bool RecordHistory { get; }

Property Value

bool

SaveGeneratedContents

public bool SaveGeneratedContents { get; }

Property Value

bool

Methods

CreateMergedHistoryRecordINTERNAL(List<TResult>)

protected void CreateMergedHistoryRecordINTERNAL(List<TResult> results)

Parameters

results List<TResult>

EnablePromptHistory(bool)

Enables or disables prompt history for this task.

public TSelf EnablePromptHistory(bool enablePromptHistory = true)

Parameters

enablePromptHistory bool

Returns

TSelf

ExecuteAsync()

Executes the task and returns the output of type TResult. This is the main entry point for executing the task.

public override UniTask<TResult> ExecuteAsync()

Returns

UniTask<TResult>

GetPrompt()

public IPrompt GetPrompt()

Returns

IPrompt

ResolveOutputPath(Api?, string)

protected virtual TSelf ResolveOutputPath(Api? apiOverride = null, string keyword = null)

Parameters

apiOverride Api?
keyword string

Returns

TSelf

SaveContentsTo(string, string)

Sets the download path for the generated content(s). This is the path where the generated content(s) will be saved.

public TSelf SaveContentsTo(string outputFilePath = null, string outputFileNote = null)

Parameters

outputFilePath string

The path where the generated content(s) will be saved.

outputFileNote string

Returns

TSelf

SetCount(int)

Sets the number of outputs to generate (e.g., number of images or responses).

public TSelf SetCount(int count)

Parameters

count int

Returns

TSelf

SetModel(Api, string)

Added new on 2025.07.17 Sets the AI model with API and model ID.

public TSelf SetModel(Api api, string modelId)

Parameters

api Api
modelId string

Returns

TSelf

SetModel(Model)

Sets the AI model to be used for generation.

public TSelf SetModel(Model model)

Parameters

model Model

Returns

TSelf

SetOptions(TOptions)

public TSelf SetOptions(TOptions apiOptions)

Parameters

apiOptions TOptions

Returns

TSelf

SetRequestMimeType(MIMEType)

public TSelf SetRequestMimeType(MIMEType mimeType)

Parameters

mimeType MIMEType

Returns

TSelf

SetResponseMimeType(MIMEType)

Sets a custom MIME type for the output.

public TSelf SetResponseMimeType(MIMEType mimeType)

Parameters

mimeType MIMEType

Returns

TSelf

YieldAsync()

Allows to set N more than the selected model allows. This is useful for streaming the responses one by one.

public IAsyncEnumerable<TResult> YieldAsync()

Returns

IAsyncEnumerable<TResult>

YieldAsyncINTERNAL()

protected virtual IAsyncEnumerable<TResult> YieldAsyncINTERNAL()

Returns

IAsyncEnumerable<TResult>