Sapiens
Sapiens use tools to interact with the world.
Fun with chatGPT API, llm-chain and huelib (fork).
Disclaimer
This will probably try to take over the world and if it doesn't succeed, empty your bank account and kill all the remaining polar bears trying to do so.
More seriously, this code allows chatGPT-generated code to be executed, you might want to consider some sandboxing before running it on your machine.
What is this?
Not quite sure yet. See sapiens_cli/src/main.rs for my to do list.
Tools
- SandboxedPython: execute Python code in a (not so) sandboxed environment
- Hue: control Philips Hue lights: List Rooms, List Lights, Get/Set Light State - use 'hue' feature.
- Wikipedia: Query Wikipedia
- Wikidata: Query Wikidata
Usage as a Discord bot
.env file with:
OPENAI_API_KEY=...
DISCORD_TOKEN=...
GUILD_ID=...
./BUILD.sh and ./BOT.sh to build and run the docker container with the bot.
Once the bot is running, you can interact with it on Discord with: "DO: Tell me a joke.".
Usage as a CLI
.env file with:
OPENAI_API_KEY=...
HUE_USERNAME=...
HUE_BRIDGE_IP=...
Look at sapiens/src/main.rs if you don't already have these.
Then: ./BUILD.sh && ./CLI.sh.
Example of 'successful' runs
Appetizer
Antipasto
TL;DR
Commented run
$ cargo run
Compiling sapiens v0.1.0 (ssoudan/sapiens)
Warm up
[... half a decade of compilation later ...]
System:
WORLD:
Bot:
Now the real thing
WORLD:
Bot:
WORLD:
Bot:
WORLD:
Bot:
WORLD:
Bot:
WORLD:
Bot:
WORLD:
Bot:
WORLD:
Bot:
WORLD:
Bot:
Tadam:
Not bad.