| external help file | PSOpenAI-help.xml |
|---|---|
| Module Name | PSOpenAI |
| online version | https://github.com/mkht/PSOpenAI/blob/main/Docs/Request-TextCompletion.md |
| schema | 2.0.0 |
Creates a completion for the provided prompt and parameters.
Request-TextCompletion
[[-Prompt] <String[]>]
[-Suffix <String>]
[-Model <String>]
[-Temperature <Double>]
[-TopP <Double>]
[-NumberOfAnswers <UInt16>]
[-Stream]
[-StopSequence <String[]>]
[-MaxTokens <Int32>]
[-PresencePenalty <Double>]
[-FrequencyPenalty <Double>]
[-LogitBias <IDictionary>]
[-User <String>]
[-Echo <Boolean>]
[-BestOf <UInt16>]
[-AsBatch]
[-CustomBatchId <String>]
[-TimeoutSec <Int32>]
[-MaxRetryCount <Int32>]
[-ApiBase <Uri>]
[-ApiKey <Object>]
[-Organization <String>]
[<CommonParameters>]
Given a prompt, the AI model will return one or more predicted completions.
https://developers.openai.com/api/docs/guides/completions/
Request-TextCompletion -Prompt 'This is a hamburger store.' | select AnswerWe serves
-classic hamburgers
-tofu burgers
(Required) The prompt(s) to generate completions for
Type: String[]
Aliases: Message
Required: False
Position: 1
Accept pipeline input: True (ByValue)The suffix that comes after a completion of inserted text.
Type: String
Required: False
Position: NamedThe name of model to use.
The default value is gpt-3.5-turbo-instruct.
Type: String
Required: False
Position: Named
Default value: gpt-3.5-turbo-instructWhat sampling temperature to use, between 0 and 2.
Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.
Type: Double
Required: False
Position: NamedAn alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass.
So 0.1 means only the tokens comprising the top 10% probability mass are considered.
Type: Double
Aliases: top_p
Required: False
Position: NamedHow many texts to generate for each prompt.
The default value is 1.
Type: UInt16
Aliases: n
Required: False
Position: Named
Default value: 1Whether to stream back partial progress.
Type: System.Management.Automation.SwitchParameter
Required: False
Position: Named
Default value: FalseUp to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence.
Type: String[]
Aliases: stop
Required: False
Position: NamedThe maximum number of tokens allowed for the generated answer.
The max value depends on models.
Type: Int32
Aliases: max_tokens
Required: False
Position: Named
Default value: 2048Number between -2.0 and 2.0.
Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.
Type: Double
Aliases: presence_penalty
Required: False
Position: NamedNumber between -2.0 and 2.0.
Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.
Type: Double
Aliases: frequency_penalty
Required: False
Position: NamedFor custom model or deployment names that do not identify a known tokenizer, supply integer token IDs for the actual model. PSOpenAI does not infer a tokenizer from an Azure deployment name.
Modify the likelihood of specified tokens appearing in the completion.
Accepts a maps of tokens to an associated bias value from -100 to 100.
Type: IDictionary
Aliases: logit_bias
Required: False
Position: NamedA unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse.
Type: String
Required: False
Position: NamedEcho back the prompt in addition to the completion.
The default value is $false.
Type: Boolean
Required: False
Position: Named
Default value: $falseGenerates best_of completions server-side and returns the "best" (the one with the highest log probability per token).
Type: UInt16
Aliases: best_of
Required: False
Position: NamedIf this is specified, this cmdlet returns an object for Batch input
It does not perform an API request to OpenAI. It is useful with Start-Batch cmdlet.
Type: SwitchParameter
Required: False
Position: Named
Default value: FalseA unique id that will be used to match outputs to inputs of batch. Must be unique for each request in a batch.
This parameter is valid only when the -AsBatch swicth is used. Otherwise, it is simply ignored.
Type: String
Required: False
Position: NamedSpecifies how long the request can be pending before it times out.
The default value is 0 (infinite).
Type: Int32
Required: False
Position: Named
Default value: 0Number between 0 and 100.
Specifies the maximum number of retries if the request fails.
The default value is 0 (No retry).
Note : Retries will only be performed if the request fails with a 429 (Rate limit reached) or 5xx (Server side errors) error. Other errors (e.g., authentication failure) will not be performed.
Type: Int32
Required: False
Position: Named
Default value: 0Specifies an API endpoint URL such like: https://your-api-endpoint.test/v1
If not specified, it will use https://api.openai.com/v1
Type: System.Uri
Required: False
Position: Named
Default value: https://api.openai.com/v1Specifies API key for authentication.
The type of data should [string] or [securestring].
If not specified, it will try to use $global:OPENAI_API_KEY or $env:OPENAI_API_KEY
Type: Object
Required: False
Position: NamedSpecifies Organization ID which used for an API request.
If not specified, it will try to use $global:OPENAI_ORGANIZATION or $env:OPENAI_ORGANIZATION
Type: string
Aliases: OrgId
Required: False
Position: Namedhttps://developers.openai.com/api/docs/guides/completions/
https://developers.openai.com/api/reference/resources/completions/methods/create/