PowerShell into the ChatGPT OpenAI API via REST.
- Needs Powershell 7x to work.
- A user account on chatGPT. Create one with your e-Mail address and mobile number, or use an existing microsoft or google account.
- An API-Key. Create one in your user profile and store it as secret with the name ChatGptAPI (Set-Secret) in your SecretStore. If you are not familiar with PowerShell SecretManagement, read my BlogPosts about it.
- Download (clone) my repo and run . ./CodeCompletion.ps1
The Script codecompletion contains ine CmdLet Get-AIAnswer. This posts a question to ChatCPG, receives the answer and emits it on the console. By default we use 3 additional default-parameters.
text-davinci-003 is used as standard-model, there are some more models i added as ValidateSet. You may play around with different language models.
For my understanding, tokes define how massive the output from ChatGPT is. This is especially true for code completion, a low token value may cut of emitted code. For me it seems the token value will be used as a rate limit in the future.
This value controls how different the first answer is from a second and third answer. With temperature = 0, all three answers for the same question will be identical, with temperature = 1, all answers will have maximum difference.