Download the PHP package solution-forest/ai-kit-core without Composer

On this page you can find all versions of the php package solution-forest/ai-kit-core. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package ai-kit-core

ai-kit-core

PHP Laravel Laravel AI SDK License

The engine of the ai-kit suite — document ingestion, chunking, extraction, vector retrieval, and RAG agents for Laravel, built on the official Laravel AI SDK.

composer require → php artisan ai-kit:install → a grounded, cited RAG assistant over your own documents — with no external vector database required.

Why ai-kit?

Building a grounded, cited RAG chatbot over your own documents in Laravel means wiring together a dozen moving parts: parsing PDFs/Word/Excel, chunking text, generating embeddings, running a vector store, similarity search, prompt orchestration, streaming, citations, conversation history, and cost tracking.

ai-kit does all of that for you — on the official Laravel AI SDK, with no external vector database. composer require → php artisan ai-kit:install → a working, source-cited assistant in under 30 minutes. Then expose it however you like: a Livewire chat widget, an admin panel, a JSON API, a CLI, or an MCP server for AI agents.

Architecture

One core, four faces. Every surface calls the same service layer, so RAG behaviour is identical whether a user chats in the browser, you script the CLI, another service hits the API, or an AI agent connects over MCP.

Requirements

Install

The installer:

  1. Publishes config/ai-kit.php + migrations (including the AI SDK's conversation tables).
  2. Interactively asks for your AI provider config (chat + embeddings provider/model/key) and writes it to .env.
  3. Scaffolds App\Ai\SupportAgent (extends RagAgent).
  4. Runs migrations.
  5. Optionally seeds a demo knowledge base.

Then set your keys (the installer adds the scaffold; fill in the value):

Quick start

Or from the CLI:

How ingestion works

Every chunk stores its raw embedding and the embedding model name, so re-indexing with a different model is detectable and you can switch drivers without re-embedding blindly.

Supported document types

Type Extractor Notes
.txt .md .csv PlainTextExtractor
.html HtmlExtractor strips script/style/boilerplate
.pdf PdfExtractor via smalot/pdfparser
.docx WordExtractor zero-dependency (zipped XML)
.xlsx ExcelExtractor zero-dependency; extracts text cells
URL fetch + HtmlExtractor createFromUrl / ai-kit:ingest-url

Legacy binary .doc / .xls are not supported.

Two RAG modes

config('ai-kit.mode'):

Both consume the same Retriever contract.

Two vector drivers

config('ai-kit.retrieval.driver'):

Building agents

RagAgent reads config and wires the configured chat provider/model into every prompt() / stream():

Customise instructions by extending it (the installer scaffolds this):

Point AI_KIT_AGENT=App\Ai\SupportAgent at it. The default instructions are strict-grounded (search-first, refuse-if-unsupported, cite by document title).

Conversation persistence & token usage

When a prompt runs for an authenticated participant (->forUser($user) / ->continue($id, $user)), the AI SDK persists the exchange to agent_conversations / agent_conversation_messages, including per-message token usage. Aggregate it with UsageStats:

Cost is estimated from config('ai-kit.pricing') ($ per 1M tokens, per model) using the active chat model's rate.

Multi-tenancy

Every table has a nullable tenant_id. Scope models + retrieval:

Enable with AI_KIT_TENANCY=true.

Contracts (swap any layer)

Contract Default Bind your own via the container
Retriever / VectorIndex SqliteVecRetriever / PgVectorRetriever custom store
Embedder AiSdkEmbedder e.g. a local embedder
Chunker RecursiveTextChunker custom splitting
TextExtractor ExtractorManager add extractors

Configuration reference

config/ai-kit.php: mode, default_collection, agent (class + instructions), chat (provider/model/fallback/streaming), embeddings (provider/model/dimensions/cache/timeout), chunking (size/overlap), retrieval (driver/top_k/min_score/sqlite/pgvector), ingestion (queue/embed_batch), tenancy, database (connection/prefix), features (dashboard/token_usage), pricing. Every value has an env() override.

Commands

Command Purpose
ai-kit:install Publish config/migrations, configure AI providers, scaffold agent
ai-kit:demo Seed a demo collection + 3 sample docs (sync)
ai-kit:ingest {path} --collection= Ingest a file or directory
ai-kit:ingest-url {url} --collection= Fetch + ingest a web page

Headless surfaces (CLI · HTTP API · MCP)

Everything the Filament panel does is reachable without Filament. All four surfaces call the same service layer (ChatService, CollectionService, DocumentService), so behaviour is identical everywhere.

CLI

Command Purpose
ai-kit:collection {list\|new\|show\|delete} Manage knowledge bases (--json)
ai-kit:document {list\|chunks\|reindex\|delete} Manage documents (--collection, --json)
ai-kit:search {query} --collection= Raw retrieval, no LLM (--json)
ai-kit:chat {collection} Interactive grounded chat REPL
ai-kit:conversation {list\|show} Conversation log + token usage (--json)
ai-kit:stats Documents/chunks/tokens/cost (--json)

HTTP API (optional)

Enable with AI_KIT_API=true. Locked behind auth by default (config('ai-kit.api.middleware') = ['api','auth:sanctum']); set your own guard, or ['api'] for public. Prefix: AI_KIT_API_PREFIX (default api/ai-kit).

MCP server (optional)

Expose ai-kit to MCP clients (Claude Desktop, IDE agents). Requires composer require laravel/mcp, then AI_KIT_MCP=true. Tools: search_knowledge_base, ask_knowledge_base, list_collections, ingest_url. Serve over stdio:

Set AI_KIT_MCP_WEB=true to also register an HTTP transport route (config('ai-kit.mcp.web_route'), guarded by mcp.web_middleware).

Examples

HTTP API (Bearer auth by default):

MCP — point a client (e.g. Claude Desktop) at the stdio server:

Programmatic (any surface, same result):

Testing

The suite runs offline with no API keys — LLM calls use the AI SDK's fakes, embeddings use a deterministic in-memory double.

The ai-kit suite

One core, four faces — the Livewire UI, CLI, HTTP API, and MCP server all call the same service layer (ChatService, CollectionService, DocumentService), so behaviour is identical everywhere.

Package Purpose
solution-forest/ai-kit-core (this) Ingestion, retrieval, agents + CLI, HTTP API, MCP
solution-forest/ai-kit-ui-livewire Livewire 4 chat component
solution-forest/ai-kit-filament Filament v5 admin panel

ai-kit-ui-livewire and ai-kit-filament are optional; core is fully usable headless.

License

MIT © SolutionForest


All versions of ai-kit-core with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
illuminate/contracts Version ^12.0|^13.0
illuminate/database Version ^12.0|^13.0
illuminate/support Version ^12.0|^13.0
illuminate/http Version ^12.0|^13.0
illuminate/bus Version ^12.0|^13.0
laravel/ai Version ^0.9
laravel/prompts Version ^0.3.6
smalot/pdfparser Version ^2.7
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package solution-forest/ai-kit-core contains the following files

Loading the files please wait ...