gridwb / laravel-mem0
Mem0 API for Laravel
Installs: 19
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/gridwb/laravel-mem0
Requires
- php: >=8.2
- guzzlehttp/guzzle: ^7.9.0
- illuminate/contracts: ^10.0||^11.0||^12.0
- spatie/laravel-data: ^4.13
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- larastan/larastan: ^2.9|^3.0
- laravel/pint: ^1.14
- orchestra/testbench: ^8.22|^9.0|^10.0
- pestphp/pest: ^2.0|^3.0
- pestphp/pest-plugin-laravel: ^2.0|^3.0
README
Laravel Mem0 is a convenient wrapper for interacting with the Mem0 API in Laravel applications.
Installation
-
Install the package
composer require gridwb/laravel-mem0
-
Publish the configuration file
php artisan vendor:publish --tag="mem0-config" -
Add environment variables
MEM0_API_URL=https://api.mem0.ai MEM0_API_KEY=your-api-key-here
Usage
use Gridwb\LaravelMem0\Facades\Mem0; $data = [ 'user_id' => 'alex', 'messages' => [ [ 'role' => 'user', 'content' => '<user-message>' ], [ 'role' => 'assistant', 'content' => '<assistant-message>' ] ] ]; $result = Mem0::memories()->addAsync($data); $result = Mem0::memories()->addSync($data); $result = Mem0::memories()->search([ 'query' => 'What do you know about me?', 'filters' => [ 'OR' => [ [ 'user_id' => 'alex', ], [ 'agent_id' => [ 'in' => [ 'travel-assistant', 'customer-support' ] ] ] ] ] ]);
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
License
The MIT License (MIT). Please see License File for more information.