src/Private/Report/AI/Get-MCSMetroAICxData.ps1

function Get-MCSMetroAICxData {
    Param(
        $CustomerName,
        $MetroAgent,
        $ExtraRequest,
        $Debug
    )

    if ($Debug.IsPresent) {
        $DebugPreference = "Continue"
    } else {
        $DebugPreference = "SilentlyContinue"
    }

    Write-Debug ((get-date -Format 'yyyy-MM-dd HH_mm_ss')+' - '+"Getting AI to write a summary about the customer")

    Write-Debug ((get-date -Format 'yyyy-MM-dd HH_mm_ss')+' - '+'Creating Conversation')

    $Conversation = New-MetroAIConversation

    $Prompt = @"
Write a brief institutional description of $CustomerName.
Requirements:
Use only trusted sources.
Consider the official Investor Relations website as the most trusted source of information.
 
Answering most critical rule:
- The explanation must be between 230 and 250 words (Absolutely no more than 250 words, and no less than 230 words).
 
Answering rules:
- Produce only the final explanation text, suitable for insertion into a PowerPoint table cell.
- When more than 1 one tool returns information, synthesize it into a single, concise explanation.
- No introduction or conclusion statements, just the core description.
- The tone should be professional, natural, and institutional, suitable for a business document.
- Do not include apologies or statements about missing information.
- Produce only one consolidated final description, with no explanations, notes, or alternative outputs.
- The explanation must absolutely not look it was written by AI and must not contain anything besides the requested answer.
- Must not include references, source titles, URLs, citations.
- Do not include markdown formatting.
- Do not use bullet points.
- Do not include phrases such as "Understood", "I searched", "looked sources", "did not find", "if you wish", "if you prefer", or apologies.
- Do not offer to search again.
 
$ExtraRequest
"@


    $turn  = Invoke-MetroAIConversation -AgentId $MetroAgent.id -ConversationId $Conversation.id -UserInput $Prompt -Debug:$false
    Write-Debug ((get-date -Format 'yyyy-MM-dd HH_mm_ss')+' - '+"AI Response ID: $($turn.ResponseId)")
    Start-Sleep -Milliseconds 500

    return $turn.AssistantText
}