lemukarram/laravel-ai-rag 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

lemukarram/laravel-ai-rag

Composer 安装命令:

composer require lemukarram/laravel-ai-rag

包简介

The Ultimate Laravel AI RAG Package. Seamlessly integrate Vector Search with GPT-5.5, Gemini 2.5, and Claude 4.6. Advanced semantic search for Eloquent models.

README 文档

README

Latest Version on Packagist Total Downloads License

Laravel AI RAG is the ultimate developer toolkit for building production-ready Retrieval-Augmented Generation (RAG) applications. It seamlessly bridges your Eloquent models with cutting-edge Vector Databases and Frontier LLMs like GPT-5.5, Gemini 2.5, and Claude 4.6.

🛠️ Detailed Installation Guide

1. Requirements

  • PHP 8.2 or higher
  • Laravel 10.x, 11.x, or 12.x
  • A vector store account (Upstash, Pinecone, or a local Chroma instance)

2. Install via Composer

composer require lemukarram/laravel-ai-rag

3. Publish Configuration

Publish the vector-search.php config file to your application:

php artisan vendor:publish --provider="LeMukarram\VectorSearch\VectorSearchServiceProvider"

⚙️ Exhaustive Configuration Reference

Open config/vector-search.php to manage your environment.

📂 Vector Store Settings

Driver Env Variable Description
Global VECTOR_STORE Default store to use (upstash, pinecone, chroma)
Upstash UPSTASH_VECTOR_URL Your Upstash Vector REST URL
Upstash UPSTASH_VECTOR_TOKEN Your Upstash REST Token
Pinecone PINECONE_API_KEY Your Pinecone API Key
Pinecone PINECONE_HOST The index host (e.g., https://index-xyz.svc.pinecone.io)
Chroma CHROMA_HOST Hostname (Default: 127.0.0.1)
Chroma CHROMA_PORT Port (Default: 8000)
Chroma CHROMA_COLLECTION Collection name (Default: laravel-rag)

🧠 AI Model Settings

Provider Env Variable Description
OpenAI OPENAI_API_KEY Your OpenAI Secret Key
Gemini GEMINI_API_KEY Your Google AI (Gemini) API Key
Anthropic ANTHROPIC_API_KEY Your Anthropic API Key
DeepSeek DEEPSEEK_API_KEY Your DeepSeek API Key

⚡ RAG Logic & Chunking

Configure these in the rag array of your config file:

  • chunk_size: Maximum characters per vector (Default: 1000)
  • chunk_overlap: Character overlap between chunks (Default: 200)
  • system_prompt: The core instruction for the LLM. Supports {{context}} and {{query}} placeholders.

🚀 Pro Use Cases & Examples

Use Case 1: Intelligent Documentation Search

Index your technical docs and allow users to ask questions.

// In your Model
public function getVectorColumns(): array {
    return ['title', 'body', 'version_tag'];
}

// In your Controller
$answer = VectorSearch::whereMetadata('version_tag', 'v3.0')
    ->chat('How do I configure the new hybrid search?');

Use Case 2: AI-Powered E-commerce Product Recommendations

Find products not just by name, but by "vibe" or semantic description.

// Search for "summer vibe outdoor clothes"
$products = VectorSearch::withStore('pinecone') // Use high-performance index
    ->similar('Lightweight breathable clothing for hiking', topK: 10);

Use Case 3: Legal/Medical Document Analysis

Use Claude 4.6 for high-precision reasoning over complex text.

$analysis = VectorSearch::withModel('anthropic')
    ->chat('Summarize the liability clauses in the retrieved contracts.');

Use Case 4: Global Support Bot (Multi-Query Expansion)

When users ask vague questions, use multiQuery to find better answers.

// Automatically generates 3 variations of the user's query
$results = VectorSearch::multiQuery('Payment failed'); 

🧪 Testing

use LeMukarram\VectorSearch\Facades\VectorSearch;

public function test_it_works()
{
    $fake = VectorSearch::fake();
    $fake->pushChatResponse('Laravel AI RAG is awesome!');

    $response = VectorSearch::chat('What is this package?');
    
    $this->assertEquals('Laravel AI RAG is awesome!', $response->content());
}

📈 Search Performance & SEO Tips

Keywords: Laravel AI, Vector Search Laravel, RAG Laravel, GPT-5 Laravel, Gemini AI Laravel, PHP AI Package, Semantic Search PHP, Pinecone Laravel, Upstash Vector Laravel, AI Embedding Laravel.

🤝 Support & License

If you find this package useful, please star the repository on GitHub! Licensed under the MIT License.

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 9
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 9
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-02

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固