nextmove / ai
1.1.3
2024-05-21 13:11 UTC
Requires
- guzzlehttp/guzzle: >=7.0
- illuminate/http: >=8.0
- illuminate/support: >=8.0
Requires (Dev)
- laravel/pint: ^1.15
- orchestra/testbench: >=6.0
- pestphp/pest: ^2.34
README
将 AI 添加到您的 Laravel 应用程序的最简单方法,使用 OpenAI 或 Gemini。
$fruits = AI::ask('Give me a JSON array with three fruits');
1. 安装
composer require nexxtmove/ai
2. 将您的 API 密钥添加到 .env
AI_DRIVER=openai OPENAI_API_KEY=sk-...
3. 提出问题
use Nexxtmove\AI; $summary = AI::ask("Summarize this article: {$article}");
这就完成了!
想了解更多?请查看 指南。