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

Since Mar 9Pushed todayCompare

[ 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 today

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 88% of packages

Maintenance99

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

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

[baldwin/magento2-module-url-data-integrity-checker

Magento 2 module which can find potential url related problems in your catalog data

281756.4k](/packages/baldwin-magento2-module-url-data-integrity-checker)[yireo/magento2-webp2

Magento 2 module to add WebP support to the Magento frontend

2091.2M7](/packages/yireo-magento2-webp2)[smile/module-store-delivery

Smile Store Delivery

23344.3k1](/packages/smile-module-store-delivery)[webrotate360/module-product-viewer-standard

WebRotate 360 Product Viewer Standard Integration for Magento 2. This extension allows integrating embedded 360-degree or 3D product views into standard gallery on product pages in Magento 2. The product views can be created using our free publishing software available on webrotate360.com.

1357.2k](/packages/webrotate360-module-product-viewer-standard)[magenerds/richsnippet

This module provides rich snippet functionality

1024.8k](/packages/magenerds-richsnippet)[graycore/magento2-graphql-introspection-cache

1014.9k](/packages/graycore-magento2-graphql-introspection-cache)

PHPackages © 2026

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