AI agents written in PHP.
- PHP 8.1 or above
- Composer
- An OpenAI API key
git clone git@github.com:ruscoe/php-ai-agents.git
cd php-ai-agents
composer install
These agents require you store your API key in an environment variable. To do this on a Linux or MacOS system, run:
export OPENAI_API_KEY=sk-XA0yN...
Be sure to substitute your own API key after OPENAI_API_KEY=
.
Tells a joke.
Usage: php joke-agent.php <topic>
php joke-agent.php cars
"Why did the car apply for a job? It wanted to 'drive' the company forward!"
Tells a fortune.
Usage: php fortune-agent.php
"Ah, I see you're curious about what the future holds for you. As I gaze into the realm of possibilities, I sense a season of transformation approaching. Soon, you'll encounter an unexpected opportunity that will allow you to pursue something you're passionate about. Trust your instincts and be open to new experiences, as they will guide you to personal growth and fulfillment. Remember, the path may not always be clear, but each step you take will illuminate the way forward. Keep a positive mindset, and embrace the journey ahead."
Generates a Don Quixote-style quote.
Usage php quixote-agent.php
"A valiant heart, clad in the armor of steadfast dreams, charts its course through the winds of folly, defying the mundane world for the honor of lost chivalry."