LLM Knowledge Integration for Document Pages
by Apexive Solutions LLC https://github.com/apexive/odoo-llm| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Odoo Apps Dependencies |
Discuss (mail)
|
| Community Apps Dependencies | Show |
| Lines of code | 5905 |
| Technical Name |
llm_document_page |
| License | AGPL-3 |
| Website | https://github.com/apexive/odoo-llm |
| Versions | 16.0 18.0 |
| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Odoo Apps Dependencies |
Discuss (mail)
|
| Community Apps Dependencies | Show |
| Lines of code | 5905 |
| Technical Name |
llm_document_page |
| License | AGPL-3 |
| Website | https://github.com/apexive/odoo-llm |
| Versions | 16.0 18.0 |
LLM RAG Integration for Document Pages
Connect your knowledge base documents to AI-powered search and generation
Key Features
Knowledge Base Integration
Seamlessly bring your document pages into the AI-powered RAG system:
- Convert page content to AI-friendly markdown
- Preserve document page hierarchy
- Include related documents and categories
- Maintain formatting and links
Metadata Preservation
Keep important context with your documents:
- Document contributors
- Last update timestamps
- Category information
- Document relationships
Easy Integration
Simple tools to connect your knowledge base:
- One-click document creation from UI
- Batch processing of multiple pages
- Programmatic integration via API
- Automatic document organization
How It Works
The module creates a seamless integration between the Document Page knowledge base and the LLM RAG system:
Select Documents
Choose document pages from your knowledge base
Create RAG Docs
Convert pages to LLM-optimized format
Add to Collection
Organize in LLM RAG collections
Process & Embed
Process through the RAG pipeline
Usage Guide
Creating RAG Documents from the UI
Step 1: Select Document Pages
Navigate to Knowledge → Document Pages and select one or more documents you want to make available to the LLM system.
Step 2: Use the Create RAG Document Action
Click on the "Create RAG Document" action button in the list or form view.
Step 3: Configure Document Creation
In the wizard, you can:
- Customize the document name template
- Choose to process documents immediately
Step 4: Process Documents
The RAG documents will be created, referencing your original document pages. If you selected "Process Immediately," they will be processed through the full RAG pipeline.
[RAG Document Creation Workflow Image]
The Create RAG Document wizard makes it easy to add document pages to your LLM knowledge base
Processing Entire Categories
You can also add entire categories of documents to your LLM RAG system programmatically:
from odoo import api, SUPERUSER_ID
def add_knowledge_base_to_rag(env, category_id, collection_id):
# Get all pages in this category
pages = env['document.page'].search([
('parent_id', '=', category_id),
('type', '=', 'content')
])
# Get model ID for document.page
model_id = env['ir.model'].search([('model', '=', 'document.page')], limit=1).id
# Create documents
created_docs = env['llm.document']
for page in pages:
# Create document with reference to the page
document = env['llm.document'].create({
'name': f"{page.name} - Knowledge Base",
'model_id': model_id,
'res_id': page.id,
'collection_ids': [(4, collection_id)]
})
# Process through RAG pipeline
document.process_document()
created_docs |= document
return created_docs
# Example usage
env = api.Environment(cr, SUPERUSER_ID, {})
category_id = 1 # ID of your document.page category
collection_id = 1 # ID of your llm.document.collection
docs = add_knowledge_base_to_rag(env, category_id, collection_id)
Technical Implementation
The module works by implementing a custom rag_parse method on the document.page model. This method is called by the LLM RAG module during document processing.
- Page title becomes the main heading
- Metadata section includes contributor and timestamp information
- Main content is preserved in its original format
- Related pages are linked at the end of the document
Sample Output
Here's an example of how a document page is converted to the RAG format:
# Product Return Policy ## Metadata **Last Contributor:** Administrator **Last Updated:** 2023-05-15 14:30:22 **Category:** Policies ## Content <p>Our product return policy allows customers to return items within 30 days of purchase.</p> <p>To qualify for a return, items must be:</p> <ul> <li>In original condition</li> <li>With original packaging</li> <li>Accompanied by a receipt or proof of purchase</li> </ul> ## Related Pages - [Return Process](/web#id=12&model=document.page&view_type=form) - [Refund Policy](/web#id=15&model=document.page&view_type=form)
Benefits for Your Organization
- Unified Knowledge Base: Make your existing documentation available to your AI systems
- Improved AI Responses: LLMs can answer questions based on your internal knowledge
- Reduced Duplication: Maintain documentation in one place and use it everywhere
- Up-to-date Information: Changes to your knowledge base can be reflected in the LLM system
Installation
- Ensure both
document_pageandllm_ragmodules are installed - Install this module (
llm_document_page) - No additional configuration is needed - the integration is automatic
Please log in to comment on this module