# Fortune-Telling LINE Bot — Chinese Divination with a Fine-Tuned LLM

Date: 2025-07-05
Source: https://kxhuang.dev/2025/07/05/chinese_fortunetell_LLM/
Description: A LINE chatbot delivering Chinese fortune-telling readings from a fine-tuned traditional Chinese LLM, served asynchronously with FastAPI and Docker.
Categories: project
Tags: AI, LLM, Chatbot
Author: Kai Xiu Huang (https://kxhuang.dev)

---
## 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](/2026/03/03/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.
