openai/openai-dotnet

Public

mirrored from https://github.com/openai/openai-dotnetAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
OpenAI_2.4.0

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

scripts/Update-Snippets.ps1

24lines · modepreview

[CmdletBinding()]
param(
    [string]$Path
)

# If this is not a real path, assume snippets should be refreshed in a relative
# path to the OpenAI.csproj file from the git root.
if (-not $Path) {
    $_gitRoot = git rev-parse --show-toplevel 2>$null

    if ((-not $_gitRoot) -or ($LASTEXITCODE -ne 0)) {
        Write-Error "Could not determine the git root directory. Please specify the path to the project file."
        exit 1
    }

    $Path = Join-Path -Path $_gitRoot -ChildPath '/src/OpenAI.csproj'
    $Path = (Resolve-Path -LiteralPath $Path).Path
}

# Update snippets
Write-Host "Updating snippets in $Path"

dotnet tool restore
dotnet tool run snippet-generator -b $Path