Building a Private AI Knowledge Platform with RAGFlow and Ollama

Part 3 – Knowledge Bases, Document Processing, Embeddings, Retrieval Optimisation and AI Workflows

A Practical Enterprise Tutorial for SMEs, Engineers, Researchers and IT Professionals

34. Introduction

In Part 2, we successfully deployed a private AI platform using Ubuntu, Docker, Ollama and RAGFlow. The infrastructure is now ready to process organisational knowledge.

This chapter focuses on what transforms a language model into a useful enterprise assistant: building high-quality knowledge bases. Readers will learn how documents are processed, indexed and retrieved, how embedding models influence search quality, and how to optimise Retrieval-Augmented Generation (RAG) for technical and business documents.

By the end of this chapter, you will understand how to:

  • Design effective knowledge bases.
  • Import and prepare documents.
  • Improve retrieval quality.
  • Configure chunking and embeddings.
  • Use reranking to increase answer accuracy.
  • Build AI workflows for engineering, research and business operations.

35. Understanding Enterprise Knowledge Bases

A knowledge base is a structured repository of information that an AI system can search before generating answers. Unlike traditional file shares, documents are indexed semantically, allowing users to ask questions in natural language.

Typical enterprise knowledge bases include:

  • Policies and procedures
  • Engineering manuals
  • Standard operating procedures (SOPs)
  • Technical specifications
  • Research papers
  • Software documentation
  • Product manuals
  • Customer support guides
  • Compliance documents
  • Training materials

Instead of searching by exact keywords, semantic search identifies documents based on meaning and context.

36. Designing an Effective Knowledge Base

Successful deployments begin with thoughtful organisation. Rather than placing every document into one large repository, separate knowledge bases by function or audience.

Examples include:

Knowledge Base

Contents

Engineering

Drawings, specifications, standards, manuals

IT Operations

Network diagrams, SOPs, backup procedures

Human Resources

Employee handbook, policies, training

Sales & Marketing

Product information, proposals, presentations

Customer Support

FAQs, troubleshooting guides, installation manuals

Research

White papers, journal articles, technical reports

This separation improves retrieval accuracy and simplifies access control.

37. Supported Document Types

RAGFlow supports a broad range of business and technical documents, including:

  • PDF
  • Microsoft Word (DOCX)
  • PowerPoint (PPTX)
  • Excel spreadsheets
  • CSV files
  • Markdown
  • HTML
  • Plain text
  • JSON
  • Source code repositories

For scanned documents, Optical Character Recognition (OCR) extracts searchable text before indexing.

38. Document Processing Pipeline

Every uploaded document passes through several processing stages before becoming searchable.

Upload Document │ ▼ Document Parsing │ ▼ Text Extraction │ ▼ Cleaning & Normalisation │ ▼ Chunking │ ▼ Embedding Generation │ ▼ Vector Database │ ▼ Semantic Search

Each stage contributes to the overall quality of AI-generated answers.

39. Document Parsing

Parsing converts raw files into structured text.

Examples include:

  • Extracting paragraphs from PDF files.
  • Reading headings from Word documents.
  • Preserving tables where possible.
  • Identifying images and captions.
  • Maintaining document hierarchy.

High-quality parsing improves retrieval performance and reduces indexing errors.

40. Text Cleaning

Before embeddings are generated, documents should be cleaned by:

  • Removing duplicate headers and footers.
  • Eliminating page numbers.
  • Correcting OCR errors.
  • Standardising whitespace.
  • Removing unnecessary formatting.

Clean text produces more meaningful embeddings and reduces noise during retrieval.

41. Chunking Strategies

Large Language Models cannot process entire document libraries simultaneously. Instead, documents are divided into manageable sections known as chunks.

Common chunking methods include:

Fixed-Length Chunking

Splits text into blocks of a specified number of tokens.

Advantages:

  • Simple
  • Fast
  • Predictable

Limitations:

  • May split important ideas.

Paragraph-Based Chunking

Preserves paragraph boundaries, making responses more coherent.

Suitable for:

  • Technical documentation
  • Policies
  • Research papers

Heading-Based Chunking

Uses document headings to define chunk boundaries.

Ideal for:

  • User manuals
  • Standards
  • Books
  • White papers

Semantic Chunking

Groups text according to meaning rather than length.

Advantages:

  • Better retrieval accuracy
  • Improved context preservation

Although more computationally intensive, semantic chunking often provides the best results for engineering and research documentation.

42. Choosing Chunk Size

Recommended starting points include:

Document Type

Chunk Size

Research papers

700–1,000 tokens

Engineering manuals

800–1,200 tokens

Policies

500–800 tokens

Technical specifications

600–900 tokens

Software documentation

600–1,000 tokens

Experimentation is recommended to determine the optimal settings for each knowledge base.

43. Embeddings Explained

Embeddings transform text into numerical vectors that capture semantic meaning.

Unlike keyword search, embeddings allow the system to recognise that:

"UPS battery replacement"

and

"changing the backup power batteries"

describe similar concepts.

This capability enables semantic retrieval rather than literal string matching.

44. Why BGE-M3?

BGE-M3 is widely used because it offers:

  • High retrieval accuracy
  • Multilingual support
  • Strong technical language understanding
  • Efficient inference
  • Excellent compatibility with RAGFlow

For organisations working with engineering, scientific and business documentation, BGE-M3 provides an effective balance between quality and performance.

45. Vector Databases

After embeddings are generated, they are stored in a vector database.

Unlike relational databases, vector databases search by similarity rather than exact values.

Typical workflow:

