Download the PHP package omniglies/laravel-rag without Composer
On this page you can find all versions of the php package omniglies/laravel-rag. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-rag
Laravel RAG Package
A complete Laravel package for implementing RAG (Retrieval-Augmented Generation) systems with external API integrations, vector databases, and a beautiful Alpine.js-powered web interface.
Features
- ๐ Plug-and-play installation - Single command setup
- ๐ค Multiple AI providers - OpenAI, Anthropic with extensible driver system
- ๐ Document processing - Text, PDF, DOCX support via external APIs
- ๐ Hybrid search - Vector similarity + keyword matching with multiple vector DB providers
- ๐จ Modern web interface - Alpine.js components with real-time updates
- ๐ Analytics & monitoring - Usage tracking, search analytics, cost monitoring
- โก Queue-based processing - Async document processing with status tracking
- ๐ง Extensive configuration - Every aspect is configurable
- ๐งช Comprehensive testing - Unit and feature tests included
Quick Start
Visit /rag in your browser and start uploading documents!
Table of Contents
- Installation
- Configuration
- Usage
- Web Interface
- API Usage
- Programmatic Usage
- External Integrations
- Console Commands
- Testing
- Architecture
- Contributing
Installation
Requirements
- PHP 8.1+
- Laravel 9.x, 10.x, or 11.x
- Database (PostgreSQL recommended for full-text search, MySQL/SQLite supported)
- Queue system (Redis/Database recommended for production)
Step 1: Install via Composer
Step 2: Install the Package
This command will:
- Publish configuration files
- Publish and run migrations
- Publish views and assets
- Display setup instructions
Step 3: Configure Environment
Add these environment variables to your .env:
Step 4: Set Up Queue Workers (Production)
Configuration
The package configuration is published to config/rag.php. Key configuration sections:
AI Providers
Vector Databases
Search Configuration
Usage
Web Interface
The package provides a complete web interface accessible at /rag:
- Dashboard: Overview of documents and processing status
- Documents: Upload, manage, and view document processing status
- Chat: AI-powered chat interface with RAG capabilities
Features
- Drag-and-drop file uploads
- Real-time processing status updates
- Vector search with similarity scores
- Source attribution in AI responses
- Responsive Alpine.js components
API Usage
The package exposes RESTful API endpoints at /api/rag/:
Upload Document
Ask Question
Search Documents
Get System Status
Programmatic Usage
Using the Facade
Using the Service
Advanced Usage
External Integrations
Document Processing API
The package supports external document processing services for advanced file format support:
Expected API interface:
POST /documents/process- Submit document for processingGET /jobs/{id}/status- Check processing statusGET /jobs/{id}/result- Get processed chunks- Webhook support for completion notifications
Vector Database Providers
Pinecone
Weaviate
Qdrant
Embedding Providers
OpenAI
Cohere
Console Commands
Installation and Setup
Document Management
Maintenance
System Status
Testing
The package includes comprehensive tests:
Test Structure
- Unit Tests: Test individual services and components
- Feature Tests: Test HTTP endpoints and integration scenarios
- Mocking: External APIs are mocked for reliable testing
Architecture
Core Components
Data Flow
- Document Upload โ Queue Processing โ External API โ Chunking โ Embeddings โ Vector Storage
- User Query โ Vector Search + Keyword Search โ Context Building โ AI Generation โ Response
Design Patterns
- Service Layer: Business logic separation
- Strategy Pattern: Pluggable AI and vector providers
- Observer Pattern: Event-driven processing updates
- Factory Pattern: Provider instantiation
- Repository Pattern: Data access abstraction
Alpine.js Components
The web interface uses Alpine.js for reactive components:
Chat Component
Upload Component
Search Component
Performance Considerations
Production Optimization
- Queue Workers: Use dedicated queue workers for document processing
- Caching: Enable Redis/Memcached for embeddings and search results
- Database: Use PostgreSQL for optimal full-text search performance
- Vector Database: Choose appropriate vector DB based on scale
- Rate Limiting: Configure API rate limits for external services
Scaling
- Horizontal Scaling: Multiple queue workers for processing
- Vector Database Sharding: Distribute vectors across multiple indexes
- CDN: Serve static assets via CDN
- Load Balancing: Distribute web requests across multiple instances
Security
API Keys
- Store all API keys in environment variables
- Use Laravel's encryption for sensitive configuration
- Rotate keys regularly
Authentication
- Configure authentication middleware for web routes
- Use API tokens for programmatic access
- Implement rate limiting for API endpoints
Data Privacy
- Documents are processed according to your AI provider's terms
- Vector embeddings do not contain original text
- Implement data retention policies
Troubleshooting
Common Issues
Document Processing Stuck
Vector Search Not Working
High API Costs
Debug Mode
Enable debug logging in config/logging.php:
Contributing
We welcome contributions! Please see CONTRIBUTING.md for details.
Development Setup
Running Tests
Changelog
Please see CHANGELOG.md for more information on what has changed recently.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Omniglies Team
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
Roadmap
- [ ] Support for more file formats (PPT, XLS, etc.)
- [ ] Built-in document OCR capabilities
- [ ] GraphQL API support
- [ ] Advanced analytics dashboard
- [ ] Multi-tenant support
- [ ] Document versioning
- [ ] Collaborative features
- [ ] Export/import capabilities
Need help? Check out our documentation or open an issue.
All versions of laravel-rag with dependencies
illuminate/support Version ^9.0|^10.0|^11.0
illuminate/database Version ^9.0|^10.0|^11.0
illuminate/http Version ^9.0|^10.0|^11.0
illuminate/queue Version ^9.0|^10.0|^11.0
illuminate/validation Version ^9.0|^10.0|^11.0
guzzlehttp/guzzle Version ^7.0
openai-php/client Version ^0.7
symfony/mime Version ^6.0|^7.0