Public/Azure/Request-AzureTextCompletion.ps1
function Request-AzureTextCompletion { [CmdletBinding()] [OutputType([pscustomobject])] param ( [Parameter(Position = 0, ValueFromPipeline)] [ValidateNotNullOrEmpty()] [Alias('Message')] [string[]]$Prompt, [Parameter()] [string]$Suffix, [Parameter(Mandatory)] [Alias('Model')] [string]$Deployment, [Parameter()] [ValidateRange(0.0, 2.0)] [double]$Temperature, [Parameter()] [ValidateRange(0.0, 1.0)] [Alias('top_p')] [double]$TopP, [Parameter()] [Alias('n')] [uint16]$NumberOfAnswers, [Parameter()] [ValidateCount(1, 4)] [Alias('stop')] [string[]]$StopSequence, [Parameter()] [switch]$Stream = $false, [Parameter()] [ValidateRange(0, 2147483647)] [Alias('max_tokens')] [int]$MaxTokens = 2048, [Parameter()] [ValidateRange(-2.0, 2.0)] [Alias('presence_penalty')] [double]$PresencePenalty, [Parameter()] [ValidateRange(-2.0, 2.0)] [Alias('frequency_penalty')] [double]$FrequencyPenalty, [Parameter()] [Alias('logit_bias')] [System.Collections.IDictionary]$LogitBias, [Parameter()] [string]$User, [Parameter()] [bool]$Echo, [Parameter()] [Alias('best_of')] [uint16]$BestOf, [Parameter()] [int]$TimeoutSec = 0, [Parameter()] [ValidateRange(0, 100)] [int]$MaxRetryCount = 0, [Parameter()] [System.Uri]$ApiBase, [Parameter()] [string]$ApiVersion, [Parameter()] [securestring][SecureStringTransformation()]$ApiKey, [Parameter()] [ValidateSet('azure', 'azure_ad')] [string]$AuthType = 'azure', [Parameter()] [System.Collections.IDictionary]$AdditionalQuery, [Parameter()] [System.Collections.IDictionary]$AdditionalHeaders, [Parameter()] [object]$AdditionalBody ) begin { # Construct parameters $Parameters = $PSBoundParameters $Parameters.ApiType = [OpenAIApiType]::Azure $Parameters.AuthType = $AuthType $Parameters.Model = $Deployment $null = $Parameters.Remove('Deployment') # Invoke base function $steppablePipeline = { Request-TextCompletion @Parameters }.GetSteppablePipeline($myInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) } process { $steppablePipeline.Process($PSItem) } end { $steppablePipeline.End() } } |