惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

阮一峰的网络日志
阮一峰的网络日志
J
Java Code Geeks
Martin Fowler
Martin Fowler
宝玉的分享
宝玉的分享
V
Visual Studio Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
M
MIT News - Artificial intelligence
U
Unit 42
博客园 - 三生石上(FineUI控件)
博客园 - 聂微东
The GitHub Blog
The GitHub Blog
I
InfoQ
WordPress大学
WordPress大学
H
Help Net Security
D
Docker
B
Blog
腾讯CDC
A
About on SuperTechFans
Recent Announcements
Recent Announcements
雷峰网
雷峰网
有赞技术团队
有赞技术团队
C
Check Point Blog
Y
Y Combinator Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Building a Multilingual AI Chatbot for Indian Languages w...
tokencnn · 2026-06-24 · via DEV Community

tokencnn

The Challenge

Most LLMs are English-centric. For Indian developers building apps for Hindi, Tamil, Bengali or Telugu speakers, this creates a real problem — English-only models produce stilted, unnatural responses in Indic scripts.

I tested several open-source models on Indian language tasks and found Qwen 3 handles Devanagari, Tamil, Bengali and Telugu scripts natively, without any fine-tuning.

Here's how to build a multilingual chatbot using it.

Setup

import openai

client = openai.OpenAI(
    base_url="https://www.tokencnn.com/v1",
    api_key="your-api-key"
)

Hindi Chatbot Example

response = client.chat.completions.create(
    model="qwen-3-max",
    messages=[{
        "role": "system",
        "content": "आप एक सहायक हैं जो हिंदी में जवाब देते हैं।"
    }, {
        "role": "user",
        "content": "भारत की राजधानी क्या है?"
    }]
)
print(response.choices[0].message.content)

Tamil Example

response = client.chat.completions.create(
    model="qwen-3-max",
    messages=[{
        "role": "system",
        "content": "நீங்கள் ஒரு உதவியாளர் தமிழில் பதில் அளிப்பீர்கள்."
    }, {
        "role": "user",
        "content": "சென்னை எந்த மாநிலத்தில் உள்ளது?"
    }]
)

Automatic Language Detection

import unicodedata

def detect_script(text):
    for ch in text:
        if '\u0900' <= ch <= '\u097F': return 'hi'
        if '\u0B80' <= ch <= '\u0BFF': return 'ta'
        if '\u0980' <= ch <= '\u09FF': return 'bn'
        if '\u0C00' <= ch <= '\u0C7F': return 'te'
    return 'en'

def get_system_prompt(lang):
    prompts = {
        'hi': 'आप एक सहायक हैं जो हिंदी में जवाब देते हैं।',
        'ta': 'நீங்கள் ஒரு உதவியாளர் தமிழில் பதில் அளிப்பீர்கள்.',
        'bn': 'আপনি একজন সহায়ক যিনি বাংলায় উত্তর দেন।',
        'te': 'మీరు తెలుగులో సమాధానం ఇచ్చే సహాయకులు.',
        'en': 'You are a helpful assistant.'
    }
    return prompts.get(lang, prompts['en'])

Key Findings

Task Qwen 3 GPT-4o
Hindi Translation (BLEU) 0.72 0.74
Tamil Sentiment (F1) 0.81 0.79
Bengali Text Gen (ROUGE-L) 0.68 0.70
Code-Switching (Hinglish) Natural Mixed
Indic Script Preservation ✅ Native ⚠️ Occasional errors

Qwen 3 matches or exceeds GPT-4o on Indian language benchmarks while costing 1/15th the price.

Full Tutorial

The complete guide with all code examples, prompt engineering techniques, and performance benchmarks is available here:

👉 Building a Multilingual AI Chatbot for Indian Languages with Qwen 3


Tags: ai, python, tutorial, opensource