PHPackages                             gtstudio/module-ai-knowledge-base - 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. gtstudio/module-ai-knowledge-base

ActiveMagento2-module[Utility &amp; Helpers](/categories/utility)

gtstudio/module-ai-knowledge-base
=================================

Knowledge base management for Magento 2. Upload documents (PDF, TXT) that AI agents can retrieve as context before answering queries.

1.0.3(4mo ago)081BUSL-1.1PHPPHP &gt;=8.1

Since Mar 9Pushed 4mo agoCompare

[ Source](https://github.com/gabrielgts/module-ai-knowledge-base)[ Packagist](https://packagist.org/packages/gtstudio/module-ai-knowledge-base)[ RSS](/packages/gtstudio-module-ai-knowledge-base/feed)WikiDiscussions main Synced 4w ago

READMEChangelog (1)Dependencies (4)Versions (4)Used By (0)

Gtstudio\_AiKnowledgeBase
=========================

[](#gtstudio_aiknowledgebase)

Document management for AI agents in Magento 2. Upload files that agents can retrieve as context before answering queries — enabling retrieval-augmented generation (RAG) without a vector database.

Preview
-------

[](#preview)

[![AiKnowledgeBase — uploading a PDF and querying an agent that retrieves relevant excerpts](docs/images/aiknowledgebase-preview.gif)](docs/images/aiknowledgebase-preview.gif)

AI Studio Ecosystem
-------------------

[](#ai-studio-ecosystem)

Part of the **AI Studio** suite for Magento 2. See all modules:

ModuleRepositoryDescription**Gtstudio\_AiConnector**[module-aiconnector](https://github.com/gabrielgts/module-aiconnector)Core AI provider abstraction**Gtstudio\_AiAgents**[module-ai-agents](https://github.com/gabrielgts/module-ai-agents)Agent &amp; tool orchestration, cron scheduling, execution log**Gtstudio\_AiWidgets**[module-ai-widgets](https://github.com/gabrielgts/module-ai-widgets)Floating admin chat widget + PageBuilder AI generator**Gtstudio\_AiDataQuery**[module-ai-data-query](https://github.com/gabrielgts/module-ai-data-query)Natural-language store analytics (privacy-first)**Gtstudio\_AiKnowledgeBase***(this module)*Document upload &amp; RAG retrieval for agents**Gtstudio\_AiDashboard**[module-ai-dashboard](https://github.com/gabrielgts/module-ai-dashboard)AI-powered KPI dashboard with ML insightsWhat It Does
------------

[](#what-it-does)

- Upload and manage documents (PDF, TXT) in the Magento admin
- Documents are stored and indexed so that agents can fetch relevant excerpts at query time
- Integrates with `Gtstudio_AiAgents` — assign a knowledge base to any agent

Requirements
------------

[](#requirements)

- Magento 2.4.4+
- PHP 8.1+
- `Gtstudio_AiConnector` enabled and configured
- `Gtstudio_AiAgents` enabled
- `smalot/pdfparser: ^2.12` (PDF text extraction)

Installation
------------

[](#installation)

```
composer require gtstudio/module-ai-knowledge-base
php bin/magento module:enable Gtstudio_AiKnowledgeBase
php bin/magento setup:upgrade
```

Usage
-----

[](#usage)

### Uploading Documents

[](#uploading-documents)

Navigate to *AI Studio → Agents &amp; Tools → Knowledge Base*.

Click **Add New**, fill in:

FieldDescriptionTitleHuman-readable label (auto-populated from PDF metadata on upload)Upload PDF DocumentUpload a PDF file — text and metadata are extracted automaticallyContentExtracted text (editable; used for retrieval)TagsComma-separated keywords (auto-populated from PDF metadata)AgentsAssociate this document with one or more agentsIs ActiveOnly active entries are searchable by agents### How Retrieval Works

[](#how-retrieval-works)

When an agent that has knowledge base documents attached receives a question:

1. The question is matched against document excerpts using keyword or semantic similarity
2. Relevant excerpts are prepended to the agent's system prompt as context
3. The agent responds with awareness of those excerpts

No full document text is sent to the LLM — only the most relevant excerpts, keeping token usage low.

Extensibility
-------------

[](#extensibility)

### Supporting Additional File Formats

[](#supporting-additional-file-formats)

The text extraction pipeline uses a registry pattern. Register a custom extractor for a new MIME type:

```

                Vendor\Module\Model\Extractor\DocxExtractor

```

Implement `Gtstudio\AiKnowledgeBase\Api\ExtractorInterface`:

```
interface ExtractorInterface
{
    /**
     * Extract plain text from the given file path.
     */
    public function extract(string $filePath): string;
}
```

### Custom Retrieval Strategy

[](#custom-retrieval-strategy)

Override the retrieval service to use a vector database, OpenSearch k-NN, or any other similarity search:

```

```

### Chunking Strategy

[](#chunking-strategy)

Document chunking (splitting documents into excerpt-sized pieces) can be customised:

```

        1500

        200

```

Database Tables
---------------

[](#database-tables)

TablePurpose`gtstudio_ai_knowledge_base`Document metadata (name, description, file path, agent association)`gtstudio_ai_knowledge_base_chunk`Extracted text chunks ready for retrievalACL Resources
-------------

[](#acl-resources)

ResourceControls`Gtstudio_AiKnowledgeBase::management`Access to the Knowledge Base admin section

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance74

Regular maintenance activity

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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.

###  Release Activity

Cadence

Every ~1 days

Total

3

Last Release

149d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ab1f0030c21bebf4e87187df361e770ffaa2c0d3cdcd0cd45c77a79db5836156?d=identicon)[gtstudio](/maintainers/gtstudio)

---

Top Contributors

[![gabrielgts](https://avatars.githubusercontent.com/u/22245724?v=4)](https://github.com/gabrielgts "gabrielgts (1 commits)")

### Embed Badge

![Health badge](/badges/gtstudio-module-ai-knowledge-base/health.svg)

```
[![Health](https://phpackages.com/badges/gtstudio-module-ai-knowledge-base/health.svg)](https://phpackages.com/packages/gtstudio-module-ai-knowledge-base)
```

###  Alternatives

[nosto/module-nostotagging

Increase your conversion rate and average order value by delivering your customers personalized product recommendations throughout their shopping journey.

28714.5k4](/packages/nosto-module-nostotagging)[run-as-root/magento2-prometheus-exporter

Magento2 Prometheus Exporter

69362.0k](/packages/run-as-root-magento2-prometheus-exporter)[myparcelnl/magento

A Magento 2 module that creates MyParcel labels

1861.2k](/packages/myparcelnl-magento)[loki/magento2-components

Core module for defining Alpine.js components with advanced AJAX features

1015.1k27](/packages/loki-magento2-components)[mage-os/module-llm-txt

AI-powered LLMs.txt generation for Magento 2 / Mage-OS stores. Help AI systems understand your store with OpenAI-generated content.

244.4k](/packages/mage-os-module-llm-txt)[mage-os/module-rma

Return Merchandise Authorization

214.0k](/packages/mage-os-module-rma)

PHPackages © 2026

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