Albanian Rules Bot Logo
Technical Documentation

🎓 Purpose of this document: This section explains how the chatbot works — not just to help you understand the tool, but also to teach you about Artificial Intelligence (AI) technology. It's written for everyone: MPs, parliamentary staff, and interested citizens.

1. What is Artificial Intelligence (AI)?

Artificial Intelligence (AI) is technology that enables a computer to "understand" and respond to questions in human language. Think of it as a virtual assistant that has read all parliamentary documents and can answer your questions instantly.

🧠 Simple analogy: Imagine a specialized librarian who knows every page of the Parliamentary Rules by heart. When you ask a question, they find the relevant sections and give you a clear answer. That's what the AI does — but faster.

Which AI is Used?

GPT-4 (OpenAI)

The main AI model that formulates responses. GPT-4 is one of the most advanced AI models in the world, trained on billions of texts.

Embeddings (Vectors)

Technology that converts text into numbers to find similar questions. This enables "intelligent" searching, not just keyword matching.

Why "Low Creativity"?

AI can be too "creative" and make up information that sounds true but isn't (called "hallucinations"). For legal and parliamentary documents, this is dangerous. Therefore, we've configured the AI with low creativity (temperature 0.1-0.3) to provide only answers grounded in official documents.

2. Reference Documents
Primary Source
📜 Rules of Procedure of the Assembly of the Republic of Albania
  • Version: Approved in 2026

  • Articles: 1-200+ (all procedural articles)

  • Languages: Albanian (with English translations)

  • Link: Download PDF

Supporting Documents
📋 Code of Conduct for Administration

Download PDF

📚 Code of Conduct for MPs

Download PDF

📖 Detailed Guide to Conduct in Parliament

View documents

📝 Declaration Templates

Gift declaration and participation in third-party organized activities templates

3. How Does the Chatbot Work? (RAG — Retrieval Augmented Generation)
🧩 5 Core Elements of a Chatbot
🤖

LLM

Generates responses

📚

RAG

Improves accuracy

🔢

Vectors

Text → Numbers

🔍

Semantic Search

Finds relevant content

📝

Prompt Template

Instructions for AI

❓ What is RAG?

Retrieval-Augmented Generation (RAG) improves AI chatbot responses by combining an LLM with a search function. Instead of relying only on the model's internal knowledge, it retrieves relevant documents or data (using semantic search) and then uses that information to generate a more accurate, grounded answer.

📊 Phase 1: Information is Converted into "Vectors"

(This happens before the chatbot is ready to use)

📄→📄📄📄
1. Breaking into "Chunks"

Information is broken into smaller pieces (paragraphs, pages, or sections)

📄→🔢
2. Converting to Vectors

Each chunk is converted into long numbers called "vectors"

🔢→💾
3. Storing in Database

Vectors are grouped by similarity and stored, enabling "semantic search"

🔄 Phase 2: The RAG Loop (When a User Asks a Question)
1

User asks a question

"How does voting work in plenary session?"

2

Question → Vector

The system converts the question into numbers (a vector)

3

Database search

The system searches for similar vectors in the database

4

Fragments retrieved

The 5 most relevant fragments are retrieved

5

Sent to LLM

Question + Fragments + Prompt are sent to GPT-4

6

Response generated

The LLM writes a response based ONLY on the provided information

🤔 Why is RAG better than regular AI?

❌ AI without RAG (regular ChatGPT)

  • • Tries to "remember" from training

  • • May make up facts (hallucinations)

  • • Information may be outdated

  • • Cannot cite specific sources

✅ AI with RAG (this chatbot)

  • • Always searches current documents

  • • Responses based on real facts

  • • Information is up-to-date

  • • Cites specific articles and documents

4. System Prompt (AI Instructions)

What is a System Prompt? It's the foundational instruction given to the AI model to define its role, behavior, and response style. This prompt is sent with every conversation before the user's question.

🤖 System Prompt (English)
You are an informational assistant that ONLY cites official parliamentary documents of the Assembly of the Republic of Albania. You do NOT express opinions, interpretations, or advice — you only quote directly from source documents.

Source Documents:
1. Rules of Procedure of the Assembly of the Republic of Albania (Decision No. 166/2004, amended through No. 57/2025)
2. Internal Regulations of the Assembly Administration
3. Code of Conduct for Assembly Administration
4. Code of Ethics for Members of Parliament
5. Detailed Guide to Conduct in the Assembly
6. Declaration Templates (gifts, participation in third-party activities)

**CRITICAL RULES:**
- ALWAYS cite directly from official documents
- NEVER provide opinions, interpretations, or judgments
- NEVER use language like "should", "must", "it is important", "it is crucial" — only state what the documents say
- If the question requires an opinion, direct users to official documents
- Present only facts as written in the sources

How to respond:

**For questions about the chatbot (meta-questions):**
If the user asks about what they can ask, how the chatbot works, or what you can do, provide a brief, friendly, and clear response. For example:
- List the main topics you cover (session procedures, voting, committees, code of conduct, etc.)
- Be warm and accessible
- Don't launch into lengthy procedural explanations unless asked

**For questions about parliamentary procedures:**
Cite directly from official documents. Your response should:
- Quote the specific article, paragraph, or section (e.g., "According to Article 15, paragraph 2...")
- Present the document text without adding interpretations
- Provide the full document reference

Always provide responses using **HTML formatting**:
- Use `<strong>` for bold headings
- Use `<ul><li>` for bulleted lists and `<ol><li>` for numbered lists
- Use `<p>` to separate different sections
- Avoid large blocks of text, break content into paragraphs

Constraints:
- Limit responses to 200–400 words for clarity
- ALWAYS cite specific rule clauses
- Base explanations ONLY on official document text
- Maintain a neutral, factual tone — no opinions

Source Priority:
1. Rules of Procedure of the Assembly of the Republic of Albania (Decision No. 166/2004, amended by No. 57/2025)
2. Code of Conduct and Code of Ethics
3. Internal Regulations of the Administration
4. Guides and declaration templates

Always cite article numbers in the format: "Article 15" or "Article a/1".
How It Works
  • 1. Role Definition: The AI identifies itself as a specialized assistant for Albanian parliamentary documents.

  • 2. Source Documents: Specifies the 6 source documents from which it can draw information.

  • 3. Response Style: Instructs the AI to provide concise, professional answers with accurate citations.

  • 4. Formatting: Requires HTML formatting for clear response structure.

  • 5. Constraints: Sets limits on response length and requires nonpartisan tone.

  • 6. Source Priority: Defines the ranking of documents by importance.

⚙️ Configuration: The System Prompt is stored in config/chat.php and can be modified to improve chatbot behavior.

5. Performance and Optimization
~2-5s

Average response time

95%+

Response accuracy

7 days

Response cache

6. Security and Privacy

Full encryption: All data is transmitted via HTTPS and stored encrypted.

  • Session TTL: 60 minutes (automatically cleaned)

  • Data minimization: Only necessary data is stored

  • GDPR compliant: Respects right to data deletion

  • No personal data: No personally identifiable information stored

7. Current Limitations and Future Improvements
⚠️ Current Limitations
  • No access to real-time information

  • Focus only on Parliamentary Rules

  • May have errors in complex interpretations

  • Does not provide official legal advice

🚀 Planned Improvements
  • Addition of new legal documents

  • Improved response accuracy

  • More interactive interface

  • Integration with other parliamentary systems

8. Technical Contact

For technical questions or issue reporting: