Created
January 24, 2023 22:34
-
-
Save antoinefortin/55f07a7bb6a03232c0fb1e87ea13d255 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$input = $args[0] | |
Write-Host "`n[+] Promt that you entered: $input" | |
Write-Host "`n[+] Response from AI :" | |
$body = @{ | |
prompt = $input | |
model = "text-davinci-003" | |
max_tokens = 5000 | |
temperature = 1.0 | |
} | |
$headers = @{ | |
'Content-Type' = 'application/json' | |
'Authorization' = "Bearer <YOUR API KEY HERE>" | |
} | |
$jsonBody = $body | ConvertTo-Json | |
$response = Invoke-WebRequest -Uri "https://api.openai.com/v1/completions" -Method POST -Body $jsonBody -Headers $headers -ContentType 'application/json' | |
$response.Content | ConvertFrom-Json | select -ExpandProperty choices | select -ExpandProperty text |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment