Skip to content

ConvertTo OpenAIFunctionSpec

dfinke edited this page Apr 20, 2024 · 2 revisions

ConvertTo-OpenAIFunctionSpec

SYNOPSIS

Converts a PowerShell function to an OpenAI function specification.

SYNTAX

ConvertTo-OpenAIFunctionSpec [[-targetCode] <Object>] [-Compress] [-Raw] [-ProgressAction <ActionPreference>]
 [<CommonParameters>]

DESCRIPTION

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.

EXAMPLES

EXAMPLE 1

$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.

PARAMETERS

-targetCode

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: False

-Compress

Indicates 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: False

-Raw

Indicates 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

-ProgressAction

{{ Fill ProgressAction Description }}

Type: ActionPreference
Parameter Sets: (All)
Aliases: proga

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

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

OUTPUTS

NOTES

RELATED LINKS

Clone this wiki locally