navindbhudiya/module-product-recommendation 问题修复 & 功能扩展

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

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

navindbhudiya/module-product-recommendation

Composer 安装命令:

composer require navindbhudiya/module-product-recommendation

包简介

AI-Powered Product Recommendations using ChromaDB Vector Database for Magento 2

README 文档

README

CI

AI-powered product recommendations for Magento 2 — semantic related, cross-sell, and up-sell suggestions driven by vector embeddings, with optional LLM re-ranking and behaviour-based personalization.

This README describes only what the code does today. Planned and partially-built features live in ROADMAP.md; an honest feature-by-feature breakdown is in dev/demo/AUDIT.md.

Status

Productization phases 0–4 are implemented and unit-tested (128 unit + 3 integration tests, phpcs-clean on all new code). The pluggable vector store and the never-empty fallback are wired into the live serving path (RecommendationService). Items that require a running stack — admin analytics dashboard UI + JS beacon, GDPR export/erase framework wiring, and all live-environment gate evidence (Luma indexing, hit-rate, CI-green-on-PR) — are listed in ROADMAP.md.

What it does

  • Semantic related / cross-sell / up-sell via nearest-neighbour search over product embeddings, injected into the native Magento blocks through plugins.
  • Pluggable vector store behind Api/VectorStoreInterface:
    • ChromaDB (existing).
    • Search Engine — your store's OpenSearch/Elasticsearch via k-NN (no extra infra).
  • Pluggable embeddings behind Api/EmbeddingProviderInterface:
    • Hosted API (OpenAI-compatible, e.g. text-embedding-3-small) — recommended default.
    • ChromaDB embedding-service (self-hosted Python, all-MiniLM-L6-v2).
  • Never-empty block: a fallback chain (primary → same-category → Magento native) keeps the slot populated even when the AI backend is down (Service/Fallback/FallbackSelector).
  • Personalized recommendations (browsing / purchase / wishlist / "Just for you") with REST + GraphQL APIs.
  • Optional LLM re-ranking (Claude / OpenAI) — off by default.

Requirements

  • Magento 2.4.6–2.4.8, PHP 8.1–8.3.
  • A vector store: either OpenSearch/Elasticsearch (already required by Magento) or ChromaDB.
  • For hosted embeddings: an API key (OpenAI/Voyage/compatible).

Install in 3 minutes (no extra infra)

Uses your existing OpenSearch + a hosted embeddings API — no ChromaDB, no Python container.

# 1. Add the module (or copy into app/code/NavinDBhudiya/ProductRecommendation)
bin/magento module:enable NavinDBhudiya_ProductRecommendation
bin/magento setup:upgrade
bin/magento setup:di:compile

# 2. Configure (Stores > Configuration > NavinDBhudiya > AI Product Recommendation):
#    - Embedding > Embedding Provider = "Hosted API"; set API key + model (text-embedding-3-small)
#    - Vector Store > Backend = "Search Engine (OpenSearch/Elasticsearch k-NN)"
#      (set host/port if not the defaults opensearch:9200)

# 3. Index + verify
bin/magento recommendation:index
bin/magento recommendation:health     # expect green + X/Y coverage

Prefer ChromaDB? Set Vector Store = ChromaDB and Embedding Provider = ChromaDB, then run the embedding-service container (see docker/) — see CLAUDE.md for the ChromaDB path.

CLI commands

All commands use the recommendation:* namespace.

Command Purpose
recommendation:health Ping embedding provider + vector store; show index coverage.
recommendation:index Embed and store the catalog.
recommendation:test Test the ChromaDB / embedding-service connection.
recommendation:similar <id> Show similar products for a product (or --query).
recommendation:clear Clear the vector collection.
recommendation:personalized Personalized recommendations for a customer.
recommendation:trending:refresh Refresh the trending table.
recommendation:refresh-profiles Refresh customer behaviour profiles.
recommendation:demo:baseline Measure hit-rate@10 + latency over the ground-truth pairs.

Architecture

Product save / recommendation:index
        │
        ▼
EmbeddingProviderInterface  ──►  VectorStoreInterface  (ChromaDB | Search Engine k-NN)
 (Hosted API | ChromaDB)
        ▲                                 │
        │                                 ▼
PDP / cart blocks ──► RecommendationService ──► nearest neighbours
                              │
                              ├─ optional LLM re-rank (off by default)
                              └─ FallbackSelector: primary → same-category → native
  • Api/VectorStoreInterfaceupsert / query / delete / count / ping. Implementations: Service/VectorStore/ChromaVectorStore, Service/VectorStore/SearchEngineVectorStore (selected by config via VectorStoreFactory).
  • Api/EmbeddingProviderInterface — implementations: ApiEmbeddingProvider, ChromaDBEmbeddingProvider (selected via EmbeddingProviderFactory).
  • REST: etc/webapi.xml. GraphQL: etc/schema.graphqls.

APIs

  • REST — e.g. GET /V1/recommendation/personalized/justforyou.
  • GraphQLpersonalizedRecommendations(type: JUST_FOR_YOU, limit: 8) { items { sku name } }.

Testing

No Warden required:

bash dev/demo/run-tests.sh            # unit + integration + phpcs
bash dev/demo/run-tests.sh --unit
composer test                          # if composer is available

See CLAUDE.md for the PHPUnit-10 / Magento classmap caveat and the test launcher.

License

MIT. Author: Navin Bhudiya.

navindbhudiya/module-product-recommendation 适用场景与选型建议

navindbhudiya/module-product-recommendation 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 10 次下载、GitHub Stars 达 1, 最近一次更新时间为 2025 年 12 月 03 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「machine learning」 「ai」 「magento2」 「magento 2」 「related products」 「personalization」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 navindbhudiya/module-product-recommendation 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 navindbhudiya/module-product-recommendation 我们能提供哪些服务?
定制开发 / 二次开发

基于 navindbhudiya/module-product-recommendation 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

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