private/Invoke-AzureOpenAIRequest.ps1

function Invoke-AzureOpenAIRequest {
    [CmdletBinding()]
    param (
        [Parameter(Mandatory=$true)][string]$Prompt,
        [Parameter(Mandatory=$true)][string]$File,
        [Parameter(Mandatory=$false)][string]$Endpoint,
        [Parameter(Mandatory=$false)][string]$DeploymentId,
        [Parameter(Mandatory=$false)][string]$ApiKey,
        [Parameter(Mandatory=$false)][string]$Model = "gpt-5"
    )
    Write-Warning "This function has not yet been fully implemented."
    $proceed = Read-Host "Do you want to proceed? (Y/N)"
    if ($proceed -ne 'Y') {
        Write-Verbose "Aborting Azure OpenAI request."
        return
    }
    Write-Verbose "Invoking Azure OpenAI request with model $Model"
    if ([string]::IsNullOrEmpty($Endpoint)) {
        $Endpoint = $env:AZURE_OPENAI_ENDPOINT
    }
    if ([string]::IsNullOrEmpty($Endpoint)) {
        throw "Azure OpenAI Endpoint is not set. Please provide it via the -Endpoint parameter or the AZURE_OPENAI_ENDPOINT environment variable."
    }
    if (-not $ApiKey) {
        $ApiKey = $env:AZURE_OPENAI_API_KEY
    }
    if (-not $ApiKey) {
        throw "Azure OpenAI API key is not set. Please provide it via the -ApiKey parameter or the AZURE_OPENAI_API_KEY environment variable."
    }
    $Headers = @{
        "Authorization" = "Bearer $ApiKey"
        "Content-Type"  = "application/json"
    }
    $Body = @{
        model = $Model
        input = $Prompt
    } | ConvertTo-Json -Depth 10
    $requestParams = @{
        Uri         = "$Endpoint/v1/responses"
        Method      = "Post"
        Headers     = $Headers
        Body        = $Body
        ErrorAction = 'Stop'
    }
    $Response = Invoke-RestMethod @requestParams
    $Response
}