株式会社オブライト
AI2026-03-16

Building RAG-Enabled Customer Support AI with Ollama and OpenClaw

This article explains how to build a RAG (Retrieval-Augmented Generation) customer support system by combining Ollama's embedding models with OpenClaw agents. Through vector database integration, you can generate accurate answers from FAQ documents and deploy AI support across multiple channels like LINE and Slack.


The Need for RAG-Enabled Customer Support AI

Traditional rule-based chatbots can only respond within predefined scenarios and lack the flexibility to answer diverse customer questions. On the other hand, directly using large language models (LLMs) risks generating outdated or inaccurate responses because they cannot reference the latest product information or internal documents. RAG (Retrieval-Augmented Generation) is a technology that retrieves relevant information from a vector database and passes it as context to an LLM, enabling accurate and up-to-date responses. By combining Ollama's local embedding models with OpenClaw's multi-channel agent capabilities, companies in Shinagawa-ku and Minato-ku can build high-quality customer support AI systems at low cost.

Selecting and Deploying Ollama Embedding Models

The core of a RAG system is the embedding model. Ollama supports multiple high-performance embedding models. Notable examples include nomic-embed-text (768 dimensions, English-focused) and mxbai-embed-large (1024 dimensions, multilingual support). For Japanese customer support, mxbai-embed-large is ideal. Installation is completed with `ollama pull mxbai-embed-large`, and embedding generation can be performed via REST API with `curl http://localhost:11434/api/embeddings -d '{"model": "mxbai-embed-large", "prompt": "customer inquiry"}'`. On Mac mini (Apple Silicon), Metal optimization enables embedding generation at speeds dozens of times faster than CPU, providing sufficient performance for real-time customer interactions.

Building a Vector Database with ChromaDB

ChromaDB is used to efficiently store and search embedding vectors. ChromaDB is lightweight, easy to use from Python, and supports both persistence and in-memory search. Setup is completed with `pip install chromadb`, and collection creation is written as `client.create_collection(name="faq_docs", metadata={"hnsw:space": "cosine"})`. FAQ documents are chunked (approximately 500 tokens), each chunk is embedded using Ollama, and stored in ChromaDB. During search, a customer's question is embedded with the same model, and the top 3 documents with the highest cosine similarity are retrieved with `collection.query(query_embeddings=[query_vec], n_results=3)`. Even small and medium-sized businesses in Shibuya-ku and Setagaya-ku can build systems handling thousands of FAQ documents.

Implementing a Document Ingestion Pipeline

Customer support documents exist in various formats such as PDF, Word, Markdown, and Notion. An efficient RAG system requires a pipeline to automatically ingest these. Using LangChain's `UnstructuredFileLoader` or `NotionDBLoader` allows uniform processing of different formats. After text extraction, use RecursiveCharacterTextSplitter for chunking and attach metadata (document title, creation date, category, etc.) to each chunk. These are batch-processed through Ollama's embedding API, and the returned vectors and metadata are stored in ChromaDB. Creating a script that runs periodically ensures that document updates are automatically reflected in the RAG system.

Integrating Search Tools into OpenClaw Agents

OpenClaw agents can be extended by adding custom tools. Implement RAG search functionality as a tool called `search_faq_docs` and register it in the agent configuration file `~/.openclaw/openclaw.json`. The tool receives a customer's question, generates embeddings with Ollama, searches ChromaDB for relevant documents, and returns the results to the agent. The agent uses the search results as context, passes them to an LLM on Ollama (e.g., llama3.3:70b), and generates the final response. Including instructions in the prompt like "Please respond based only on the following search results" prevents hallucinations and ensures accurate, document-based answers. A key advantage of OpenClaw is that once a tool is implemented, it automatically becomes available across all channels—LINE, Slack, Discord, WhatsApp, and more.

Multi-Channel Deployment and Routing Configuration

In the OpenClaw configuration file, bind each messaging channel to the RAG agent. By writing `"bindings": [{"channel": "line", "agent": "customer-support-rag", "priority": 1}, {"channel": "slack", "agent": "customer-support-rag", "priority": 1}]`, inquiries from LINE and Slack can be handled by the same RAG agent. Priority settings allow routing to different agents based on specific keywords or senders. For example, technical questions can be directed to a technical support RAG agent, while billing questions go to an accounting agent. In companies in Minato-ku and Ota-ku, hybrid operations are increasing where customers inquire via LINE and internal staff ask the same agent via Slack.

Tuning for Improved Response Accuracy

Improving the accuracy of a RAG system requires tuning both the retrieval and generation stages. In the retrieval stage, adjust the number of documents retrieved (n_results), use metadata filters (search only specific categories), and employ hybrid search (combining vector and keyword search). In the generation stage, optimize prompt templates, adjust the temperature parameter (0.1-0.3 for consistent responses), and set personas in the system message. For unanswerable questions, instruct the prompt to honestly say "This information is not included in the current documents" to prevent misinformation. Analyze logs to identify question patterns with frequent search failures or low-quality answers, and continuously improve documents and chunking strategies through an iterative improvement cycle.

Security and Privacy Considerations

Customer support data may include personal information and confidential details. A key advantage of Ollama-based RAG systems is that all processing is completed locally without sending data to external APIs. However, access control for documents stored in the vector database is critical. Set OS-level access permissions on ChromaDB's persistence directory to prevent unauthorized access. For documents containing personally identifiable information (PII), either anonymize them during ingestion or exclude them from the RAG system. Configure OpenClaw's logging settings to clearly define what customer inquiries are recorded and operate in compliance with privacy policies. For healthcare and financial companies in Meguro-ku and Shinagawa-ku, such privacy considerations are especially important.

Performance Optimization and Scaling

The bottlenecks in a RAG system are embedding generation, search, and LLM inference. On Mac mini (M4 Pro/Max), Metal acceleration completes embedding generation in under one second. ChromaDB search also completes in tens of milliseconds for thousands of records. The most time-consuming part is LLM inference, which can take 5-10 seconds for 70B models. For faster performance, use smaller models (8B or 13B) or reduce token count by simplifying the system prompt. As concurrent access increases, Ollama performs parallel processing as GPU/NPU memory allows, but load balancing across multiple Mac minis can also be considered. Using OpenClaw's routing capabilities, you can distribute traffic to different servers by channel or time of day.

Operations and Monitoring

Continuous monitoring is key to the success of a RAG customer support system in operation. Collect metrics from OpenClaw logs such as number of questions, average response time, search hit rate, and agent switching frequency. Visualizing these in monitoring tools like Grafana or Datadog allows you to grasp system health at a glance. Collect customer feedback (whether the answer was helpful) and review low-rated questions and responses for improvement. If documents are frequently updated, monitor automatic update pipeline logs for ingestion errors. Regularly conduct A/B testing of the RAG system, comparing different embedding models and chunking strategies to continuously improve accuracy.

Oflight Inc.'s AI Support System Development Services

Oflight Inc. (Shinagawa-ku, Tokyo) supports the development of RAG-enabled customer support systems using Ollama and OpenClaw. We analyze your FAQ documents and internal knowledge bases to propose optimal embedding models and chunking strategies. We provide end-to-end support from selecting and building vector databases like ChromaDB or Pgvector, integrating custom tools into OpenClaw agents, to multi-channel deployment on LINE, Slack, Discord, and more. Serving clients from SMEs to large enterprises primarily in Shinagawa-ku, Minato-ku, and Shibuya-ku, we deliver comprehensive AI solutions. If you are interested in building privacy-focused systems with local LLMs, please contact us.

Feel free to contact us

Contact Us