Search by

x-dep / rag-bundle

x-dep

Russian-language knowledge base for x-dep/ai-bundle: Doctrine entities as sources via attributes, word index with Russian stemming, grounded search, unanswered questions report

Package info

github.com/x-dep-labs/rag-bundle

Documentation

Type:symfony-bundle

pkg:composer/x-dep/rag-bundle

Statistics

Installs: 6

Dependents: 0

Suggesters: 1

Stars: 0

Open Issues: 1

v2.0.0 2026-12-01 12:23 UTC

This package is auto-updated.

Last update: 2026-12-02 11:16:09 UTC


README

Russian-language knowledge base (retrieval) for the x-dep/ai-bundle assistant on Symfony: Russian stemming, word-based search, no external search engine. The documentation is in Russian.

For x-dep/ai-bundle this bundle is a grounding provider with the key knowledge. A skill with grounding: [knowledge] answers only from the knowledge-base fragments that were found, and hands the question over to a human when they contain no answer.

Features

  • Sources from your own entities. Mark a Doctrine entity with #[Knowledge] and its fields with #[Field] (title, text, URL, validity period, published flag). Only marked fields are read; an entity with a #[Personal] field is never indexed. Anything else (files, external APIs, records built from several entities) plugs in through the KnowledgeSource port (service tag xdep_rag.source); WatchesEntities rebuilds such a source when the listed entities change.
  • One table, rebuilt automatically. Records are split into fragments of up to 600 characters (configurable); a source is rebuilt in one transaction after every Doctrine flush() that touches it, or with xdep:rag:reindex. No queue, no background jobs.
  • Word search tuned for Russian. Snowball stemming, related words by common stem, BM25 ranking in memory, follow-up questions understood from earlier messages, validity dates checked at question time. Project vocabulary (synonyms, irregular forms) is configuration: the bundle ships no domain dictionary.
  • Word-forms port. XDep\RagBundle\Text\WordForms (service xdep_rag.word_forms) gives project code the same normalisation, e.g. to match product or category names typed in another grammatical case; projects can replace the implementation.
  • Admin pages inside the ai-bundle settings (role ROLE_XDEP_AI_ADMIN): sources and index state, a search probe that shows what the model would get without calling it, and the list of questions left without an answer with a configurable retention period.

Designed for knowledge bases of up to several thousand fragments. The only place where the bundle stores text written by a person is xdep_rag_gap (masked by ai-bundle, cut to 500 characters, kept 90 days by default).

Requirements

  • PHP 8.4+
  • Symfony 7.4 or 8.1+
  • Doctrine ORM 3.5+, DBAL 4
  • MySQL 8.0 or 8.4 (SQLite for tests only; PostgreSQL is not supported)
  • x-dep/ai-bundle ^2.0 (installed automatically)

Installation

composer require x-dep/rag-bundle

Enable and configure ai-bundle as described in its installation guide, import the admin routes next to the ai-bundle ones, run the migrations and mark the first source:

# config/routes/xdep.yaml
xdep_rag_admin:
    resource: '@XDepRagBundle/config/routes.php'
    prefix: /admin/ai
#[ORM\Entity]
#[Knowledge('articles', 'Статьи')]
class Article
{
    // ...
    #[ORM\Column(length: 255)]
    #[Field(Field::TITLE)]
    public string $title = '';

    #[ORM\Column(type: 'text')]
    #[Field]
    public string $body = '';
}
# config/packages/xdep_ai.yaml: the skill answers from the knowledge base
xdep_ai:
    skills:
        consultant:
            grounding: [knowledge]
php bin/console doctrine:migrations:migrate --no-interaction
php bin/console xdep:rag:reindex

The full step-by-step guide is docs/install.md.

Documentation (in Russian)

Document Contents
docs/install.md Installation from an empty Symfony project to the knowledge page
docs/sources.md Sources: attributes, field roles, validity, WatchesEntities, KnowledgeSource, bulk loading, length rules, tools, WordForms
docs/operations.md Operations: rebuilds, states, deployment, limits, configuration, synonyms, data retention, removal
UPGRADE.md Public contract, compatibility with x-dep/ai-bundle, upgrading
CHANGELOG.md Changes by version

Maintainer practices shared by both bundles (tests, contract snapshots, migrations, releases) are in docs/bundle-development.md of x-dep/ai-bundle.

Development

Tests are not part of the Composer package. Clone the repository and run:

make install
make test

If an ai-bundle checkout lies next to this one (../ai-bundle), make install uses it instead of the Packagist release. make tools && make qa runs the full quality gate, make test-mysql the tests against a real MySQL (XDEP_TEST_MYSQL_URL).

License, security, contributing

  • License: MIT, see LICENSE.
  • Security issues: report privately via GitHub Security Advisories, see SECURITY.md; please do not open public issues for them.
  • Contributing: see CONTRIBUTING.md.