Download the PHP package nomanur/laravel-markdown-rag without Composer
On this page you can find all versions of the php package nomanur/laravel-markdown-rag. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download nomanur/laravel-markdown-rag
More information about nomanur/laravel-markdown-rag
Files in nomanur/laravel-markdown-rag
Package laravel-markdown-rag
Short Description Transform Markdown files into AI-ready context with smart chunking and RAG capabilities for Laravel
License MIT
Homepage https://github.com/nomanur/laravel-markdown-rag
Informations about the package laravel-markdown-rag
Laravel Markdown RAG
Laravel Markdown RAG is a package that allows you to build a Retrieval-Augmented Generation (RAG) system using Markdown files as your knowledge base.
For more details, please visit https://nomanur.github.io/laravel-markdown-rag/.
Installation
You can install the package via composer:
Publish the package assets and configuration:
Run the migrations:
Configuration
Add the following environment variables to your .env file:
MARKDOWN_CHAT_RATE_LIMIT: 5 (optional) if you want to rate the limit for the chat.MARKDOWN_INFO_PATH: (optional) the path to the markdown files in the public directory.MARKDOWN_EMBEDDING_BATCH_SIZE: (optional) the number of chunks to process in a single embedding request (default: 50).MARKDOWN_AI_RETRY_MAX_ATTEMPTS: (optional) the maximum number of retry attempts for AI requests (default: 3).MARKDOWN_QUERY_REWRITE: (optional) whether to enable query rewriting for better retrieval (default: false).MARKDOWN_RERANKING: (optional) whether to enable reranking of search results (default: false).
To use the configuration, update the code in config/ai.php with:
Usage
1. Register Routes
Run the following command to register the necessary routes:
2. Setup Knowledge Base
Create a folder for your markdown files within the public directory. By default, this is public/knowledge-base, but you can change it using the MARKDOWN_INFO_PATH environment variable. Add your .md files there.
Example:
3. Indexing
Index your markdown files to make them searchable:
4. Start Queue Worker
Start the queue worker to process background jobs:
5. Accessing the Interface
You can access the chat interface at the following URL:
your-domain.com/markdownrag
6. Customizing Message History
By default, KnowledgeAgent retrieves messages from the History model. You can customize how messages are resolved using one of the following options:
Option 1: Global override in AppServiceProvider
Use the resolveMessagesUsing static method to customize message resolution globally:
Option 2: Inheritance in another project
If you are extending the agent in another project, you can override the messages() method directly:
7. Customizing Instructions
By default, KnowledgeAgent retrieves its instructions from the associated document's system_prompt or falls back to a default prompt. You can customize the agent's instructions using one of the following options:
Option 1: Global override in AppServiceProvider
Use the resolveInstructionsUsing static method to customize instructions globally:
Option 2: Inheritance in another project
You can also override the instructions() method directly by extending the agent:
8. Customizing Tool Descriptions
You can also override the description of the KnowledgeSearchTool globally. This is useful if you want to give the AI more specific instructions about when to use the search tool:
Testing
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
- nomanur rahman
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-markdown-rag with dependencies
illuminate/support Version ^10.0|^11.0|^12.0
livewire/livewire Version ^3.0|^4.0
laravel/ai Version ^0.2.5