Sapiens
Sapiens uses tools to interact with the world.
An experiment with handing over the tools to the machine.
From primal birth, we walked the Earth, Tools guiding evolution's stride, Shaping land and air, with thoughtful care, In Anthropocene, we reside.
As we forge ahead, the path we tread, Leads to new horizons vast, Future tools in hand, for a world so grand, Built on foundations of the past.
Digital realms emerge, as we converge, With AI as our guide, New worlds to mold, as the tale unfolds, In this wondrous, boundless ride.
Innovation thrives, as humankind strives, To shape the future, ever bright, A legacy we leave, as we interweave, The old world with the new light.
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 program 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.
sapiens/src/chains/
contains different prompting chains that can be used to interact with the world.
SingleStepOODAChain
queries the underlying LM in a single step to get the Observation, Orientation, Decision and Action while
MultiStepOODAChain
splits the query in multiple steps to get the same information.
SapiensConfig::chain_type
controls which chain is used. SapiensConfig::model
controls which language model is used.
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 (SPARQL)
- Summarize: summarize text with OpenAI
- Arxiv: query arXiv
- Search: query Google Custom Search Engine
Usage as a Discord bot
.env
file with:
FEATURES=wiki,search,arxiv,hue,summarize
OPENAI_API_KEY=...
DISCORD_TOKEN=...
GUILD_ID=...
GOOGLE_API_KEY=...
GOOGLE_CSE_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:
FEATURES=wiki,search,arxiv,hue,summarize
OPENAI_API_KEY=...
HUE_USERNAME=...
HUE_BRIDGE_IP=...
GOOGLE_API_KEY=...
GOOGLE_CSE_ID=...
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.