feat(sarvam): add Sarvam provider support#2423
Open
EshwarCVS wants to merge 1 commit into
Open
Conversation
…ovider
Add first-class Sarvam AI integration for the OpenAI-compatible Indic chat API (sarvam-30b, sarvam-105b) through from_sarvam() and from_provider("sarvam/...").
- Register Sarvam in v2 provider specs, modes, and auto-client routing
- Reuse OpenAI-compatible handlers for TOOLS, JSON_SCHEMA, and MD_JSON
- Default mode to MD_JSON for structured extraction
- Add integration docs, smoke tests, and v2 client/handler coverage
Author
|
@jxnl Please review whenever you can. Open for suggestions. Thanks. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds Sarvam AI as a first-class Instructor provider for structured outputs on
Indic chat models (
sarvam-30b,sarvam-105b) via Sarvam's OpenAI-compatiblechat completions API.
Users can initialize clients with
from_sarvam()orfrom_provider("sarvam/...").The integration supports
Mode.TOOLS,Mode.JSON_SCHEMA, andMode.MD_JSON,with
Mode.MD_JSONas the default.Changes
Provider.SARVAMin v2 provider specs, modes, andauto_clientfrom_sarvam()factory and_build_sarvam()routingsarvam-30bandsarvam-105bto supported model listsdocs/integrations/sarvam.mdTesting
uv run ruff check instructor tests/llm/test_sarvam tests/v2/test_sarvam_client.py uv run ruff format instructor tests/llm/test_sarvam tests/v2/test_sarvam_client.py uv run pytest tests/v2/test_sarvam_client.py tests/v2/test_client_unified.py -k SARVAM -q uv run pytest tests/llm/test_sarvam/test_simple.py tests/llm/test_sarvam/test_stream.py tests/llm/test_sarvam/test_retries.py -q Live smoke tests require `SARVAM_API_KEY`.