Using ChatGPT from a Mac OS terminal
I recently understood the term tinker, making me think I like tinkering. So I made a CLI tool to access chat GPT directly from my command line. As we know, ChatGPT has been making headlines and taking discussions to the next level. And I personally also liked many of their outputs.
You can access the GitHub repo here.
We have used this great library to connect to the openAI API
https://github.com/sashabaranov/go-openai
That brings us a friendly interface to connect to the API without knowing all the parameters, configurations, etc., the openAI requires for work.
We use the method createChatCompletion and the model openai.GPT3Dot5Turbo as our configuration.
The official definition for this model is the following
A set of models that improve on GPT-3 and can understand as well as generate natural language or code
There are more options to choose
- DALL-E
- Whisper
- Codex
- etc
https://platform.openai.com/docs/models/overview
All or at least most of them are available in the library.
Steps for Installation:
brew tap dash2701/dash2701
brew install dash2701/dash2701/chatgptdash
We need to generate a token from Open AI to use this from the command line. For example, the secret Key can be generated here. Then the environment variable "OPENAI_TOKEN" can be set here.
export OPENAI_TOKEN="Your Secret Key"
It's now ready to use. Type the following command and press enter.
chatgptdash
Example: