⚡ नया — Kimi K3 अब लाइव: अपनी Moonshot key जोड़ें →
दस्तावेज़

Sangam consensus से बेहतर-quality जवाब

← कुकबुक

एक model id बुलाएँ और मॉडलों के panel से reconciled जवाब पाएँ — और तय करें कि अतिरिक्त टोकन कब उचित हैं।

Sangam ensembleएडवांस्डउन्नत12 min

Sangam BharatRouter का consensus router है। एक मॉडल पर भरोसा करने के बजाय, आप एक virtual model id बुलाते हैं और मॉडलों का एक panel समानांतर में जवाब देता है; एक synthesiser उन्हें एक जवाब में मिलाता है। आपको दूसरी राय की विश्वसनीयता मिलती है — कम confident-but-wrong जवाब — एक सामान्य chat कॉल से।

consensus कब उचित है

  • high-stakes या ambiguous prompts — tax/legal reasoning, कुछ भी जहाँ ग़लत जवाब महँगा हो।
  • जिन्हें आप पहले से escalate करते — consensus अक्सर premium मॉडल को कम लागत पर बराबरी देता है।
  • नियमित ट्रैफ़िक नहीं — classification, extraction और छोटे drafts को panel नहीं चाहिए; उन्हें एक छोटे मॉडल को भेजें (देखें लागत घटाना)।

1 · डिफ़ॉल्ट: open consensus

bharatrouter/open-sangam एक panel चलाकर एक जवाब में मिलाता है, India-resident और कम-लागत। इसे किसी भी अन्य मॉडल की तरह बुलाएँ:

from openai import OpenAI

client = OpenAI(base_url="https://api.bharatrouter.com/v1", api_key="br-...")

resp = client.chat.completions.create(
    model="bharatrouter/open-sangam",
    messages=[{"role": "user", "content":
        "A Karnataka shop with \u20b938L turnover sells online to other states. "
        "Is GST registration mandatory, and which returns must it file?"}],
)
print(resp.choices[0].message.content)

2 · premium variant, BYOK-ready

bharatrouter/sangam एक frontier panel इस्तेमाल करता है — किसी closed consensus router का apples-to-apples प्रतिद्वंद्वी। यह INR catalog दरों पर, या BYOK से आपकी अपनी keys पर bill होता है:

curl https://api.bharatrouter.com/v1/chat/completions \
  -H "Authorization: Bearer br-..." -H "Content-Type: application/json" \
  -d '{
    "model": "bharatrouter/sangam",
    "messages": [{"role": "user", "content": "..."}],
    "upstream_key": "sk-your-own-provider-key"
  }'

3 · अपना panel बनाएँ

per-request एक panel और synthesiser बनाएँ — काम के लिए जिन मॉडलों पर भरोसा हो उन्हें मिलाएँ। panel को विविध रखें (अलग families उपयोगी रूप से असहमत होते हैं) और सक्षम synthesiser चुनें:

{
  "model": "sangam:{panel,synth}",
  "sangam": {
    "panel": ["gemma-4-e4b-it", "qwen3-32b", "gpt-5-mini"],
    "synth": "gpt-5"
  },
  "messages": [{"role": "user", "content": "..."}]
}

4 · टोकन लागत का ध्यान रखें

consensus N panel कॉल और एक synthesis चलाता है, इसलिए यह एकल कॉल के लगभग 3–5× टोकन खर्च करता है और सबसे धीमे panel सदस्य की गति पर ख़त्म होता है। कठिन 5% prompts पर शानदार सौदा, नियमित 95% पर ख़राब। किसी hot path में लगाने से पहले इसे Compare playground में अपने prompts पर मापें।

हर Sangam variant BYOK-capable है और India-resident routes पर पिन किया जा सकता है। पूरा संदर्भ: Sangam

और रेसिपी कुकबुक में, या पूराAPI reference देखें।