Class GENTask<TSelf, TOptions, TPrompt, TResult>
Abstract base class for all generative AI tasks (text, image, audio).
Supports text, image, and audio prompts with fluent configuration methods.
Inheritance
object
GENTask<TSelf, TOptions, TPrompt, TResult>
Assembly: .dll
Syntax
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
Name |
Description |
TSelf |
|
TOptions |
|
TPrompt |
|
TResult |
|
Constructors
GENTask()
Declaration
GENTask(TPrompt)
Declaration
protected GENTask(TPrompt prompt)
Parameters
Type |
Name |
Description |
TPrompt |
prompt |
|
Properties
Api
Declaration
public override Api Api { get; set; }
Property Value
Overrides
MaxN
Declaration
Property Value
ModelId
Declaration
public string ModelId { get; }
Property Value
N
Declaration
Property Value
Options
Declaration
public TOptions Options { get; set; }
Property Value
Type |
Description |
TOptions |
|
OutputFileNote
Declaration
public string OutputFileNote { get; }
Property Value
OutputFilePath
Declaration
public string OutputFilePath { get; }
Property Value
Prompt
Declaration
public TPrompt Prompt { get; set; }
Property Value
RecordHistory
Declaration
public bool RecordHistory { get; }
Property Value
SaveGeneratedContents
Declaration
public bool SaveGeneratedContents { get; }
Property Value
Methods
CreateMergedHistoryRecordINTERNAL(List<TResult>)
Declaration
protected void CreateMergedHistoryRecordINTERNAL(List<TResult> results)
Parameters
Type |
Name |
Description |
List<TResult> |
results |
|
EnablePromptHistory(bool)
Enables or disables prompt history for this task.
Declaration
public TSelf EnablePromptHistory(bool enablePromptHistory = true)
Parameters
Type |
Name |
Description |
bool |
enablePromptHistory |
|
Returns
ExecuteAsync()
Executes the task and returns the output of type TResult
.
This is the main entry point for executing the task.
Declaration
public override UniTask<TResult> ExecuteAsync()
Returns
Type |
Description |
UniTask<TResult> |
|
Overrides
GetPrompt()
Declaration
public IPrompt GetPrompt()
Returns
ResolveOutputPath(Api?, string)
Declaration
protected virtual TSelf ResolveOutputPath(Api? apiOverride = null, string keyword = null)
Parameters
Type |
Name |
Description |
Api? |
apiOverride |
|
string |
keyword |
|
Returns
SaveContentsTo(string, string)
Sets the download path for the generated content(s).
This is the path where the generated content(s) will be saved.
Declaration
public TSelf SaveContentsTo(string outputFilePath = null, string outputFileNote = null)
Parameters
Type |
Name |
Description |
string |
outputFilePath |
The path where the generated content(s) will be saved.
|
string |
outputFileNote |
|
Returns
SetCount(int)
Sets the number of outputs to generate (e.g., number of images or responses).
Declaration
public TSelf SetCount(int count)
Parameters
Type |
Name |
Description |
int |
count |
|
Returns
SetModel(Api, string)
Added new on 2025.07.17
Sets the AI model with API and model ID.
Declaration
public TSelf SetModel(Api api, string modelId)
Parameters
Type |
Name |
Description |
Api |
api |
|
string |
modelId |
|
Returns
SetModel(Model)
Sets the AI model to be used for generation.
Declaration
public TSelf SetModel(Model model)
Parameters
Type |
Name |
Description |
Model |
model |
|
Returns
SetOptions(TOptions)
Declaration
public TSelf SetOptions(TOptions apiOptions)
Parameters
Type |
Name |
Description |
TOptions |
apiOptions |
|
Returns
SetRequestMimeType(MIMEType)
Declaration
public TSelf SetRequestMimeType(MIMEType mimeType)
Parameters
Type |
Name |
Description |
MIMEType |
mimeType |
|
Returns
SetResponseMimeType(MIMEType)
Sets a custom MIME type for the output.
Declaration
public TSelf SetResponseMimeType(MIMEType mimeType)
Parameters
Type |
Name |
Description |
MIMEType |
mimeType |
|
Returns
YieldAsync()
Allows to set N more than the selected model allows.
This is useful for streaming the responses one by one.
Declaration
public IAsyncEnumerable<TResult> YieldAsync()
Returns
Type |
Description |
IAsyncEnumerable<TResult> |
|
YieldAsyncINTERNAL()
Declaration
protected virtual IAsyncEnumerable<TResult> YieldAsyncINTERNAL()
Returns
Type |
Description |
IAsyncEnumerable<TResult> |
|
Implements