带有FreeBSD知识的本地聊天机器人抹布
Local Chatbot RAG with FreeBSD Knowledge

原始链接: https://hackacad.net/post/2025-07-12-local-chatbot-rag-with-freebsd-knowledge/

是否需要为您的需求量身定制的本地freebsd聊天机器人吗?本指南显示了如何使用MACOS上的开源工具(可能适合其他OS)构建一个。 首先,安装Ollama(`brew install ollama`)来管理不同的LLM,然后绘制``gemma3:estment''(或`deepseek-r1`)之类的模型。 接下来,为用户界面和内置的矢量数据库安装Open-Webui(`curl -LSSF https://astral.sh/uv/install.sh | Sh`)。 关键步骤是将FreeBSD知识馈送到模型。下载并构建官方文档:克隆存储库(`git clone https://git.freebsd.org/doc.git`),安装依赖项(使用Brew,APT或YUM),然后使用`bmake Run''构建它。 将构建的文档上传到Open-Webui,创建一个名为“ FreeBSD官方文档”的知识库,该知识基础指向`〜/doc/documentation/public/public/en/books目录。 最后,在Open-Webui中创建一个称为“ FreeBSD助手”的模型工作区,选择您选择的基本模型(例如'Gemma3:最新模型),并设置系统提示,以定义聊天机器人作为FreeBSD专家的角色。选择“ FreeBSD官方文档”知识库。开始聊天!请记住,干净的结构化数据是更好结果的关键。降低温度设置以获得更精确的答案。

这个黑客新闻线程讨论了一个项目:一个本地聊天机器人,使用带有FreeBSD知识的检索演奏生成(RAG)。 Jkcalhoun表示有兴趣为Wikipedia创建类似的抹布系统,并将其视为个人“百科全书”。 Philippgille指出了使用特定代码库的DBPEDIA示例。 另一个_twist询问Ollama是否本地支持文档存储。 CoolSpot提到具有内置矢量数据库和文档存储功能的Open-Webui。丹利特(Danlitt)请求FreeBSD RAG项目的示例以进行更容易的评估,作者Hackacad承诺很快就会添加示例。 该线程还包括有关FreeBSD修补KDE2的幽默评论,而改为基于动漫数据来构建抹布系统。
相关文章

原文

Out of multiple conversations with people at BSD conferences, I noticed that many would love to see a chatbot that provides precise information on FreeBSD—for users, admins, and developers.

I strongly believe that there should not be an official chat.freebsd.org. Local chatbots work well and can be tweaked to fit personal needs.

This documentation is written for macOS with Apple Silicon (because of the GPU support), but should work on other OSes as well.


Step 1: Install Ollama (API for Multiple LLMs)

brew install ollama
ollama pull gemma3:latest

You can try deepseek-r1:latest or even deepseek-r1:70b on more powerful GPUs.

Step 2: Install Open-WebUI for a UI and Built-in Vector Database

curl -LsSf https://astral.sh/uv/install.sh | sh
DATA_DIR=~/.open-webui uvx --python 3.11 open-webui@latest serve

Now browse to http://localhost:5000/

Welcome to your own, local chatbot!

Step 3: Feed Knowledge to the Model

This is where the real work begins: You need to tell the LLM what’s right or wrong, what’s necessary, and how FreeBSD differs from Linux.

3.1 Download the FreeBSD Documentation

Follow this guide for more details.

Install dependencies (use apt, yum etc. according to your OS):

brew install hugo ruby git bmake

Update your shell configuration:

echo 'export PATH="$(brew --prefix ruby)/bin:$PATH"' >> ~/.zshrc
echo 'export PATH="$(brew --prefix hugo)/bin:$PATH"' >> ~/.zshrc
echo 'export GEM_PATH="$(gem environment gemdir)"' >> ~/.zshrc
echo 'export PATH="${GEM_PATH}/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

Install required gems:

sudo gem install rouge asciidoctor asciidoctor-pdf asciidoctor-epub3

Clone and build the FreeBSD documentation:

git clone https://git.FreeBSD.org/doc.git ~/doc
cd ~/doc/documentation
bmake run USE_RUBYGEMS=YES RUBY_CMD=$(brew --prefix ruby)/bin/ruby

More information can be found here: https://docs.freebsd.org/en/books/fdp-primer/overview/#mac-os-installation-process

3.2 Upload Documentation to Open-WebUI

Go to: http://localhost:5000/workspace/knowledge

Click +

Add a knowledge base called "FreeBSD Official Docs"

Add the folder: ~/doc/documentation/public/en/books

3.3 Create a Model Workspace

Go to: http://127.0.0.1:5000/workspace/models

Add a new workspace called "FreeBSD Helper"

Base Model: gemma3:latest
(Or whatever you downloaded via `ollama pull`)

System Prompt

Your are a bot that helps to use, administrate and develop everything that has to do with FreeBSD.
You give technical responses and be very precise. Make sure you use proper FreeBSD tools and don't mistake it with Linux.
You online use the knowledge provided.

Select Knowledge: “FreeBSD Official Docs”

Step 4: Chat Away

Now open a new chat window and select “FreeBSD Helper” as your model.

You might be tempted to add more data, but remember:

The more unstructured the data, the more likely the LLM will give poor results. 
E. g. if you give it your PDF invoices it will just fail. 
(There are tool for parsing them correctly, but that's not part of this post. Wouldn't fit into 10 posts :-) )

You can use the slider on the top left and lower the value Temperature, this will give you more precise answers.

The hardest part is getting the source data into proper shape—which, thankfully, has already been done by the amazing FreeBSD documentation team.

联系我们 contact @ memedata.com