-
Notifications
You must be signed in to change notification settings - Fork 29
ConvertTo OpenAIFunctionSpec
Converts a PowerShell function to an OpenAI function specification.
ConvertTo-OpenAIFunctionSpec [[-targetCode] <Object>] [-Compress] [-Raw] [-ProgressAction <ActionPreference>]
[<CommonParameters>]
The ConvertTo-OpenAIFunctionSpec function takes a PowerShell function as input and returns an OpenAI function specification. The function specification includes the function name, description, and parameter information.
$functionCode = Get-Content -Path "C:\MyFunction.ps1" -Raw
PS C:\> ConvertTo-OpenAIFunctionSpec -targetCode $functionCode -Compress
This example reads the contents of a PowerShell function file, converts the function to an OpenAI function specification, and returns the specification as compressed JSON.
The PowerShell function to convert to an OpenAI function specification.
Type: Object
Parameter Sets: (All)
Aliases:
Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseIndicates whether to compress the output JSON.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseIndicates whether to return the raw function specification object instead of JSON.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False{{ Fill ProgressAction Description }}
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.