承接 mohamedsaad/ai-bridge 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

mohamedsaad/ai-bridge

最新稳定版本:v1.0.1

Composer 安装命令:

composer require mohamedsaad/ai-bridge

包简介

AI Bridge package to run Python semantic similarity checks inside Laravel

README 文档

README

AI Bridge is a Laravel package that allows you to check the semantic similarity between two texts using Python and Sentence Transformers.

It provides a simple PHP service and Laravel integration while running Python under the hood.

🚀 Features

  • Semantic text similarity (not just string matching).
  • Uses sentence-transformers (all-MiniLM-L6-v2) for embeddings.
  • Easy to use inside Laravel via the service container or facade.
  • Built-in Python script execution with Symfony Process.

📦 Installation

  1. Install the package via Composer:

    composer require mohamedsaad/ai-bridge
  2. Make sure you have Python 3.8+ installed.

  3. Install the Python dependencies:

    pip install sentence-transformers torch

⚡ Usage

Using the Service

use Saad\AiBridge\AiService;

$ai = app(AiService::class);

$score = $ai->similarity("I love programming", "I enjoy coding");

echo $score; // 0.85 (the closer to 1, the more similar)

Using the Facade

use Facades\Ai;

$score = Ai::similarity("Laravel is great", "I like PHP frameworks");

dd($score);

🛠 Requirements

  • PHP >= 8.1
  • Laravel >= 10
  • Python >= 3.8
  • Python Packages: sentence-transformers, torch

📌 Example Output

  • Input: "I love programming" vs "I enjoy coding"
  • Output: 0.82

📝 License

This package is open-sourced software licensed under the MIT license.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-09-09