The Grok AI package seamlessly integrates Grok AI into Laravel applications with an elegant, developer-friendly package. Leverage powerful AI models for chat, automation, and NLP while maintaining Laravel's expressive simplicity.
use GrokPHP\Laravel\Facades\GrokAI;use GrokPHP\Client\Config\ChatOptions;use GrokPHP\Client\Enums\Model; $response = GrokAI::chat( [['role' => 'user', 'content' => 'Hello Grok!']], new ChatOptions(model: Model::GROK_2)); echo $response['choices'][0]['message']['content'];
You can also enable real-time responses using stream: true
:
$response = GrokAI::chat( [['role' => 'user', 'content' => 'Tell me a story']], new ChatOptions(model: Model::GROK_2, stream: true));
Main Features
- Seamless Laravel Integration: Effortlessly incorporates Grok AI into Laravel applications, preserving Laravel's expressive simplicity.
- Access to Powerful AI Models: Utilize advanced AI models for tasks such as chat, automation, and natural language processing (NLP).
- Developer-Friendly Configuration: Provides an intuitive setup process with customizable options to suit various application needs.
- Streaming Responses: Supports real-time data streaming for efficient and responsive AI interactions.
- Comprehensive Testing Tools: Includes built-in testing utilities to ensure reliable and maintainable AI integrations.
- Security Best Practices: Implements robust security measures to protect AI functionalities within your application.
- Open-Source License: Distributed under the MIT license, allowing for flexible use and contribution.
The GrokAI Laravel package is on GitHub: github.com/grok-php/laravel
You can install this package in your Laravel project using Composer:
composer require grok-php/laravelphp artisan grok:install