siberfx/chat-hybrid-ai
A Laravel package for adding hybrid AI chat to your app, combining multiple AI backends and fallback logic behind a unified, configurable chat interface. Integrates with PHP/Laravel projects to streamline conversational features.
Architecture fit: Strong fit for Laravel applications that want an embedded AI chat bubble without building provider abstractions, tool orchestration, visitor identity scoping, and admin audit views from scratch. v2.0.0’s move to the Laravel AI SDK shifts the package from provider-specific drivers to a broader provider-agnostic architecture, reducing vendor lock-in and making failover a configuration concern rather than a custom integration effort.
Integration feasibility: Feasible for existing Laravel apps, but v2.0.0 is a breaking release. Teams must replace anthropic/openai driver assumptions with laravel-ai, run a new migration, and update configuration for providers and tools. The package now supports Anthropic, OpenAI, Gemini, Groq, Mistral, DeepSeek, xAI, Ollama, OpenRouter, Azure, Bedrock, Cohere, and OpenAI-compatible APIs, with comma-separated failover via HYBRID_CHAT_AI_PROVIDERS. This is attractive for TPM-led rollouts because provider choice can be staged by environment.
Technical risk: The main risk is data exposure through newly enabled tools. SearchRecords, FindRecord, Check, request_human, WebSearch, and SimilaritySearch expand the agent’s reach; safety depends on correct scoping, authorization, and tool configuration. Signed visitor identity via <x-chat-hybrid-ai-bubble :identify="auth()->user()" /> or HybridChat::identity($user) is a critical control, but it must be implemented consistently. Provider failover introduces behavioral variance across models and providers, so response quality, tool-calling reliability, latency, and cost may change during failover. Migration and SDK dependency maturity are also risks.
Key questions:
FindRecord, and where is that consent recorded?WebSearch and SimilaritySearch allowed, and if so, under what data-boundary rules?Stack fit: Good fit for Laravel applications already using Blade, Eloquent, optional Laravel Scout, and environment-based configuration. The Blade component and HybridChat::identity() facade give TPMs a clear integration point for authenticated visitor scoping. The tool model—SearchRecords, FindRecord, Check, request_human, and any laravel/ai tool—maps well to incremental, policy-controlled rollout.
Migration path: Treat v2.0.0 as a planned upgrade, not a patch. Inventory current 1.x usage, especially custom anthropic/openai driver configuration, env variables, and any custom tooling. Update the package, run php artisan migrate, replace legacy driver config with laravel-ai, define HYBRID_CHAT_AI_PROVIDERS, and revalidate prompts, tool behavior, and failover in staging before production.
Compatibility: Verify the app’s Laravel and PHP versions against the package and Laravel AI SDK requirements. Confirm provider credentials, regions, and API access for each approved provider. If using Scout-backed SearchRecords, validate index freshness and permissions. If using FindRecord, validate signed-in and guest-confirmation flows. If using Check closures, review them as production authorization logic, not demo code.
Sequencing:
laravel-ai.SearchRecords, FindRecord, Check, and request_human one at a time with scoped test data.Maintenance: Recurring maintenance increases with provider count, model changes, SDK updates, prompt/tool tuning, and audit review. The Laravel AI SDK reduces bespoke provider code but adds a dependency to track. Migrations must be included in deployment runbooks. Admin lookup visibility is useful for support and compliance but requires retention and access-control ownership.
Support: Support teams will need runbooks for provider outages, failover activation, tool misconfiguration, identity scoping issues, and human handoff via request_human. Because admins can see every lookup, support can diagnose incorrect answers, but they also need clear escalation paths for suspected data leakage or unauthorized record access.
Scaling: Scaling depends on provider quotas, rate limits, token costs, tool query cost, and search backend performance. SearchRecords using LIKE may not scale as well as Scout-backed search. FindRecord and Check closures should be indexed and bounded. Failover improves availability but can shift cost and latency; monitor per-provider usage and set budget alerts.
Failure modes: Provider outage or quota exhaustion; failover misconfiguration; model-specific tool-calling errors; missing identity causing incorrect record scoping; guest confirmation bypass; overly broad SearchRecords results; expensive or slow Check closures; Scout index staleness; WebSearch or SimilaritySearch exposing data beyond policy; migration failure; admin audit exposing PII to unintended staff. Each needs an owner, detection signal, and rollback or disable path.
Ramp-up: Moderate. Developers need familiarity with Laravel AI SDK, provider configuration, tool authorization, and identity scoping. TPMs should drive a short enablement cycle covering safe tool patterns, guest confirmation, admin audit expectations, provider failover drills, and incident response. Start with a narrow pilot and expand only after tool behavior and audit controls are proven.
How can I help you explore Laravel packages today?