AIDevKit - AI Suite for Unity
API ReferencesDiscordGlitch9
  • Introduction
    • AI Dev Kit 3.7.0
    • Troubleshooting
    • FAQ
    • Update Logs
  • Provider Setup
    • API Key Setup
    • OpenAI
    • Google Gemini
    • ElevenLabs
    • Ollama
    • OpenRouter
  • Editor Tools
    • Introduction
    • Editor Chat
    • Model Library
    • Voice Library
  • GEN Tasks
    • Overview
    • Prefixes
    • Response
    • Chat
    • Image
    • Video
    • SoundFX
    • Speech
    • Transcript
    • Voice Change
    • Audio Isolation
    • Sequence
  • Advanced API (Pro)
    • Assistants
      • How it works
      • Creating custom functions
      • Creating assistants API
    • Realtime
  • Legacy API
    • OpenAI
      • ๐Ÿ’ฌChat completions
      • ๐Ÿ–ผ๏ธImage operations
      • ๐Ÿ—ฃ๏ธText to speech
      • ๐ŸŽ™๏ธSpeech to text
        • Recording real-time in Unity
      • ๐Ÿ’พFiles
      • ๐Ÿ”ŽEmbeddings
      • ๐Ÿ›ก๏ธModerations
      • โš™๏ธFine-tuning
    • Google Gemini
      • ๐Ÿ“System instructions
      • ๐Ÿ’ฌText generation
      • โš™๏ธFine-tuning
      • โ–ถ๏ธFucntion calling
      • ๐Ÿ”ŽEmbeddings
      • ๐Ÿ›ก๏ธSafety
      • ๐Ÿ’ปCode execution
  • Legacy Documents
    • AI Dev Kit 1.0
      • Preperation
      • Scriptable Toolkits
        • Chat Streamer
        • Image Generator
        • Voice Transcriber
        • Voice Generator
      • Editor Tools
      • Troubleshooting (Legacy)
        • โ—Build Error: The name 'UnityMenu' does not exist in the current context
        • โ—The type or namespace name 'AndroidJavaObject' could not be found
        • โ—The type or namaspace name 'Plastic' does not exist
        • โ—Build Error: The name 'Asset Database' does not exist in the current context
        • โ—'ModelData.Create(Provider, string, UnixTime?, string)': not all code paths return a value
      • Code Generators
        • C# Script Generator
        • Unity Component Generator
    • AI Dev Kit 2.0
      • Event Handlers
      • Editor Chat
      • Editor Vision (TTI, ITI)
      • Editor Speech (TTS)
      • Management Tools
        • Prompt History Viewer
        • AI Model Manager
        • TTS Voice Manager
        • OpenAI File Manager
        • OpenAI Assistant Manager
        • ElevenLabs Voice Library
Powered by GitBook
On this page
  1. GEN Tasks

Sequence

GENSequence - Executing Multiple Tasks in Sequence

Sometimes you may want to run several generative tasks one after the other. For example, generate a piece of text, then use that text in a subsequent task, or just run a batch of independent tasks in order. GENSequence is a utility class to help with this.

Each task in the sequence will start only after the previous one finishes. This is handy to ensure you don't overload your system with simultaneous requests or when one task's result is needed for the next (with manual passing of data in between).

Generating text then speech

Suppose we want to first generate a line of dialogue and then synthesize it into speech audio

var sequence = new GENSequence();
string lineResult = null;  // to capture the text result of the first task

sequence.Append("Write a one-sentence line for a pirate character."
            .GENResponse()
            .OnComplete((result) => lineResult = result))
        .Append(lineResult.GENSpeech());

// Now execute the sequence
await sequence.ExecuteAsync();
PreviousAudio IsolationNextAssistants

Last updated 2 hours ago