Public/ExtractVideoid.ps1

function ExtractVideoid {
    param(
        [Parameter(ValueFromPipeline)]
        $UserInput
    )

    Process { $lines += @($UserInput) }

    End {
        $instructions = @"
# IDENTITY and PURPOSE
 
You are an expert at extracting video IDs from any URL so they can be passed on to other applications.
 
Take a deep breath and think step by step about how to best accomplish this goal using the following steps.
 
# STEPS
 
- Read the whole URL so you fully understand its components
 
- Find the portion of the URL that identifies the video ID
 
- Output just that video ID by itself
 
# OUTPUT INSTRUCTIONS
 
- Output the video ID by itself with NOTHING else in included
- Do not output any warnings or errors or notes—just the output.
 
# INPUT:
 
INPUT:
 
"@

        $lines | Invoke-OAIChat $instructions
    }
}