PHPackages                             wiserwebsolutions/laravel-lobbyist-ai - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. wiserwebsolutions/laravel-lobbyist-ai

ActiveLibrary

wiserwebsolutions/laravel-lobbyist-ai
=====================================

AI layer for laravel-lobbyist: summarize, classify, and ask questions about legislative data with the Laravel AI SDK.

02PHP

Since Jul 13Pushed 1mo agoCompare

[ Source](https://github.com/WiserWebSolutions/laravel-lobbyist-ai)[ Packagist](https://packagist.org/packages/wiserwebsolutions/laravel-lobbyist-ai)[ RSS](/packages/wiserwebsolutions-laravel-lobbyist-ai/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel Lobbyist — AI
=====================

[](#laravel-lobbyist--ai)

An optional AI layer for [`wiserwebsolutions/laravel-lobbyist`](https://github.com/wiserwebsolutions/laravel-lobbyist), built on the first-party [Laravel AI SDK](https://laravel.com/ai) (`laravel/ai`). It **summarizes** and **classifies** bills, answers natural-language questions with a tool-using **agent**, and provides **semantic search** over an indexed bill corpus — all on top of the existing `Lobbyist::state(...)` driver surface.

It is a *consumer* of the Lobbyist drivers (not a driver itself), so core stays dependency-free.

Installation
------------

[](#installation)

```
composer require wiserwebsolutions/laravel-lobbyist-ai
php artisan vendor:publish --tag=lobbyist-ai-config
php artisan vendor:publish --tag=lobbyist-ai-migrations
php artisan migrate
```

Requires Laravel 13 (for `laravel/ai`) and at least one Lobbyist driver (`laravel-lobbyist-legiscan` and/or `laravel-palegis`).

### Configuration

[](#configuration)

By default this package defers entirely to your `laravel/ai` configuration (`config/ai.php`) — text (summaries, classification, Q&amp;A) uses `ai.default`, embeddings use `ai.default_for_embeddings`, and each uses that provider's own default model. Set up `laravel/ai` as normal and this package follows suit.

To point this package at a *different* provider than the rest of your app (without changing your `ai.default`), override it here:

```
LOBBYIST_AI_TEXT_PROVIDER=anthropic
LOBBYIST_AI_EMBED_PROVIDER=openai
LOBBYIST_AI_EMBED_DIMENSIONS=1536
```

See `config/lobbyist-ai.php` for cache and RAG options.

Usage
-----

[](#usage)

```
use WiserWebSolutions\Lobbyist\Ai\Facades\LobbyistAi;
use WiserWebSolutions\Lobbyist\Facades\Lobbyist;

// Summaries (structured: headline / summary / key_points), cached.
$bill = Lobbyist::state('CA')->bill('AB1');
$summary = LobbyistAi::summarizeBill($bill);

// Classification (controlled subjects + tags + impact).
$tags = LobbyistAi::classifyBill($bill);

// Natural-language Q&A — the agent calls the driver tools to get the facts.
$answer = LobbyistAi::ask('What education bills are moving in PA this session?', 'PA');

// Semantic search (after indexing).
$matches = LobbyistAi::search('cursive handwriting in schools', 'PA');
```

### Semantic search / RAG

[](#semantic-search--rag)

Index a state's bills (incremental — unchanged bills are skipped):

```
php artisan lobbyist-ai:index PA
```

Embeddings are stored via a **pluggable `EmbeddingStore`**. The default `database`store keeps vectors in your default database connection and scores cosine similarity in PHP — **no Postgres/pgvector required**. For large corpora, bind a vector-native implementation of `WiserWebSolutions\Lobbyist\Ai\Contracts\EmbeddingStore` instead.

Capabilities &amp; the driver contract
--------------------------------------

[](#capabilities--the-driver-contract)

The Q&amp;A agent's tools guard every call with the driver's `supports(Capability)` check, so it degrades honestly: if a state's driver can't list votes or look up a bill by id, the tool says so rather than inventing an answer.

Testing
-------

[](#testing)

Tests use the Laravel AI SDK's fakes (`Ai::fakeAgent`, `Ai::fakeEmbeddings`) and a fake Lobbyist driver, so they never hit the network:

```
composer install
vendor/bin/phpunit
```

License
-------

[](#license)

MIT © Daniel Wiser

###  Health Score

20

—

LowBetter than 12% of packages

Maintenance60

Regular maintenance activity

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/e3b045b66d2ab5c78da1cb707f906fd94c5d804382728dcdb94187e85676485d?d=identicon)[danswiser](/maintainers/danswiser)

---

Top Contributors

[![danswiser](https://avatars.githubusercontent.com/u/6931029?v=4)](https://github.com/danswiser "danswiser (3 commits)")

### Embed Badge

![Health badge](/badges/wiserwebsolutions-laravel-lobbyist-ai/health.svg)

```
[![Health](https://phpackages.com/badges/wiserwebsolutions-laravel-lobbyist-ai/health.svg)](https://phpackages.com/packages/wiserwebsolutions-laravel-lobbyist-ai)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
