Public/Request-CodeCompletion.ps1
function Request-CodeCompletion { [CmdletBinding()] [OutputType([pscustomobject])] param ( [Parameter(Position = 0, ValueFromPipeline = $true)] [ValidateNotNullOrEmpty()] [Alias('Message')] [string[]]$Prompt, [Parameter()] [string]$Suffix, [Parameter()] [string]$Model = 'code-davinci-002', [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()] [ValidateRange(0, 4096)] [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()] [string]$User, [Parameter()] [bool]$Echo, [Parameter()] [Alias('best_of')] [uint16]$BestOf, [Parameter()] [int]$TimeoutSec = 0, [Parameter()] [object]$Token ) # Just call the Request-TextCompletion with 'code-davinci-002' model. $CodeCompletionParam = $PSBoundParameters if (-not $PSBoundParameters.ContainsKey('Model')) { $CodeCompletionParam.Model = $Model } Request-TextCompletion @CodeCompletionParam } |