Fortune-Telling LINE Bot — Chinese Divination with a Fine-Tuned LLM算命 LINE Bot:用微調中文大語言模型解籤

Fortune-Telling LINE Bot — Chinese Divination with a Fine-Tuned LLM算命 LINE Bot:用微調中文大語言模型解籤

算命 LINE Bot:用微調中文大語言模型解籤
In short摘要

A LINE chatbot delivering Chinese fortune-telling readings from a fine-tuned traditional Chinese LLM, served asynchronously with FastAPI and Docker.一個以微調繁體中文大語言模型提供算命解答的 LINE 聊天機器人,後端以 FastAPI 非同步處理並用 Docker 部署。

What It Is

Fortune-Telling LineBot is a modular LINE chatbot — LINE being the messaging app most people in Taiwan use — that integrates a large language model to deliver personalized fortune-telling. Users chat with it to receive fortune predictions, astrological insights, and playful responses through a conversational interface. The goal is to combine the mystical allure of fortune-telling with LLMs, giving users a blend of entertainment and personalization.

The part I find most interesting is the integration itself: pairing an LLM with the LINE platform gives dynamic, context-aware responses that adapt to what the user types. The bot uses a fine-tuned traditional Chinese LLM to generate tailored predictions and suggestions, a modern take on traditional Chinese fortune-telling.

I built it to explore the intersection of LLMs and cultural practices — I’m interested in how technology can breathe new life into traditional activities like fortune-telling, and LINE’s reach in Taiwan made it the obvious place to put one. Getting a bot to give creative, context-aware responses while holding a mystical tone was the interesting challenge. It also works as a proof-of-concept for putting LLMs into real-time chatbot applications, and the modular design is meant to be reusable by other developers who want to experiment with LLMs or build their own chatbots.

My Role

This one was mine end to end — the FastAPI backend, the LINE Messaging API integration, the fine-tuned model, and the Docker deployment.

How It Works

The backend is a Python FastAPI service, chosen for its speed and support for non-blocking operations, so the bot can handle multiple user requests concurrently and stay responsive under high traffic; FastAPI’s automatic API documentation also makes development and debugging easier. It talks to users through the LINE Messaging API, which supports rich message types including text and multimedia. Generation runs on LLMs — for example models from Hugging Face or OpenAI — selected for their ability to produce human-like text and adapt to creative prompts. The whole thing ships with Docker support for containerized deployment on cloud platforms such as AWS, GCP, or Zeabur.

A few things I’d call out about the design:

  • Users supply their name, birth date, and a specific question, and the bot generates a prediction from those inputs rather than returning a canned reading.
  • Requests are processed asynchronously, so concurrent users don’t block each other.
  • Prompts are exposed as a configuration point, so the tone and style of predictions can be changed for culturally specific or themed readings.
  • The generation model is a fine-tuned traditional Chinese LLM rather than a general-purpose one — the same choice I made in SuiAudit, fine-tuning a small model for a narrow domain instead of adapting a general-purpose one.

What’s Next

I am no longer maintaining the bot, so what follows is what was planned rather than what is coming. The planned improvements were multilingual expansion, so Chinese traditional fortune-telling — Chinese zodiac predictions and the like — is accessible to a wider audience; multi-platform deployment onto other messaging platforms such as WhatsApp and Telegram; and continued model optimization by collecting more culturally relevant data for fine-tuning, to improve the accuracy and authenticity of the readings. The same structure could be adapted to other domains, such as educational chatbots, customer service agents, or storytelling platforms.

這是什麼

Fortune-Telling LineBot 是一個模組化的 LINE 聊天機器人——LINE 是台灣多數人使用的通訊軟體——串接大語言模型來提供個人化的算命解答。使用者透過對話介面和它聊天,得到運勢預測、星象解讀,以及一些帶點趣味的回覆。目標是把算命的神祕感和大語言模型結合起來,讓使用者同時得到娛樂性與個人化。

我覺得最有意思的部分就是這個串接本身:把大語言模型接上 LINE 平台,就能得到隨使用者輸入而變化、具備上下文的動態回覆。機器人使用一個微調過的繁體中文大語言模型來產生量身訂做的預測與建議,算是傳統中式算命的現代版本。

我做這個是想探索大語言模型與文化實踐的交會處——我很好奇技術能怎麼替算命這類傳統活動注入新的生命,而 LINE 在台灣的普及度讓它成為最理所當然的落腳處。要讓機器人在保持神祕語氣的同時給出有創意又貼合上下文的回覆,是其中有趣的挑戰。它同時也是把大語言模型放進即時聊天機器人應用的概念驗證,而模組化的設計是為了讓其他想實驗大語言模型或自己做聊天機器人的開發者可以重複使用。

我的角色

這個專案從頭到尾都是我做的——FastAPI 後端、LINE Messaging API 整合、微調後的模型,以及 Docker 部署。

如何運作

後端是 Python FastAPI 服務,選它是看上它的速度與對非阻塞操作的支援,讓機器人能同時處理多個使用者請求、在高流量下仍保持回應;FastAPI 自動產生的 API 文件也讓開發與除錯更容易。它透過 LINE Messaging API 與使用者溝通,該 API 支援文字與多媒體等多種訊息型態。生成則交給大語言模型——例如來自 Hugging Face 或 OpenAI 的模型——挑選標準是能產生近似真人的文字並適應創意型提示。整個服務附帶 Docker 支援,可容器化部署到 AWS、GCP 或 Zeabur 等雲端平台。

關於設計,有幾點我想特別提出來:

  • 使用者提供姓名、出生日期與一個具體問題,機器人依這些輸入生成預測,而不是回傳罐頭籤詩。
  • 請求以非同步方式處理,同時使用的人不會互相阻塞。
  • 提示詞被抽成一個設定點,因此預測的語氣與風格可以調整,做出貼合特定文化或特定主題的解答。
  • 生成模型是微調過的繁體中文大語言模型,而非通用模型——這和我在 SuiAudit 做的選擇一樣:為狹窄領域微調一個小模型,而不是改用通用模型。

接下來

規劃中的改進包括多語言擴充,讓生肖運勢這類中式傳統算命能被更多人接觸到;多平台部署,接上 WhatsApp、Telegram 等其他通訊平台;以及持續的模型優化,蒐集更多具文化脈絡的資料來微調,提升解答的準確度與道地感。同樣的結構也可以改用在其他領域,例如教育型聊天機器人、客服代理或說故事平台。