scott/laravel-gemini

A php package for Gemini ai

v1.0.1 2023-12-20 13:54 UTC

This package is auto-updated.

Last update: 2024-05-04 21:45:31 UTC


README

Latest Version on Packagist GitHub Tests Action Status Total Downloads

This package provides a simple way to use the Gemini API in your Laravel applications. The Laravel Gemini package provides a convenient interface for interacting with the Gemini API to generate text based on a given prompt. This documentation outlines how to use the GeminiAi class, its methods, and configuration.

Get Started

Requires PHP 8.1+

First, install GeminiAI via the Composer package manager:

Installation

You can install the package via composer:

composer require scott/laravel-gemini

Configuration

The Laravel Gemini package can be configured using environment variables. The following environment variables are available:

This will create a config/gemini.php configuration file in your project, which you can modify to your needs using environment variables. Blank environment variables for the Google gemini API key and organization id are already appended to your .env file.

GOOGLE_GEMINI_API_KEY=

You can publish the config file with:

php artisan vendor:publish --provider="Scott\LaravelGemini\LaravelGeminiServiceProvider" --tag="laravel-gemini-config"

Usage

To use the Laravel Gemini package for text generation, follow these steps:

  1. Create a new instance of Gemini AI:
use Scott\LaravelGemini\GeminiAi;
$prompt = GeminiAi::models('gemini-pro')
    ->generateText('I am a web developer');
  1. Call the generateText method:
echo $prompt;

Testing

composer test

Security

If you discover any security related issues, please email tresorkasendat@gmail.com instead of using the issue tracker.

Credits