Unlock the power of semantic search and intelligent information retrieval. Let your agents access vast knowledge bases and provide incredibly accurate, context-aware responses.
Think of vector memory as your agent’s superpower! It transforms text into mathematical representations that capture meaning, enabling your agent to find semantically similar content even when the exact words don’t match.
Flexible & Powerful: Choose from multiple storage providers (Meilisearch, PostgreSQL + pgvector) and embedding providers (OpenAI, Gemini, Cohere, Ollama) to fit your needs!
Semantic Search
Find content by meaning, not just keywords
Efficient Retrieval
Lightning-fast similarity searches at scale
Multiple Providers
Support for various storage and embedding providers
Configure vector memory with Meilisearch in your .env file:
.env
Copy
# Vector Memory with Meilisearch (recommended for most use cases)VIZRA_ADK_VECTOR_DRIVER=meilisearch# Choose your embedding providerVIZRA_ADK_EMBEDDING_PROVIDER=gemini # or openai, cohere, ollama# Gemini for embeddings (recommended)GEMINI_API_KEY=your-gemini-api-key# Meilisearch configurationMEILISEARCH_HOST=http://localhost:7700MEILISEARCH_KEY=your-master-keyMEILISEARCH_PREFIX=agent_vectors_# Alternative: OpenAI embeddings# VIZRA_ADK_EMBEDDING_PROVIDER=openai# OPENAI_API_KEY=your-openai-key
Alternative option: You can also use PostgreSQL + pgvector for production-scale vector similarity search. See the complete configuration reference below for setup details.
# Run migrations for vector memory tablesphp artisan migrate# For PostgreSQL, ensure pgvector extension is installedCREATE EXTENSION IF NOT EXISTS vector;
Your agents now have built-in access to vector memory! Use the convenient $this->vector() or $this->rag() methods directly within your agent.New! These methods are now public, so you can also access them externally for testing: $agent->vector()->addDocument(...)
class DocumentationAgent extends BaseLlmAgent{ protected string $name = 'documentation_agent'; public function storeKnowledge(string $content, array $metadata = []): void { // Simple string content with optional metadata $this->vector()->addDocument($content, $metadata); // Or use array format for full control $this->vector()->addDocument([ 'content' => $content, 'metadata' => $metadata, 'namespace' => 'docs', 'source' => 'user-upload' ]); } public function searchKnowledge(string $query): array { // Simple search with default settings return $this->rag()->search($query); // Or with custom limit return $this->rag()->search($query, 10); // Or full control with array return $this->rag()->search([ 'query' => $query, 'limit' => 5, 'threshold' => 0.7, 'namespace' => 'docs' ]); }}
Both $this->vector() and $this->rag() return a proxy that automatically injects your agent class. No need to pass agent names anymore!Simplified API: Use simple strings for basic operations, or arrays for full control with progressive disclosure!
For advanced use cases outside of agent contexts, you can still use the VectorMemoryManager directly:
Direct VectorMemoryManager Usage
Copy
use Vizra\VizraADK\Services\VectorMemoryManager;use App\Agents\DocumentationAgent;$vectorManager = app(VectorMemoryManager::class);// Simple usage with agent class$memories = $vectorManager->addDocument( DocumentationAgent::class, 'Vizra ADK is a Laravel package for building AI agents...', ['category' => 'overview']);// Or with full options$memories = $vectorManager->addDocument( DocumentationAgent::class, [ 'content' => 'Vizra ADK is a Laravel package...', 'metadata' => [ 'category' => 'overview', 'version' => '1.0' ], 'namespace' => 'docs', 'source' => 'overview-page' ]);
class ManagedKnowledgeAgent extends BaseLlmAgent{ protected string $name = 'managed_agent'; /** * Clear all memories in a namespace */ public function clearNamespace(string $namespace = 'default'): int { // Simple: just the namespace name return $this->vector()->deleteMemories($namespace); // Advanced: with array for consistency return $this->vector()->deleteMemories(['namespace' => $namespace]); } /** * Remove memories from a specific source */ public function removeSource(string $source, string $namespace = 'default'): int { // Simple: source only (uses default namespace) return $this->vector()->deleteMemoriesBySource($source); // Common: source with namespace return $this->vector()->deleteMemoriesBySource($source, $namespace); // Advanced: full array control return $this->vector()->deleteMemoriesBySource([ 'source' => $source, 'namespace' => $namespace ]); } /** * Get memory usage statistics */ public function getMemoryStats(string $namespace = 'default'): array { // Simple: default namespace $stats = $this->vector()->getStatistics(); // Specific namespace $stats = $this->vector()->getStatistics($namespace); // Advanced: with array $stats = $this->vector()->getStatistics(['namespace' => $namespace]); return $stats; } /** * Example: External testing access (new public methods!) */ public function demonstrateExternalAccess(): void { // These methods are now PUBLIC - can be called externally! // Perfect for Tinkerwell testing: $agent = Agent::named('managed_agent'); $result = $agent->vector()->addDocument('Test content'); $search = $agent->rag()->search('test query'); }}
High-performance vector similarity search with native PostgreSQL integration.
Setup
Copy
# Install pgvector extensionCREATE EXTENSION IF NOT EXISTS vector;# Configure in .envVIZRA_ADK_VECTOR_DRIVER=pgvectorDB_CONNECTION=pgsql
Meilisearch
Lightning-fast, typo-tolerant search engine with built-in vector support.
Setup
Copy
# Configure for MeilisearchVIZRA_ADK_VECTOR_DRIVER=meilisearchMEILISEARCH_HOST=http://localhost:7700MEILISEARCH_KEY=your-master-keyMEILISEARCH_PREFIX=agent_vectors_
Fallback Behavior - When neither pgvector nor Meilisearch are available, Vizra ADK automatically falls back to cosine similarity calculation using your database. This works with any driver but is best for development or small datasets.