User Question ↓ Embedding ↓ Vector Search ↓ Most Similar Chunks ↓ LLM Response

This process enables users to locate relevant information even when they use different wording from the original document.

46. Reranking Results

Initial retrieval may return several relevant document chunks. A reranking model evaluates these candidates and reorders them according to relevance.

Benefits include:

  • More accurate responses.
  • Better handling of ambiguous questions.
  • Reduced irrelevant context.
  • Improved performance with long documents.

A commonly recommended reranking model is BGE-Reranker-v2.

47. Prompt Engineering for Enterprise AI

Prompt engineering guides the language model to produce consistent, grounded responses.

Example system prompt:

You are an engineering assistant. Answer only using the retrieved documentation. If the answer is not found in the provided documents, clearly state that the information is unavailable rather than making assumptions. Where appropriate, reference document titles and section headings.

Such prompts help minimise hallucinations and encourage transparency.

48. Improving Retrieval Quality

Several techniques can improve answer quality:

  • Use well-structured source documents.
  • Remove duplicate content.
  • Separate unrelated topics into different knowledge bases.
  • Keep documents current.
  • Select appropriate chunk sizes.
  • Enable reranking.
  • Use high-quality embedding models.
  • Review retrieval logs and user feedback.

Continuous refinement typically leads to measurable improvements over time.

49. Knowledge Base Maintenance

Knowledge bases require ongoing maintenance to remain effective.

Recommended practices include:

  • Archive obsolete documents.
  • Re-index updated files.
  • Apply consistent naming conventions.
  • Track document versions.
  • Remove duplicate uploads.
  • Schedule periodic quality reviews.

A well-maintained repository improves both retrieval accuracy and user confidence.

50. Integrating with Open WebUI

Many organisations use Open WebUI to provide a user-friendly interface for local AI models.

Typical architecture:

Users │ ▼ Open WebUI │ ▼ RAGFlow │ ▼ Ollama │ ▼ LLM

Open WebUI complements RAGFlow by offering an intuitive chat experience while RAGFlow manages document retrieval.

51. Engineering Use Case

An electrical engineering consultancy maintains:

  • IEC standards
  • Equipment manuals
  • Test procedures
  • Commissioning reports
  • Safety documentation

Engineers ask:

  • "Summarise the commissioning checklist."
  • "Which insulation resistance tests are required?"
  • "Compare Revision 2 and Revision 4."

The system retrieves relevant passages and produces responses grounded in internal documentation, reducing manual searching and improving consistency.

52. SME Use Case

A growing manufacturing SME uploads:

  • Employee handbooks
  • Quality manuals
  • ISO procedures
  • Customer support documentation
  • Supplier agreements

Staff members can quickly locate information such as:

  • Holiday policies.
  • Product installation procedures.
  • Warranty conditions.
  • Supplier requirements.

This reduces repetitive enquiries and accelerates onboarding for new employees.

53. Academic Research Use Case

A university research group indexes:

  • Journal articles
  • Theses
  • Conference papers
  • Laboratory notebooks
  • Grant documentation

Researchers use conversational search to:

  • Identify related work.
  • Compare methodologies.
  • Summarise literature.
  • Locate experimental results.

The platform becomes a collaborative research assistant while preserving institutional knowledge.

54. How KeenComputer.com Can Help

KeenComputer.com can assist organisations with designing and implementing effective enterprise knowledge platforms by providing:

  • Knowledge-base architecture planning.
  • Document migration and organisation.
  • Ubuntu, Docker and cloud deployment.
  • Integration with Joomla, WordPress and Magento.
  • REST API development.
  • AI infrastructure optimisation.
  • Security hardening.
  • Backup and disaster recovery.
  • User training and operational support.

These services help SMEs transform disconnected document repositories into searchable AI-powered knowledge systems that improve productivity and collaboration.

55. How IAS-Research.com Can Help

IAS-Research.com supports research-intensive organisations by providing expertise in:

  • Retrieval-Augmented Generation (RAG) strategy.
  • AI-assisted engineering workflows.
  • Embedded systems and Industrial IoT.
  • Digital twins and systems engineering.
  • Technical document curation.
  • Research knowledge-base development.
  • AI benchmarking and evaluation.
  • Proof-of-concept development.
  • Innovation consulting.

Its multidisciplinary engineering experience helps organisations apply AI to complex technical domains while maintaining scientific rigour and traceability.

56. Best Practices

Successful enterprise deployments typically follow these principles:

  • Start with a focused pilot project.
  • Build separate knowledge bases for different business functions.
  • Establish document governance policies.
  • Use high-quality source documents.
  • Monitor retrieval performance.
  • Collect user feedback.
  • Review and update models regularly.
  • Scale infrastructure as adoption grows.

57. Summary

Part 3 demonstrated how high-quality knowledge bases form the foundation of effective Retrieval-Augmented Generation systems. We explored document processing, chunking, embeddings, vector search, reranking and prompt engineering, along with practical workflows for engineering, research and SMEs.

In Part 4, we will focus on production deployment, including enterprise security, authentication, HTTPS, reverse proxies, monitoring, backup strategies, high availability, performance tuning and operational best practices for running RAGFlow and Ollama in business and research environments.

References

  1. RAGFlow Documentation – Knowledge Base Management.
  2. Ollama Documentation – Local Model Deployment.
  3. BAAI. BGE-M3 Embedding Model Documentation.
  4. BAAI. BGE-Reranker-v2 Documentation.
  5. Meta AI. Llama Model Documentation.
  6. Docker Documentation.
  7. Ubuntu Server Documentation.
  8. Linux Foundation. Container Best Practices.