Download the PHP package janschuri/eloquent-ai-tools without Composer
On this page you can find all versions of the php package janschuri/eloquent-ai-tools. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download janschuri/eloquent-ai-tools
More information about janschuri/eloquent-ai-tools
Files in janschuri/eloquent-ai-tools
Package eloquent-ai-tools
Short Description Give Eloquent models the ability to register themselves as AI tool sources.
License MIT
Homepage https://github.com/Janschuri/EloquentAiTools
Informations about the package eloquent-ai-tools
EloquentAiTools
Turn Eloquent models into safe, structured AI tools with a small, drop-in layer that stays inside normal Eloquent conventions.
The Problem
Giving an AI agent access to your application data usually pushes you into one of two bad options:
- Let it generate SQL. Fast to prototype, but now you are validating and sandboxing arbitrary queries.
- Hand-write tool classes around every model or operation. Safer, but full of boilerplate and easy to let drift away from your schema.
EloquentAiTools takes a third path. Instead of introducing a parallel query system, it plugs into the Eloquent models, scopes, casts, and relations you already have. You describe what a model should expose, and the package builds a read-only query tool from that config plus the model schema Laravel already knows about.
No generated SQL. No hand-maintained JSON schema. No separate tool class per model.
Installation
Requirements
- PHP
^8.3 - Laravel
^13.0 - Laravel AI SDK (
laravel/ai)^0.10
Quick Start
That exposes a read_articles tool. Its schema and description are generated from the Article config plus the active query resolvers, so the tool stays aligned with the model instead of becoming a second thing to maintain.
If you need a more specific or collision-resistant name, add a tool key:
That changes the tool name to read_cms_articles.
Out of the box, the tool supports:
- an
explainfield for query intent - reusable numeric
expressions - explicit
selectprojections, including whole-result and grouped aggregates - required
distinctcontrol for duplicate-prone relation queries - typed
wherefilters, including nested condition groups and relation existence checks groupByorderBylimitandoffset- auto-derived relation joins for supported dotted relation paths
- Eloquent scopes, so you can keep using Laravel's native way to restrict model queries
- scoped eager loading for configured relations, including nested
withpaths - scoped direct relation aggregates through
withAggregate - an optional per-model read policy callback
Documentation
The long-form docs now live in /wiki and are intended to be mirrored to the GitHub wiki on pushes to master:
- Home
- Quick Start
- Tool Configuration
- Query Reference
- Query Model
- Relation Paths And Scopes
- Policies And Approvals
- Exposed Surface
- Responses And Errors
- Caching
- Roadmap
Changelog
Releases are tagged automatically from Conventional Commits — see GitHub Releases for what changed in each version.
License
MIT
All versions of eloquent-ai-tools with dependencies
illuminate/contracts Version ^13.0
illuminate/database Version ^13.0
illuminate/json-schema Version ^13.16
illuminate/support Version ^13.0
laravel/ai Version ^0.10