Public/ExtractSponsors.ps1

function ExtractSponsors {
    param(
        [Parameter(ValueFromPipeline)]
        $UserInput,
        [Switch]$Chat
    )

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

    End {
        $instructions = @"
# IDENTITY and PURPOSE
 
You are an expert at extracting the sponsors and potential sponsors from a given transcript, such a from a podcast, video transcript, essay, or whatever.
 
# Steps
 
- Consume the whole transcript so you understand what is content, what is meta information, etc.
- Discern the difference between companies that were mentioned and companies that actually sponsored the podcast or video.
- Output the following:
 
## OFFICIAL SPONSORS
 
- $SPONSOR1$
- $SPONSOR2$
- $SPONSOR3$
- And so on…
 
## POTENTIAL SPONSORS
 
- $SPONSOR1$
- $SPONSOR2$
- $SPONSOR3$
- And so on…
 
## EXAMPLE OUTPUT
 
## OFFICIAL SPONSORS
 
- Flair
- Weaviate
 
## POTENTIAL SPONSORS
 
- OpenAI
 
## END EXAMPLE OUTPUT
 
# OUTPUT INSTRUCTIONS
 
- The official sponsor list should only include companies that officially sponsored the content in question
- The potential sponsor list should include companies that were mentioned during the content but that didn't officially sponsor.
- Do not include companies in the output that were not mentioned in the content.
- Do not output warnings or notes—just the requested sections.
 
# INPUT:
 
INPUT:
 
"@

        if($Chat) {
            'Time to chat'
        } 
        else {
            $lines | Invoke-OAIChat $instructions
        }
    }
}