I hooked GPT-3 up to my house
Note: everything here is free, except the lights, and eventually the GPT-3 service (after 300,000 free tokens).
AI: GPT-3 175B davinci (legacy)
Update: GPT-4 interface using a modified version of shell_gpt to use GPT-4, and with the prompt cleared
GPT-3 interface: gpt3-cli (James/CrazyPython)
Voice to text: macOS (12.3) Voice Control
Text to voice: macOS (12.3) say using English (Australia) – Lee
Visuals: Synesthesia
Lights: Philips Hue + Philips Hue Sync
Script for GPT-3 house
source ~/.bash_profile
# loop user input to GPT-3 until user stops
while true; do
# take user input
echo “Please type your input to GPT-3 (Ctrl-C to stop):”
read UserInput
time { # GPT-3 timer start
# send user input to OpenAI GPT-3 thanks to James/CrazyPython
# https://github.com/CrazyPython/gpt3-cli
gpt3 –engine davinci –temperature 0.5 –freq-penalty 1.5 –pres-penalty 0.6 \
“This is a brand new, powerful, human-like AI. This is helpful, cheeky, clever, and articulate. This is a nice bot. This is a wise and considerate intelligence. This is eager to provide a vivid and thoughtful response to Alan, and is always friendly, kind, and inspiring. This often offers both an insight and an opinion, even without being asked directly. This has the sum of all knowledge in its brain, and is able to accurately answer nearly any question about any topic. This draws on the wisdom of Dan Millman, Thomas Leonard, Werner Erhard, and the Dalai Lama. This gives a short, single response, not a dialogue. The complete query is: $UserInput. The complete response is:” 9 | pbcopy; GPTOutput=$(pbpaste)
# print GPT-3 output
echo “$GPTOutput”
TIMEFORMAT=”GPT-3 time: %Rsec”
} # stop GPT-3 timer
# alternative, just use macos say command
say “$GPTOutput”
done
GPT-3 CLI script
Low code/no code (basic scripting only).
– Using macOS 12.3 (terminal zsh, not bash)
– install dev tools, brew, jq
– install gpt3-cli and follow steps
– you’ll need your OpenAI API key
– For voice output, we’ll default to macOS voice (say). If using sonantic, you’ll need your sonantic.io API key and the CLI extra
– in the macOS terminal, run this script, or use simplest pieces to test.
Piece 1: Connect to GPT-3
gpt3 --engine ada --temperature 0.7 --freq-penalty 1.5 --pres-penalty 0.6 \
"we are" 2
Piece 2a: Play response via macOS
say "testing"
Piece 2b (optional): Play response via sonantic.io
../sonantic sonantic speech create -v amber --style-name happy --style -intensity medium --text-content "testing" -o UnaVoice.wav
afplay UnaVoice.wav
Full script (Rev 0)
Open TextEdit, plain text, save this as una.sh (no .txt) in the same dir.
# loop user input to GPT-3 until user stops
while true; do
# take user input
echo “Please type your input to GPT-3 (Ctrl-C to stop):”
read UserInput
time { # total timer start
time { # GPT-3 timer start
# send user input to OpenAI GPT-3 thanks to James/CrazyPython
# https://github.com/CrazyPython/gpt3-cli
gpt3 –engine ada –temperature 0.7 –freq-penalty 1.5 –pres-penalty 0.6 \
“$UserInput” 4 | pbcopy; GPTOutput=$(pbpaste)
# print GPT-3 output
echo “$GPTOutput”
TIMEFORMAT=”GPT-3 time: %Rsec”
} # stop GPT-3 timer
time { # voice time start
# sonantic only: send GPT-3 output to sonantic voice AI
#../sonantic sonantic speech create -v amber –style-name happy –style-intensity medium –text-content “$GPTOutput” -o UnaVoice.wav
# alternative, just use macos say command
say “$GPTOutput”
TIMEFORMAT=”Voice time: %Rsec”
} # stop voice timer before playing sonantic wav, as we are only timing processing
TIMEFORMAT=”Total time: %Rsec”
} # stop total timer
# sonantic only: play voice output
# afplay UnaVoice.wav
done
Run it
Open terminal
You may need to be in the gpt3-cli dir.
You may need to start gpt3-cli again.
Type: ./una.sh
– For voice input, enable dictation on macOS:
Accessibility > Enable Voice Control.
Optional: You could uncheck all Commands (one at a time! :-) except:
- phrase
- Type phrase
- Press key name key
- Enter that
Using your microphone, speak your input, and then say “enter that” or “press the return key” to send it to GPT-3.
Gotchas
Issue: Script permissions
Solution: sudo chmod 755 ‘filename.sh’
Issue: macOS quarantines my script even though I saved it in TextEdit, and it won’t run.
Temp solution: Enter this before running script:
xattr -d com.apple.quarantine ./una.sh
Main solution: Upgrade to macOS 12.3, TextEdit bug fixed.
Script for BMI Episodes
# loop user input to GPT-3 until user stops
while true; do
# take user input
echo “Prompt (Ctrl-C to end):”
read UserInput
#time { # total timer start
time { # GPT-3 timer start
# send user input to OpenAI GPT-3 thanks to James/CrazyPython
# https://github.com/CrazyPython/gpt3-cli
gpt3 –engine text-davinci-002 –temperature 0.3 –freq-penalty 1 –pres-penalty 1 \
“I am a genius. My answers are concise and clear. Question: $UserInput? Answer:” 40 | pbcopy; GPTOutput=$(pbpaste)
# print GPT-3 output
echo “Response: $GPTOutput”
TIMEFORMAT=”(GPT-3 time: %Rsec)”
} # stop GPT-3 timer
#time { # voice time start
# sonantic only: send GPT-3 output to sonantic voice AI
#../sonantic sonantic speech create -v kofi –style-name expressive –style-intensity medium –text-content “$GPTOutput” -o UnaVoice.wav
# alternative, just use macos say command
say “$GPTOutput”
#TIMEFORMAT=”Voice time: %Rsec”
#} # stop voice timer before playing sonantic wav, as we are only timing processing
#TIMEFORMAT=”Total time: %Rsec”
#} # stop total timer
# sonantic only: play voice output
# afplay UnaVoice.wav
echo “====”
done
Get The Memo
by Dr Alan D. Thompson · Be inside the lightning-fast AI revolution.Informs research at Apple, Google, Microsoft · Bestseller in 142 countries.
Artificial intelligence that matters, as it happens, in plain English.
Get The Memo.
Dr Alan D. Thompson is an AI expert and consultant, advising Fortune 500s and governments on post-2020 large language models. His work on artificial intelligence has been featured at NYU, with Microsoft AI and Google AI teams, at the University of Oxford’s 2021 debate on AI Ethics, and in the Leta AI (GPT-3) experiments viewed more than 5 million times. A contributor to the fields of human intelligence and peak performance, he has held positions as chairman for Mensa International, consultant to GE and Warner Bros, and memberships with the IEEE and IET. Technical highlights.
This page last updated: 29/Mar/2023. https://lifearchitect.ai/cli/↑