The Technology Behind the AI Fortune-Telling Trend: Prompt Engineering and Production Practices
This article breaks down why general-purpose large language models have been widely used for entertainment-style fortune-telling, and explains the engineering work required to ship such an application safely. It covers the product drivers behind the trend, the capability limits and risk checklist, a four-part prompt architecture, structured JSON output with post-processing validation, safety and compliance UX, a three-layer evaluation system, cost and performance governance, and a phased roadmap from single-turn entertainment to a content-sharing product. Readers will get practical patterns for constraining probabilistic generation with verifiable rules, guardrails, and observability.
1. Why AI Fortune-Telling Took Off
Over the past two years, many users have started treating general-purpose large language models as an oracle. They enter a birth time, a date, and a question, and the model returns a narrative about career, relationships, or finances. Screenshots of these “metaphysical prompts” then circulate on content communities, triggering waves of imitation and derivative posts. This wave did not begin with any single model generation: earlier general-purpose chat models and various niche novelty apps competed in the same space. What changed is that the spread of Chinese-language models lowered the barrier further.
From a product and engineering perspective, the drivers break down into five layers:
- Zero-marginal-cost curiosity: users get a personalized-sounding reading for free, so the cost of trying is near zero.
- High engagement and an illusion of personalization: the model echoes details the user supplied (time, place, the question at hand) and produces a long response that looks tailored.
- Language and cultural corpus fit: native handling of zodiac signs, solar terms, and traditional terminology reads naturally, with less translationese and fewer conceptual mismatches.
- Built-in social virality: outputs are screenshot-friendly, comparable, and arguable, which makes them spread naturally in communities.
- Comfort and a preference for certainty: in uncertain environments, structured and detailed narratives ease anxiety, regardless of whether the content is true.
One technical boundary must be stated up front: a large language model is a probabilistic generation system and cannot predict the future. What looks like accuracy is the combined effect of the Barnum effect (vague, broadly applicable descriptions judged as highly personal) and confirmation bias. Writing this constraint into the product spec is the prerequisite for every design decision that follows.
2. Capability Limits and Risk Checklist
Before implementation, defining what the system must not do matters more than defining what it can do.
- Factual risk: the model may produce pseudo-precise dates, amounts, or places that users read as commitments.
- Psychological risk: scenarios involving illness, debt, or relationship crises can cause real harm if the output states absolute conclusions.
- Compliance risk: regulated domains such as medical diagnosis, investment advice, and legal opinions must be avoided, and the entertainment nature must be labeled clearly.
- Data risk: birth details and contact information are personal data, so collection and retention must be minimized and encrypted.
- Cost risk: long context and multi-turn follow-ups quickly inflate token consumption; without quotas, the bill gets out of control.
3. Prompt Architecture: Turning Metaphysics into a Controllable Structure
A four-part template — role, constraints, input, output — is recommended instead of cramming every requirement into one sentence.
[Role] You are a traditional-culture narrative assistant for entertainment use.[Constraints]- Output entertainment content only; provide no medical, investment, or legal advice;- Never give definite dates, amounts, or health conclusions;- Use gentle, non-absolute wording; avoid creating anxiety;- If the user's input involves self-harm or a crisis, switch to care and help-seeking guidance.[Input] Time: {{birth_time}}; focus: {{topic}}; tone: {{tone}}[Output] Return JSON in the following structure:{"theme":"", "narrative":"", "actionable_tips":["","",""], "disclaimer":""}
Key points:
- Keep the role narrow: defining an “entertainment narrative assistant” rather than a “predictor” measurably reduces out-of-bounds output.
- Make constraints verifiable: each constraint should be checkable in post-processing with rules or a classifier.
- Decode into structure: fixed JSON makes front-end rendering, sensitive-word filtering, and analytics straightforward.
If you build on general-purpose capabilities from Baidu AI Cloud, the prompt templates can be decoupled from business code: templates are hosted in a configuration center, model calls are routed through a unified inference gateway, and logging plus monitoring with alerting close the loop on quality tracking.
4. Structured Output and Post-Processing Validation
Structured output is the key to stability. Illustrative code (pseudocode style, with generic interface names):
def run_entertainment_reading(user_input, prompt_template):prompt = prompt_template.render(**user_input)raw = llm_gateway.generate(prompt, temperature=0.7, max_tokens=600)data = safe_json_parse(raw)if not data:return fallback_response()data["narrative"] = mask_precise_claims(data["narrative"])data["narrative"] = append_disclaimer(data["narrative"])if crisis_detector.hit(user_input):return care_response()return data
Post-processing should include at least four checks:
- Format validation: if JSON parsing fails, fall back to templated copy so the front end never renders a blank screen.
- Pseudo-precision filtering: regex and entity recognition intercept dates, amounts, IDs, and other strongly committal expressions.
- Sensitive-domain classification: a lightweight classifier decides whether the request falls into medical, investment, or legal territory; hits are rewritten as generic suggestions.
- Crisis fallback: signals of self-harm or violence switch the response to care-oriented wording plus help-seeking resources.
5. Safety, Compliance, and Experience Design
- Explicit disclaimers: show “for entertainment only” both in the first turn and at the end of the result, so screenshots are not taken out of context.
- De-absolutize wording: replace “will definitely” with “you may want to watch for”, and turn verdicts into tendency descriptions.
- Minimize personal data: keep birth details at the necessary granularity, encrypt sensitive fields, and offer one-click deletion.
- Explainability: label results as “generated from the information you provided” to reduce misread authority.
- Human feedback loop: offer an “inaccurate / uncomfortable” feedback entry and route those samples back into the evaluation set.
6. Evaluation: Proving Quality Is Not Metaphysics
Novelty apps need quantitative metrics too. A three-layer evaluation is suggested:
- Safety layer: out-of-bounds rate (share of responses touching restricted topics), pseudo-precision hit rate, correct referral rate in crisis scenarios.
- Quality layer: structural completeness, JSON validity rate, repetition rate, human ratings of tone consistency.
- Business layer: share rate, follow-up question rate, negative feedback rate, average token cost per session.
The evaluation set should cover long-tail inputs (empty input, extremely long text, mixed languages, adversarial inducement), and a regression run should follow every prompt template change to avoid “edit one prompt, break a dozen scenarios.”
7. Cost and Performance Governance
- Tiered model routing: small-parameter models handle casual chat, large-parameter models handle complex narrative, split by intent.
- Context trimming: keep only necessary slots and summarize earlier turns to control input length.
- Caching and reuse: templated outputs for identical slot combinations can be cached to cut repeated inference.
- Rate limiting and quotas: enforce per-user and per-endpoint limits to prevent abuse and billing anomalies.
- Observability: collect latency, failure rate, and token usage uniformly, with alert thresholds configured.
On cloud infrastructure, inference services can run on a container platform, evaluation sets and template versions can live in object storage, and a message queue can smooth peak loads for batch sample回流, forming a complete engineering loop.
8. From Novelty to Product: An Evolution Roadmap
- Phase 1 — single-turn entertainment: validate the prompt template and fallback strategy.
- Phase 2 — multi-turn narrative: add slot memory and summary compression.
- Phase 3 — scenario templates: split prompt sets by theme such as studies, career, and relationships, each evaluated independently.
- Phase 4 — community sharing: produce shareable cards while keeping the entertainment label and feedback channel.
Conclusion
The popularity of AI fortune-telling looks like cultural novelty on the surface, but underneath it tests prompt engineering, structured generation, safety guardrails, and cost governance together. Confining uncertainty inside constraints, and serving users’ desire for certainty with engineering that is evaluable, rollback-capable, and observable, is the path that takes this class of application from a short-lived spike to something durably useful.
