Skip to content

feat(sarvam): add Sarvam provider support#2423

Open
EshwarCVS wants to merge 1 commit into
567-labs:mainfrom
EshwarCVS:feat/sarvam-provider-and-mode-eval
Open

feat(sarvam): add Sarvam provider support#2423
EshwarCVS wants to merge 1 commit into
567-labs:mainfrom
EshwarCVS:feat/sarvam-provider-and-mode-eval

Conversation

@EshwarCVS

Copy link
Copy Markdown

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-compatible
chat completions API.

Users can initialize clients with from_sarvam() or from_provider("sarvam/...").
The integration supports Mode.TOOLS, Mode.JSON_SCHEMA, and Mode.MD_JSON,
with Mode.MD_JSON as the default.

Changes

  • Register Provider.SARVAM in v2 provider specs, modes, and auto_client
  • Add from_sarvam() factory and _build_sarvam() routing
  • Wire Sarvam through OpenAI-compatible handlers
  • Add sarvam-30b and sarvam-105b to supported model lists
  • Add integration docs at docs/integrations/sarvam.md
  • Add v2 unit tests and live smoke tests (simple, stream, retries)

Testing

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`.

…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
@EshwarCVS

Copy link
Copy Markdown
Author

@jxnl Please review whenever you can.

Open for suggestions. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant