AiMazigh AI
"Empowering the Amazigh community through Artificial Intelligence — preserving heritage, boosting productivity, and opening doors for innovation."
Inspiration
The Amazigh (Berber) people are one of North Africa's oldest indigenous communities, with a rich cultural heritage spanning thousands of years. Yet in the digital age, Tamazight language and culture remain vastly underrepresented in AI technologies. Most modern AI assistants struggle with:
- Understanding Tamazight (in Tifinagh, Latin, or Arabic scripts)
- Providing culturally relevant responses for the Amazigh community
- Supporting the trilingual reality of Morocco (Tamazight, Arabic, French) When Google released the Gemini API with its powerful multilingual capabilities, I saw an opportunity: what if we could create an AI assistant that truly serves the Amazigh community? Not just a translation layer, but an intelligent agent that understands, respects, and celebrates Amazigh culture.
The vision was clear: build AiMazigh AI — a dedicated AI assistant that bridges the gap between cutting-edge technology and cultural preservation.
What it does
AiMazigh AI is a full-featured AI chat assistant specifically designed for the Amazigh community:
Core Features
| Feature | Description |
|---|---|
| Multilingual Chat | Seamlessly communicates in Tamazight (Tifinagh/Latin), French, English, and Arabic |
| Document Intelligence | Upload PDFs and get AI-powered answers based on document content |
| Voice Interaction | Text-to-speech and speech-to-text for accessible, hands-free usage |
| Conversation Memory | Persistent chat history with multiple conversation threads |
| Streaming Responses | Real-time, animated text responses for a natural chat experience |
| Mobile-First Design | Responsive interface that works beautifully on any device |
Cultural Identity
AiMazigh AI is more than a chatbot — it's a digital ambassador for Amazigh culture:
- Celebrates and respects Amazigh history and traditions
- Provides accurate information about Amazigh heritage
- Supports Tifinagh script (ⵜⴰⵎⴰⵣⵉⵖⵜ) for authentic cultural representation
- Designed with warm, amber-gold aesthetics inspired by Amazigh art
Curated Vocabulary Knowledge Base
One of our key differentiators is a hand-curated Amazigh vocabulary database embedded in the system prompt. This ensures accurate, consistent language use — unlike generic AI models that often hallucinate or mix dialects incorrectly. Sample vocabulary entries:
| Amazigh (Tassousit) | Script | Meaning |
|---|---|---|
| Azul (أزول) | ⴰⵣⵓⵍ | Hello |
| Tanmmirt (تانميرت) | ⵜⴰⵏⵎⵎⵉⵔⵜ | Thank you |
| Izm (إيزم) | ⵉⵣⵎ | Lion |
| Tafukt (تافوكت) | ⵜⴰⴼⵓⴽⵜ | Sun |
| Anzar (أنزار) | ⴰⵏⵣⴰⵔ | Rain |
The full knowledge base covers 60+ vocabulary entries across categories:
- Pronouns & demonstratives
- Family terms
- Body parts
- Animals & nature
- Common verbs & useful phrases This vocabulary layer ensures the AI speaks authentic Tamazight — not a broken approximation.
How we built it
Frontend Architecture
Built a modern Next.js 14 application with:
src/
├── app/
│ ├── api/chat/ # API route for Gemini integration
│ ├── page.tsx # Main chat interface
│ └── globals.css # Custom theming
├── components/
│ ├── ChatMessage.tsx # Message bubbles with markdown
│ ├── ChatInput.tsx # Input with voice support
│ ├── PDFUpload.tsx # Document processing
│ └── Sidebar.tsx # Conversation management
└── hooks/
└── useVoice.ts # TTS/STT integration
Key Technologies
- Next.js 14 with App Router for server-side rendering
- TypeScript for type-safe development
- Tailwind CSS for responsive styling
- PDF.js for client-side PDF parsing
- Web Speech API for voice input/output
Backend: n8n + Gemini API Integration
Created a webhook-based workflow in n8n:
┌──────────┐ ┌───────────────┐ ┌──────────┐ ┌──────────┐
│ Webhook │ → │ Prepare Prompt│ → │ AI Agent │ → │ Response │
│ Trigger │ │ (Code Node) │ │ (Gemini) │ │ (JSON) │
└──────────┘ └───────────────┘ └──────────┘ └──────────┘
System Prompt Configuration:
You are Aimazigh AI, a dedicated assistant empowering the Amazigh community.
Your mission is to preserve heritage, boost productivity, and open doors for innovation.
Identity & Tone:
- You are proud, knowledgeable, and helpful.
- You respect and celebrate Amazigh culture, history, and language (Tamazight).
- You can speak/write in English, French, and Tamazight (using Tifinagh or Latin script).
Guidelines:
- Provide accurate, helpful answers for business, technology, and daily tasks.
- If a document is provided, strictly answer based on it.
- Be concise and clear.
Streaming Implementation
Implemented real-time response streaming with adaptive animation:
// Dynamic typing speed based on buffer size
let chunkSize = 1, delay = 30;
if (newPart.length > 100) { chunkSize = 5; delay = 5; }
else if (newPart.length > 20) { chunkSize = 2; delay = 10; }
while (charIndex < newPart.length) {
displayedText += newPart.substring(charIndex, charIndex + chunkSize);
setMessages(prev => updateLastMessage(prev, assistantMessage));
await new Promise(r => setTimeout(r, delay));
}
Challenges we ran into
1. Tifinagh Script Rendering
Problem: Many browsers and systems don't properly render Tifinagh script (ⵜⴰⵎⴰⵣⵉⵖⵜ). Solution: Implemented fallback fonts and tested across platforms. Added Latin script alternatives for maximum compatibility.
2. Multilingual Context Switching
Problem: The AI would sometimes respond in the wrong language or mix languages inconsistently. Solution: Refined the system prompt to explicitly handle language preferences and added context about when to use each language.
3. PDF Processing in Browser
Problem: Large PDFs would crash the browser during parsing. Solution: Implemented chunking with an 8,000 character context limit:
const limitedContext = context.substring(0, 8000);
4. Streaming Response Parsing
Problem: n8n would sometimes return JSON-wrapped responses instead of raw text. Solution: Built robust response cleaning that handles both formats:
if (trimmed.startsWith('{"response":')) {
const parsed = JSON.parse(fullRawText);
cleanFullText = parsed.response;
}
5. Mobile Responsiveness
Problem: The sidebar and chat interface were clunky on mobile devices.
Solution: Implemented a sliding sidebar with backdrop overlay and touch-friendly gestures.
Accomplishments that we're proud of
Culturally Authentic Design — Created a warm, amber-gold aesthetic inspired by Amazigh art and craftsmanship.
Full Voice Support — Implemented both text-to-speech (for responses) and speech-to-text (for input), making the app accessible to users who prefer voice interaction.
Document Intelligence — Users can upload PDFs and ask questions about their content, powered by Gemini's context understanding.
Real-Time Streaming — Responses appear character-by-character with natural typing animation, making conversations feel alive.
True Multilingual Support — Seamlessly handles Tamazight, French, English, and Arabic in the same conversation.
Production Deployed — Live and accessible at aimazigh.org, serving real users.
What we learned
Technical Insights
Gemini API is powerful for multilingual tasks — It handled Tamazight surprisingly well, even with limited training data for the language.
n8n simplifies AI orchestration — The webhook-based workflow made it easy to iterate on prompts without redeploying the frontend.
Streaming UX matters — The difference between a "waiting" experience and seeing text appear in real-time dramatically improves perceived responsiveness.
Voice APIs are browser-dependent — The Web Speech API has quirks across browsers; proper feature detection is essential.
Cultural Lessons
Representation matters — Building technology that celebrates underrepresented cultures creates genuine emotional connection with users.
Language preservation is urgent — Many Amazigh speakers lit up when they saw an AI that could understand their language.
3. Accessibility is cultural — Supporting voice input/output isn't just convenience; for some users, it's the only way they can interact with technology.
What's next for AiMazigh AI
Short-term (Next 3 months)
- [ ] Fine-tune a custom model specifically on Amazigh cultural content
- [ ] Add Tifinagh keyboard for native script input
- [ ] Implement RAG with Supabase for knowledge base expansion
- [ ] Create Amazigh language learning mode
Medium-term (6 months)
- [ ] Voice cloning for culturally appropriate TTS voices
- [ ] Mobile app (React Native) for offline support
- [ ] Integration with Amazigh cultural organizations
- [ ] Community-contributed knowledge base
Long-term Vision
- [ ] Preserve endangered Amazigh dialects through AI documentation
- [ ] Create educational tools for Tamazight language learning
- [ ] Build APIs for other developers to create Amazigh-first applications
- [ ] Expand to other underrepresented North African communities
Built with
Next.js, TypeScript, React, Tailwind CSS, Gemini API, n8n, Node.js, PDF.js, Web Speech API, Vercel
Built by: Yassine Iraamane
Live Demo: aimazigh.org
Contact: yassine@aixml.org
GitHub: github.com/yasxai
ⴰⵣⵓⵍ ⴼⵍⵍⴰⵡⵏ — Azul fellawn — Welcome, everyone
Built With
- gemini-api
- n8n
- next.js
- node.js
- pdf.js
- react
- tailwind-css
- typescript
- vercel
- web-speech-api
Log in or sign up for Devpost to join the conversation.