⚡ नवीन — Kimi K3 आता लाइव: तुमची Moonshot की जोडा →
दस्तऐवज

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 पाहा.