AskKSA is an AI assistant I built to help people in Saudi Arabia, especially expatriates, to understand quickly and complete government tasks like Iqama, visa and Absher services by asking questions in simple English or Urdu, using semantic search over a curated Absher knowledge base and a modern LLM to turn that raw information into clear, step by step answers inside an easy Streamlit chat interface that saves time, reduces confusion and lets users give feedback so the assistant keeps getting better.
AskKSA is an AI-powered assistant designed to help expatriates and residents of Saudi Arabia navigate government services, including Iqama, visas, fines, and Absher. The assistant simplifies complex processes, provides guidance in English and Urdu, and offers accurate, step-by-step answers to frequently asked questions.
AskKSA is a comprehensive solution for expatriates living in Saudi Arabia. It tackles common challenges, such as understanding Iqama renewal processes, using Absher services, and finding reliable information on Saudi government portals. With a focus on user-friendly interaction and bilingual support, AskKSA ensures that users can access crucial government information quickly and in their preferred language.
While there are various systems available to navigate government services in Saudi Arabia, they often require users to visit multiple websites and rely on outdated or fragmented data. Existing tools may not support bilingual users, and many don’t provide contextual guidance. AskKSA fills these gaps by consolidating essential government services into a single platform with multilingual support, ensuring expatriates have access to reliable, up-to-date information through a user-friendly interface.
AskKSA uses a combination of modern technologies to deliver accurate answers:
Embedding Model (BGE-M3): The system converts user queries into a vector representation using advanced sentence transformers. This helps in better understanding the semantic meaning of the questions.
embed_model = SentenceTransformer(EMBED_MODEL_NAME) query_embedding = embed_model.encode([query], convert_to_numpy=True, normalize_embeddings=True)
FAISS Retrieval: After embedding the user query, the system performs semantic similarity search through a FAISS vector index to find the most relevant documents from the Absher dataset.
index = faiss.read_index(str(INDEX_PATH)) scores, ids = index.search(query_embedding, k=5)
Google Gemini 2.5: The assistant then processes the results and generates a final response, injecting context from the most relevant documents.
response = client.models.generate_content( model=DEFAULT_MODEL_NAME, contents=gemini_messages, ) return response.text
Multilingual Support: AskKSA supports both English and Urdu, providing localized responses based on the user's input language.
LANG_RULE_URDU = "Always answer in **Urdu using Urdu script** (the user asked in Urdu)." LANG_RULE_EN = "Always answer in **English** (the user asked in English)."

The application uses publicly available datasets and community-contributed resources to ensure comprehensive coverage of government services.
Streamlit Framework: The front-end is built using Streamlit, providing a responsive and modern user interface.
import streamlit as st st.set_page_config(page_title="AskKSA Chatbot", page_icon="🇸🇦")
FAISS: This high-performance similarity search tool helps retrieve the most relevant information based on user queries.
import faiss index = faiss.read_index(str(INDEX_PATH))
Sentence-Transformers (BAAI/bge-m3): These embeddings are used for semantic understanding and query matching.
from sentence_transformers import SentenceTransformer embed_model = SentenceTransformer(EMBED_MODEL_NAME)
Google Gemini 2.5: For language processing and generating coherent answers, Google’s advanced AI model is used.
import genai client = genai.Client(api_key=st.secrets.get("GOOGLE_API_KEY"))
User Input: The user asks a question in either English or Urdu.
typed_input = st.chat_input("Ask your question about Iqama / visas / Absher...")
Language Detection: The system detects the language of the query and processes it accordingly.
def is_urdu_text(text: str) -> bool: return bool(re.search(r"[\u0600-\u06FF]", text))
Data Retrieval: The system searches the FAISS index for the most relevant information.
retrieved = retrieve(query, embed_model, index, all_chunks, all_chunks_metadata, k=5)
Answer Generation: Google Gemini processes the retrieved information and generates a contextual answer.
reply = llm_chat(messages)
Feedback: After receiving the answer, the user can provide feedback on whether it was helpful, which helps improve the system.
st.session_state.feedback.append( {"question": user_input, "answer": answer, "label": "helpful"} )
The application is built on a modular architecture:
Data Layer: Data such as documents, metadata, and the FAISS index are stored and processed efficiently.
_check_files_exist([INDEX_PATH, CHUNKS_PATH, META_PATH])
Processing Layer: This layer involves embedding the user query, retrieving relevant documents, and processing them through Google Gemini.
Interface Layer: The front-end is built using Streamlit, allowing users to interact with the assistant easily. The assistant responds to the selected language with proper text rendering, particularly for Urdu.
st.markdown("<div class='urdu-text'>{text}</div>", unsafe_allow_html=True)
AskKSA significantly improves the user experience for expatriates. The integration of multilingual support and semantic search not only makes the tool more efficient but also bridges the language barrier for many users. This is especially important given that expatriates often struggle to navigate government portals in Arabic.

AskKSA has a measurable impact on expatriates' daily lives by saving time and reducing frustration when interacting with government systems. The feedback system also helps continuously improve the service, ensuring it meets users' needs and expectations.
AskKSA still has a few real limits. It depends on a curated snapshot of official Saudi and Absher information, so if those sources change or are unclear, some answers can end up incomplete or out of date, even though we try to ground everything in that content. Bilingual support is focused on English and Urdu, and Urdu is harder to handle well because of its script and tooling, so wording and nuance in that language may sometimes feel less polished. The system also runs a full RAG pipeline on each question, including embeddings, FAISS search, and a remote LLM, which can result in slow or failed responses at times, especially on poor connections or during heavy use. Finally, we have tuned and tested AskKSA primarily around common tasks like Iqama, visas, and key Absher services, so it may not yet cover rare or very specific edge cases, and users should still double-check critical decisions against the official portals when needed.
AskKSA simplifies the often confusing, complex processes involved in Saudi government services, offering clear, bilingual support for expatriates and residents. By combining powerful technologies like FAISS, Gemini 2.5, and Sentence-Transformers with an intuitive interface, AskKSA provides a comprehensive solution that saves time and reduces the stress of navigating government systems. Whether you need to check the status of your Iqama or navigate Absher services, AskKSA has you covered.