fr3on/laravel-sage 问题修复 & 功能扩展

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

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

fr3on/laravel-sage

最新稳定版本:0.0.1

Composer 安装命令:

composer require fr3on/laravel-sage

包简介

A drop-in semantic cache for the Laravel AI SDK.

README 文档

README

Latest Version on Packagist GitHub Tests Action Status Total Downloads PHP Version Support Laravel Version Support License

A drop-in semantic cache for the Laravel AI SDK — serve cached LLM responses for meaning-similar prompts, not just exact matches.

Sage matched prompts by meaning using vector embeddings. "How do I reset my password?" and "I forgot my login, how to change it?" return the same cached response — instantly, at zero API cost.

Features

  • Semantic Matching: Matches on intent, not just string equality.
  • Zero Infra Latency: Works with your existing Postgres (pgvector) or Redis database.
  • One-Line Integration: Hooks natively into Laravel AI SDK agent middleware.
  • Automatic Token Savings: Significant reduction in LLM API costs.
  • Pulse Integration: Includes a built-in Pulse card to track hit rates and cost savings.

Installation

You can install the package via composer:

composer require fr3on/laravel-sage

You can publish and run the migrations with:

php artisan vendor:publish --tag="sage-migrations"
php artisan migrate

You can publish the config file with:

php artisan vendor:publish --tag="sage-config"

Usage

Sage hooks into the Laravel AI SDK's native agent middleware system. Add SemanticCache to your agent's middleware stack:

use Fr3on\Sage\Middleware\SemanticCache;

class SupportAgent implements Agent, HasMiddleware
{
    public function middleware(): array
    {
        return [
            new SemanticCache(threshold: 0.92, ttl: 86400),
        ];
    }
}

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

  • Stars: 2
  • Watchers: 0
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-04-10

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固