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(1mo ago)05↓100%BUSL-1.1PHPPHP &gt;=8.1

Since Mar 9Pushed 1mo 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 1mo 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

40

—

FairBetter than 87% of packages

Maintenance96

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity44

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

59d 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

[yireo/magento2-webp2

Magento 2 module to add WebP support to the Magento frontend

2091.2M7](/packages/yireo-magento2-webp2)[tig/postnl-magento2

TIG Magento 2 PostNL extension

58544.2k4](/packages/tig-postnl-magento2)[lillik/magento2-price-decimal

Magento 2 Price Decimal Precision

111147.5k](/packages/lillik-magento2-price-decimal)[nosto/module-nostotagging

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

27659.1k4](/packages/nosto-module-nostotagging)[magepal/magento2-customeraccountlinksmanager

Customer Account Links Manager for Magento2 allows you to quickly and easily remove unwanted links from customer account dashboard

4084.9k](/packages/magepal-magento2-customeraccountlinksmanager)[doofinder/doofinder-magento2

Doofinder module for Magento 2

13204.0k1](/packages/doofinder-doofinder-magento2)

PHPackages © 2026

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