template.txt
function $functionName {
param( [Parameter(ValueFromPipeline)] `$UserInput, [Switch]`$Chat ) Process { `$lines += @(`$UserInput) } End { `$instructions = @" $instructions "@ if(`$Chat) { 'Time to chat' } else { `$lines | Invoke-OAIChat `$instructions } } } |