gitmyhub

ai-kit-core

PHP ★ 2 updated 7d ago

ai-kit core — Laravel RAG toolkit: ingestion, chunking, extraction, vector retrieval (sqlite-vec + pgvector), and agents on the Laravel AI SDK.

A PHP add-on for Laravel that builds a chatbot which answers questions from your own documents by searching them first and grounding AI responses in your content with citations.

PHPLaravelSQLitepgvectorOpenAIAnthropicGeminisetup: moderatecomplexity 3/5

ai-kit-core is a PHP package for Laravel that lets you build a chatbot which answers questions using your own documents. Instead of sending a user's question to an AI model that has no knowledge of your data, this tool first searches your uploaded files for relevant passages, then feeds those passages to the model so its answers are grounded in your actual content and can cite specific sources. The package calls this approach RAG, which stands for retrieval-augmented generation.

The installation process is straightforward. You run a couple of commands and the package sets up a configuration file, creates the needed database tables, and scaffolds a basic assistant. You then add your AI provider credentials, such as an OpenAI API key, and you can start ingesting documents. The tool can process PDFs, Word files, Excel spreadsheets, HTML pages, Markdown, plain text, and web URLs. It extracts the text, breaks it into smaller chunks, generates a mathematical representation of each chunk called an embedding, and stores those in a database for later searching.

When a user asks a question, the system searches the stored chunks for the most relevant content. It offers two modes for this. In tool mode, the AI model itself decides when to search and what to look for, which supports more complex multi-step questions. In inject mode, the system always retrieves relevant context and includes it in the prompt before the model responds, which works better with smaller or less capable models.

For storage, you can use SQLite for simple setups with no extra infrastructure, or pgvector for production scale with millions of documents. The package tracks token usage and estimated costs per conversation, and it works with multiple AI providers including OpenAI, Anthropic, Gemini, and others. It requires PHP 8.3 or newer and Laravel 12 or 13. The full README is longer than what was shown.

Where it fits