PHPackages                             genaker/oroai - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. genaker/oroai

ActiveSymfony-bundle[Utility &amp; Helpers](/categories/utility)

genaker/oroai
=============

AI assistant bundle for OroCommerce — multi-provider LLM chat (OpenAI, Gemini, Anthropic) with tool use, RAG knowledge base, and Redis Stack vector search

00

Since Jul 7Compare

[ Source](https://github.com/Genaker/OROAI)[ Packagist](https://packagist.org/packages/genaker/oroai)[ RSS](/packages/genaker-oroai/feed)WikiDiscussions Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

GenakerOroAIBundle
==================

[](#genakeroroaibundle)

AI assistant for OroCommerce. Adds a chat input to the admin header that connects to a configurable LLM backend, with tool use (SQL queries, entity lookup, schema inspection, config reading) and a RAG knowledge base backed by Redis Stack.

[![Oro AI Assistant — System Configuration](docs/configuration.png)](docs/configuration.png)

---

Features
--------

[](#features)

- **Multi-provider LLM** — OpenAI, Anthropic Claude, Google Gemini; switch via env var or admin UI
- **Model selection** — dropdown in System Configuration populated from `Resources/config/ai_models.yml`; no code change needed to add new models
- **Tool use** — the agent can query the database, inspect entity metadata, look up routes, read logs, and more
- **RAG (Retrieval-Augmented Generation)** — semantic search over docs, DB schema, system config, and admin menu; answers are grounded in real OroCommerce data
- **Chat UI** — always-visible input in the admin header; on send the panel slides open below the header and the input relocates inside the panel for a native chat experience

---

Quick start
-----------

[](#quick-start)

### 1. Configure the provider

[](#1-configure-the-provider)

Add to `.env-app.local`:

```
###> OroAI / Gemini config ###
OROAI_PROVIDER=gemini
OROAI_API_KEY=
OROAI_MODEL=gemini-2.0-flash
OROAI_EMBEDDING_API_KEY=
OROAI_REDIS_URL=redis://redis_search:6379
###< OroAI / Gemini config ###
```

Supported values for `OROAI_PROVIDER`: `gemini`, `openai`, `anthropic`.

### 2. Start the Redis Stack container

[](#2-start-the-redis-stack-container)

RediSearch (vector search) requires the Redis Stack image — the plain `redis` service does not have it:

```
docker-compose up -d redis_search
```

### 3. Build the RAG index

[](#3-build-the-rag-index)

```
php bin/console genaker:oroai:rag:reindex --provider=docs --provider=config
```

### 4. Verify RAG is working

[](#4-verify-rag-is-working)

```
php bin/console genaker:oroai:rag:test "application URL" --top=3
```

### 5. Clear Symfony cache

[](#5-clear-symfony-cache)

```
php bin/console cache:clear
```

---

Configuration
-------------

[](#configuration)

### Environment variables

[](#environment-variables)

Env vars take priority over admin UI settings. Symfony Dotenv sets `$_SERVER`/`$_ENV` only — `getenv()` returns false for vars loaded from `.env-app.local`.

VariableDefaultDescription`OROAI_PROVIDER``openai`LLM provider: `openai`, `gemini`, `anthropic``OROAI_API_KEY`—API key for the LLM provider`OROAI_MODEL`provider defaultModel name — overrides the admin UI dropdown`OROAI_EMBEDDING_API_KEY`falls back to `OROAI_API_KEY`Separate key for embedding calls`OROAI_REDIS_URL``redis://redis_search:6379`Redis Stack URL for the RAG vector index### Admin UI

[](#admin-ui)

Go to **System → Configuration → General Setup → Oro AI Assistant** to set the provider, API key, model, temperature, and toggle individual tools — no deployment needed.

### Model list

[](#model-list)

Available models are defined in [`Resources/config/ai_models.yml`](Resources/config/ai_models.yml). To add a model, append an entry under the appropriate provider group:

```
models:
  gemini:
    - { label: 'Gemini 2.0 Flash (15 RPM free)', value: 'gemini-2.0-flash' }
    - { label: 'Gemini 2.5 Flash (10 RPM free)', value: 'gemini-2.5-flash' }
    - { label: 'Gemini 2.5 Pro', value: 'gemini-2.5-pro' }
  openai:
    - { label: 'GPT-4o', value: 'gpt-4o' }
    ...
```

Run `cache:clear` after editing the file.

---

Chat UI behaviour
-----------------

[](#chat-ui-behaviour)

1. **Collapsed** — compact input + send button visible in the header search row
2. **First send** — panel slides open below the header; input relocates inside the panel below the message history
3. **Minimize / Clear / Escape / click-outside** — panel closes; input returns to the header
4. **Focus** — input is auto-focused when the panel opens and again after each AI response so you can keep typing without clicking

---

Directory structure
-------------------

[](#directory-structure)

```
GenakerOroAIBundle/
├── Agent/              # OroAiAgent — orchestrates tools and RAG context
├── Command/            # Console commands (rag:reindex, rag:test)
├── Controller/         # ChatController — handles AJAX chat requests
├── DependencyInjection/
├── Form/Type/          # AiModelChoiceType — builds model dropdown from ai_models.yml
├── Llm/                # LLM clients (OpenAI, Gemini, Anthropic) + registry
├── Rag/                # Embedding clients, RediSearchRagStore, providers
│   ├── Provider/       # DocFiles, Schema, Menu, SystemConfig providers
│   └── Contract/       # RagProviderInterface
├── Resources/
│   ├── config/
│   │   ├── ai_models.yml   # model list for the admin UI dropdown
│   │   └── services.yml
│   ├── public/js/      # oroai-chat.js — chat UI with DOM input relocation
│   ├── rag/            # Markdown knowledge-base files indexed by docs provider
│   └── views/Chat/     # chatBar.html.twig
├── Service/            # OroAiConfig — reads env vars and system config
├── Tools/              # SQL, schema, entity, route, log, config, translation tools
├── RAG.md              # RAG technical reference
└── EXAMPLES.md         # Use-case examples

```

---

RAG deep-dive
-------------

[](#rag-deep-dive)

See **[RAG.md](RAG.md)** for:

- Embedding models, dimensions, and storage format
- Cosine similarity algorithm and score interpretation table
- How to tune top-K, similarity thresholds, and chunk size
- HNSW index parameters and brute-force fallback
- Switching between Gemini and OpenAI embeddings
- Adding a custom RAG provider
- Full unit test and integration test examples

---

CLI reference
-------------

[](#cli-reference)

CommandDescription`genaker:oroai:rag:reindex`Rebuild the vector index from all (or selected) providers`genaker:oroai:rag:test `Search the index and show scores — useful for debugging relevance```
# Reindex only config and docs
php bin/console genaker:oroai:rag:reindex --provider=config --provider=docs

# List all registered providers
php bin/console genaker:oroai:rag:reindex --list

# Drop index and rebuild from scratch (required after switching embedding model)
php bin/console genaker:oroai:rag:reindex --clear

# Test a query — shows cosine distance, similarity %, and matched text
php bin/console genaker:oroai:rag:test "checkout configuration" --top=5
php bin/console genaker:oroai:rag:test "checkout configuration" -k 1 --full
```

---

Running tests
-------------

[](#running-tests)

```
# Unit tests (no containers needed)
bin/phpunit -c phpunit-dev.xml src/Genaker/Bundle/OroAI/Tests/Unit

# Integration tests (requires live redis_search container)
INTEGRATION_TESTS_ENABLED=1 bin/phpunit -c phpunit-dev.xml --filter RagStoreIntegrationTest
```

Rate limits (Gemini free tier)
------------------------------

[](#rate-limits-gemini-free-tier)

ModelRPMRPD`gemini-2.0-flash`151 500`gemini-2.5-flash`10500`gemini-2.5-pro`525Upgrade to a paid API key or switch to `gemini-2.0-flash` to reduce 429 errors.

###  Health Score

9

—

LowBetter than 0% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/9213670?v=4)[Yegor Shytikov](/maintainers/genaker)[@Genaker](https://github.com/Genaker)

### Embed Badge

![Health badge](/badges/genaker-oroai/health.svg)

```
[![Health](https://phpackages.com/badges/genaker-oroai/health.svg)](https://phpackages.com/packages/genaker-oroai)
```

###  Alternatives

[verbb/tablemaker

Create customizable and user-defined table fields.

40176.8k2](/packages/verbb-tablemaker)[symfony/ux-typed

Typed integration for Symfony

11148.4k2](/packages/symfony-ux-typed)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
