Skip to content

Latest commit

 

History

History
116 lines (85 loc) · 3.3 KB

New-ChatCompletionFunction.md

File metadata and controls

116 lines (85 loc) · 3.3 KB
external help file Module Name online version schema
PSOpenAI-help.xml
PSOpenAI
2.0.0

New-ChatCompletionFunction

SYNOPSIS

Generate function spcifications for ChatGPT Function calling from PowerShell commands

SYNTAX

New-ChatCompletionFunction
    [-Command] <String>
    [-Description <String>]
    [-IncludeParameters <String[]>]
    [-ExcludeParameters <String[]>]
    [-ParameterSetName <String>]
    [<CommonParameters>]

DESCRIPTION

Generate function spcifications for ChatGPT Function calling from PowerShell commands
The generated function spcification is a hash table that can be converted to a JSON string following JSON Schema.
https://platform.openai.com/docs/guides/gpt/function-calling

EXAMPLES

Example 1

PS C:\> New-ChatCompletionFunction -Command "New-Item"

Generates a function definition for the New-Item command.

Example 2

PS C:\> New-ChatCompletionFunction -Command "Test-Connection" -IncludeParameters ('TargetName', 'Count', 'Delay')

Generate a function spcification for the Test-Connection command. Only three parameters are included in the function definition: TargetName, Count, and Delay.

Example 3

PS C:\> New-ChatCompletionFunction -Command "Test-NetConnection" -ParameterSetName "RemotePort" -Description "This command tests TCP connectivity of the specified hosts or address and displays the results."

Generate a function definition for the Test-NetConnection command. Explicitly specifies the parameter set name and command description.

PARAMETERS

-Command

Specify the name of the PowerShell command.

Type: String
Required: True
Position: 0

-Description

Specifies the descriptive text of the PowerShell command. If not specified, the command help description will be used.

Type: String
Required: False
Position: Named

-ExcludeParameters

Names of parameters that should not be included in the function definition.

Type: String[]
Required: False
Position: Named

-IncludeParameters

Name of the parameter to be included in the function definition. If this parameter is specified, any unspecified parameters will not be included in the function definition.

Type: String[]
Required: False
Position: Named

-ParameterSetName

If a PowerShell command has multiple parameter sets, the default parameter set is selected by default.
If you want to use a non-default parameter set, specify the set name in this parameter.

Type: String
Required: False
Position: Named

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

None

OUTPUTS

System.Collections.Specialized.OrderedDictionary

NOTES

RELATED LINKS

https://platform.openai.com/docs/guides/gpt/function-calling