Class GenerativeTaskExtensions
Provides fluent, chainable extension methods that create and configure AI generation tasks. These helpers let you start a task directly from the host object (string, AudioClip, Texture2D, etc.) and then continue the configuration via the task's fluent API.
Typical usage:
// Create a chat-like text generation
"Describe a cat playing piano."
.GENText()
.SetModel(OpenAIModel.GPT4o)
.ExecuteAsync();
// Transcribe recorded speech
audioClip.GENTranscript().ExecuteAsync();
public static class GenerativeTaskExtensions
- Inheritance
-
objectGenerativeTaskExtensions
Methods
GENAudioIsolation(AudioClip)
Isolates vocals or removes background noise from this audio clip.
Example: audioClip.GENAudioIsolation().ExecuteAsync();
public static GENAudioIsolationTask GENAudioIsolation(this AudioClip prompt)
Parameters
promptAudioClip
Returns
GENCode(TextPrompt)
public static GENCodeTask GENCode(this TextPrompt prompt)
Parameters
promptTextPrompt
Returns
GENCode(string, string)
public static GENCodeTask GENCode(this string prompt, string formattedPrompt = null)
Parameters
promptstringformattedPromptstring
Returns
GENImage(TextPrompt)
public static GENImageTask GENImage(this TextPrompt prompt)
Parameters
promptTextPrompt
Returns
GENImage(string, string)
Creates an image generation task using this string as the image prompt.
Example: "A cat surfing a wave".GENImage().SetModel(ImageModel.DallE3).ExecuteAsync();
public static GENImageTask GENImage(this string prompt, string formattedPrompt = null)
Parameters
promptstringformattedPromptstring
Returns
GENInpaint(InpaintPrompt)
Creates an image editing task by applying the given prompt to this image.
Note: - DALL·E 3 image editing is not supported with the OpenAI API yet. (Only available in ChatGPT)
Example: texture.GENImageEdit("Add sunglasses").SetModel(ImageModel.DallE2).ExecuteAsync();
public static GENInpaintTask GENInpaint(this InpaintPrompt prompt)
Parameters
promptInpaintPrompt
Returns
GENInpaint(Sprite, string)
public static GENInpaintTask GENInpaint(this Sprite prompt, string instruction)
Parameters
promptSpriteinstructionstring
Returns
GENInpaint(Texture2D, string)
public static GENInpaintTask GENInpaint(this Texture2D prompt, string instruction)
Parameters
promptTexture2Dinstructionstring
Returns
GENModeration(TextPrompt, IEnumerable<SafetySetting>)
public static GENModerationTask GENModeration(this TextPrompt prompt, IEnumerable<SafetySetting> safetySettings)
Parameters
promptTextPromptsafetySettingsIEnumerable<SafetySetting>
Returns
GENModeration(string, IEnumerable<SafetySetting>)
Creates a moderation task to evaluate potentially harmful or sensitive content. This can be used to detect categories like hate speech, violence, self-harm, etc., depending on the model and provider.
Example: content.GENModeration().SetModel(OpenAIModel.Moderation).ExecuteAsync();
public static GENModerationTask GENModeration(this string prompt, IEnumerable<SafetySetting> safetySettings)
Parameters
promptstringThe content to be evaluated for moderation.
safetySettingsIEnumerable<SafetySetting>
Returns
- GENModerationTask
A GENModerationTask that can be configured and executed.
GENResponse(TextPrompt)
public static GENResponseTask GENResponse(this TextPrompt prompt)
Parameters
promptTextPrompt
Returns
GENResponse(string, string)
Creates a text‑generation task that uses this string as the prompt.
public static GENResponseTask GENResponse(this string prompt, string formattedPrompt = null)
Parameters
promptstringThe prompt to send to the model.
formattedPromptstring
Returns
- GENResponseTask
A configurable GENResponseTask instance.
Examples
"Tell me a joke."
.GENText()
.SetModel(OpenAIModel.GPT4o)
.ExecuteAsync();
GENSoundEffect(Weighted<string>)
public static GENSoundEffectTask GENSoundEffect(this Weighted<string> prompt)
Parameters
promptWeighted<string>
Returns
GENSoundEffect(string)
Generates a sound effect based on this prompt text.
Example: "Footsteps on snow".GENSoundEffect().ExecuteAsync();
public static GENSoundEffectTask GENSoundEffect(this string prompt)
Parameters
promptstring
Returns
GENSpeech(TextPrompt)
public static GENSpeechTask GENSpeech(this TextPrompt prompt)
Parameters
promptTextPrompt
Returns
GENSpeech(string, string)
Creates a text-to-speech (TTS) task that reads this string aloud using a realistic AI voice.
Example: "Hello there!".GENSpeech().SetVoice(ElevenLabsVoice.Rachel).ExecuteAsync();
public static GENSpeechTask GENSpeech(this string prompt, string formattedPrompt = null)
Parameters
promptstringformattedPromptstring
Returns
GENStruct<T>(TextPrompt)
public static GENStructTask<T> GENStruct<T>(this TextPrompt prompt) where T : class
Parameters
promptTextPrompt
Returns
Type Parameters
T
GENStruct<T>(string, string)
public static GENStructTask<T> GENStruct<T>(this string prompt, string formattedPrompt = null) where T : class
Parameters
promptstringformattedPromptstring
Returns
Type Parameters
T
GENTranscript(AudioClip)
Creates a speech-to-text (STT) task that transcribes spoken words from this audio clip.
Example: audioClip.GENTranscript().ExecuteAsync();
public static GENTranscriptTask GENTranscript(this AudioClip prompt)
Parameters
promptAudioClip
Returns
GENTranslation(AudioClip)
Translates the speech in this audio clip into English text. Useful for multilingual voice input.
Example: audioClip.GENTranslation().ExecuteAsync();
public static GENTranslationTask GENTranslation(this AudioClip prompt)
Parameters
promptAudioClip
Returns
GENVideo(string, string)
Generates a video based on this prompt text.
Example: "A cat surfing a wave".GENVideoGen().ExecuteAsync();
public static GENVideoTask GENVideo(this string prompt, string formattedPrompt = null)
Parameters
promptstringformattedPromptstring
Returns
GENVideo(Texture2D)
Generates a video based on this prompt image.
Example: texture.GENVideoGen().ExecuteAsync();
public static GENVideoTask GENVideo(this Texture2D prompt)
Parameters
promptTexture2D
Returns
GENVoiceChange(AudioClip)
Changes the voice in this audio clip using AI voice transformation.
Example: audioClip.GENVoiceChange().SetVoice(ElevenLabsVoice.Rachel).ExecuteAsync();
public static GENVoiceChangeTask GENVoiceChange(this AudioClip prompt)
Parameters
promptAudioClip