FAQ Assistant Bot in Mobile App
An FAQ bot is the most underestimated task. Seems simple, done in a day, but in production you discover user questions don't match the knowledge base phrasing. "How to return a product?" and "money back" are the same, but without semantic search the system won't connect them.
Semantic Search vs Exact Match
Simple approach: user types keywords, search the base via LIKE or Elasticsearch. Works when users know the right terms.
For natural questions, you need embedding search. Each FAQ question and user query becomes a vector; find the nearest neighbor by cosine distance.
from openai import OpenAI
import numpy as np
client = OpenAI()
def embed(text: str) -> list[float]:
response = client.embeddings.create(
model="text-embedding-3-small",
input=text
)
return response.data[0].embedding
def find_best_faq(query: str, faq_embeddings: dict) -> tuple[str, float]:
query_vec = np.array(embed(query))
best_score = -1
best_key = None
for key, vec in faq_embeddings.items():
score = np.dot(query_vec, np.array(vec)) / (
np.linalg.norm(query_vec) * np.linalg.norm(np.array(vec))
)
if score > best_score:
best_score = score
best_key = key
return best_key, best_score
Set threshold score < 0.75 — respond "couldn't find a suitable answer, clarify please". Without it, the bot confidently returns irrelevant answers.
FAQ Database Structure
Each entry: question (or multiple phrasings), answer, category, tags. Multiple phrasings improve search recall.
Embeddings for FAQ are computed once at load and cached in Redis. On database update — invalidate cache and recalculate.
Mobile UI
For FAQ bots, combine: category buttons at start plus free text input.
User opens chat → sees 4–6 categories ("Shipping", "Payment", "Returns", "Account") → taps relevant one → bot offers top-3 questions in that category as chips. If none fit — write in own words.
This UX reduces NLP load and gives structure. Most users find answers in 2–3 taps without typing anything.
"Was this helpful?" button under each answer is mandatory. Negative ratings feed a list of questions for base improvement.
Development Process
Building FAQ base: collecting real questions from past interactions, categorizing.
Setting up embedding search, tuning relevance threshold.
Mobile UI with categories and free input.
Analytics: which questions go unanswered — input for expanding the base.
Timeline Estimates
FAQ bot with semantic search on ready base — 2–4 days. Including base structure development, categorization, analytics — up to 1 week.







