PHP code example of builtbyberry / laravel-swarm-memory-vector

1. Go to this page and download the library: Download builtbyberry/laravel-swarm-memory-vector library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

builtbyberry / laravel-swarm-memory-vector example snippets


use BuiltByBerry\LaravelSwarmMemoryVector\Contracts\VectorMemoryReader;
use Illuminate\Container\Container;

protected function semanticRecall(string $query, MemoryScope $scope): string
{
    return Container::getInstance()
        ->make(VectorMemoryReader::class)
        ->search($scope, $query, limit: 5);
}
bash
php artisan vendor:publish --tag=swarm-memory-vector-config
php artisan migrate