woutersf/ai-connection-bundle
Composer 安装命令:
composer require woutersf/ai-connection-bundle
包简介
Core AI connection plugin for Mautic - manages LiteLLM integration and shared AI services
README 文档
README
A core AI connection plugin for Mautic that manages LiteLLM integration and provides centralized AI services for all Mautic AI-powered plugins.
Overview
The Mautic AI Connection Bundle serves as the foundation for AI functionality in Mautic. It provides a centralized LiteLLM service that can be used by other AI-powered plugins such as:
- Mautic AI Console - AI-powered console interface with voice input
- Mautic AI Reports - AI-powered report generation
- Mautic AI Eval - AI evaluation features
Features
- Centralized AI Configuration - Single source of truth for LiteLLM endpoint and credentials
- LiteLLM Integration - Connect to multiple AI providers (OpenAI, Anthropic Claude, Llama, etc.) through LiteLLM proxy
- Shared Service Architecture - Other plugins access AI capabilities through this bundle's service
- Model Management - Dynamically fetch available models from your LiteLLM instance
- Secure Credential Storage - API keys are encrypted and stored securely
Requirements
- Mautic 4.0+ or Mautic 5.0+
- PHP 7.4 or 8.0+
- A running LiteLLM instance (proxy server)
Installation
Via Composer
composer require mautic/ai-connection-bundle
Manual Installation
- Download or clone this repository
- Place the
MauticAIconnectionBundlefolder indocroot/plugins/ - Clear Mautic cache:
php bin/console cache:clear
- Go to Mautic Settings → Plugins
- Click "Install/Upgrade Plugins"
- Find "Mautic AI Connection" and publish it
Configuration
Navigate to Mautic Settings → Plugins → Mautic AI Connection to configure the plugin.
Required Settings
-
LiteLLM Endpoint
- URL of your LiteLLM proxy server or an OPENAI API key.
- Example:
http://localhost:4000orhttps://your-litellm-server.comor https://api.openai.com/v1 - Note: This should point to your LiteLLM proxy, NOT directly to OpenAI or other providers
-
LiteLLM Secret Key
- API key for authenticating with your LiteLLM instance or Openai.
- This credential is encrypted and stored securely
Usage in Other Plugins
Other Mautic plugins can use the LiteLLM service provided by this bundle.
Accessing the Service
// Get the service from the container $liteLLMService = $this->container->get('mautic.ai_connection.service.litellm');
Available Methods
1. Chat Completion (with tools support)
$messages = [ ['role' => 'system', 'content' => 'You are a helpful assistant.'], ['role' => 'user', 'content' => 'What is Mautic?'], ]; $options = [ 'model' => 'gpt-3.5-turbo', 'temperature' => 0.7, 'max_tokens' => 1000, ]; $response = $liteLLMService->getChatCompletion($messages, $options);
2. Simple Completion
$response = $liteLLMService->getCompletion('Explain marketing automation in 50 words');
3. Streaming Completion
$liteLLMService->streamCompletion('Write a blog post about email marketing', function($chunk) { echo $chunk; });
4. Speech-to-Text
$audioData = file_get_contents('recording.wav'); $transcription = $liteLLMService->speechToText($audioData, 'en', 'whisper-1');
5. Get Available Models
$models = $liteLLMService->getAvailableModels(); // Returns: ['GPT-4' => 'gpt-4', 'Claude 3' => 'claude-3-sonnet', ...]
Subscribing to the Service in Controllers
use MauticPlugin\MauticAIconnectionBundle\Service\LiteLLMService; class YourController extends CommonController { public static function getSubscribedServices(): array { return array_merge(parent::getSubscribedServices(), [ 'mautic.ai_connection.service.litellm' => LiteLLMService::class, ]); } public function yourAction() { $liteLLMService = $this->container->get('mautic.ai_connection.service.litellm'); // Use the service... } }
Architecture
This plugin follows a centralized service architecture:
┌─────────────────────────────────────┐
│ Mautic AI Connection Bundle │
│ ┌───────────────────────────────┐ │
│ │ LiteLLM Service │ │
│ │ - Chat Completions │ │
│ │ - Streaming │ │
│ │ - Speech-to-Text │ │
│ │ - Model Discovery │ │
│ └───────────────────────────────┘ │
└─────────────────────────────────────┘
↑ ↑ ↑
│ │ │
┌─────────┘ │ └─────────┐
│ │ │
┌───┴────┐ ┌───┴────┐ ┌───┴────┐
│AI │ │AI │ │AI │
│Console │ │Reports │ │Eval │
│Bundle │ │Bundle │ │Bundle │
└────────┘ └────────┘ └────────┘
Composer Dependency
Other AI plugins should declare this bundle as a dependency in their composer.json:
{
"require": {
"mautic/ai-connection-bundle": "^1.0"
}
}
Security
- API keys are encrypted using Mautic's encryption helper
- All requests use HTTPS when connecting to remote LiteLLM instances
- The service validates configuration before making API calls
Troubleshooting
"LiteLLM endpoint and secret key must be configured"
Solution: Configure the LiteLLM endpoint and secret key in the plugin settings.
"404 Not Found" when making AI requests
Issue: The endpoint is pointing directly to OpenAI/Anthropic instead of LiteLLM proxy.
Solution: Ensure you're using your LiteLLM proxy URL (e.g., http://localhost:4000), not https://api.openai.com.
Models not appearing in dropdown
Issue: LiteLLM instance is not reachable or not properly configured.
Solution:
- Verify LiteLLM is running:
curl http://localhost:4000/models - Check endpoint URL in plugin settings
- Verify secret key is correct
Development
Running Tests
php bin/phpunit --filter MauticAIconnectionBundle
Code Style
Follow Mautic coding standards:
php bin/php-cs-fixer fix plugins/MauticAIconnectionBundle
Support
- GitHub Issues: Report an issue
- Mautic Community: community.mautic.org
- Documentation: LiteLLM Docs
License
GPL-3.0-or-later
Credits
Created by Frederik Wouters
Version
1.0.0
Changelog
1.0.0 (2024)
- Initial release
- LiteLLM service integration
- Chat completion support
- Streaming support
- Speech-to-text support
- Model discovery
- Secure credential storage
woutersf/ai-connection-bundle 适用场景与选型建议
woutersf/ai-connection-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 11 月 27 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「plugin」 「integration」 「ai」 「Mautic」 「artificial-intelligence」 「llm」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 woutersf/ai-connection-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 woutersf/ai-connection-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 woutersf/ai-connection-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
CakePHP 4.x AdminLTE Theme.
LinkedIn API PHP SDK with OAuth 2.0 & CSRF support. Can be used for social sign in or sharing on LinkedIn. Examples. Documentation.
LinkedIn API PHP SDK with OAuth 2.0 & CSRF support. Can be used for social sign in or sharing on LinkedIn. Examples. Documentation.
Historical accounting for contacts
Extends Mautic Lead Bundle's Lead List (Segment) functionality.
This plugin brings Google's reCAPTCHA, hCaptcha, and Cloudflare Turnstile integration to mautic.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 28
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-or-later
- 更新时间: 2025-11-27