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

function Get-MCSMetroAIRecommendedActions {
    Param(
        $RecommendationTitle,
        $RecommendationDescription,
        $MetroAgent,
        $Conversation,
        $ExtraRequest,
        $Debug
    )

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

    Write-Debug ((get-date -Format 'yyyy-MM-dd HH_mm_ss')+' - '+"Setting Recommendations to be processed by AI")

    $Prompt = "Considering an Azure Environment and the following recommendation: $RecommendationTitle (with the following deeper explanation: $RecommendationDescription). In less than 50 words, explain to me what would be the recommended actions to apply that recommendation (make sure to not appear the answer was given by AI). $ExtraRequest"

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

    return $turn.AssistantText
}