PHPackages                             obelaw/obi-laravel - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. obelaw/obi-laravel

ActiveLibrary

obelaw/obi-laravel
==================

21.1k↓50%PHP

Since Mar 4Pushed 2mo agoCompare

[ Source](https://github.com/obelaw/obi-laravel)[ Packagist](https://packagist.org/packages/obelaw/obi-laravel)[ RSS](/packages/obelaw-obi-laravel/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Obi Laravel
===========

[](#obi-laravel)

[![Obi Laravel Package](./cover.svg)](./cover.svg)

[![Packagist](https://camo.githubusercontent.com/b3db0c78a3b547d8e568755e30e43bdc26f4db3d5eb7c5aac8c9c428de83a443/68747470733a2f2f696d672e736869656c64732e696f2f7374617469632f76313f6c6162656c3d5061636b6167697374266d6573736167653d6f62656c61772f6f62692d6c61726176656c26636f6c6f723d626c7565266c6f676f3d7061636b6167697374266c6f676f436f6c6f723d7768697465)](https://packagist.org/packages/obelaw/obi-laravel)[![Packagist Version](https://camo.githubusercontent.com/8fad6007a0db0b506e140a49291da0397d8e4672bf9015e0a5de81dccfb88d56/68747470733a2f2f706f7365722e707567782e6f72672f6f62656c61772f6f62692d6c61726176656c2f76)](https://packagist.org/packages/obelaw/obi-laravel)[![Docs](https://camo.githubusercontent.com/b1ed6fe0dbff94259fc7af5eae5d48a0add9a9210c8533dc81fa68633cb00daf/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646f63732d6f6e6c696e652d677265656e)](https://devdocs.obelaw.com/packages/obi-laravel)

Obi is a Laravel package that integrates Google's Gemini function-calling with your app. Define declarations (tools) that describe callable functions, map them to your classes/methods, and let Gemini decide when to call them during a conversation.

Features
--------

[](#features)

- Gemini function calling made simple
- Declaration files with typed parameter schemas
- Multiple declaration pools (module-friendly)
- Database-backed registry of declarations
- Handy Artisan commands to make/list/build
- Simple facade: `Obi::prompt('...')`
- Optional tagging and caching

Installation
------------

[](#installation)

Install via Composer:

```
composer require obelaw/obi-laravel
```

Publish config (optional):

```
php artisan vendor:publish --tag=obi-config
```

Run migrations:

```
php artisan migrate
```

Configuration
-------------

[](#configuration)

Set environment variables in your `.env`:

```
GEMINI_API_KEY=your_api_key_here
GEMINI_MODEL=gemini-2.5-flash
OBI_CACHE_ENABLED=true
OBI_CACHE_TTL=3600
OBI_CACHE_PREFIX=obi
OBI_LOGGING_ENABLED=false
OBI_LOG_CHANNEL=stack
```

You can also configure declaration pools in `config/obi.php`:

```
'declaration_pools' => [
  base_path('declarations'),
  // base_path('modules/orders/declarations'),
],
```

Quick start
-----------

[](#quick-start)

1. Make a new declaration (you'll be prompted to pick a pool):

```
php artisan declaration:make GetOrderCount
```

1. Open the generated file and adjust parameters/targets, for example:

```
