Merged
Conversation
- Fix critical bugs: wrong auth header (Bearer → api-subscription-key), wrong endpoint (/chat/completions → /v1/chat/completions), broken SSE streaming (message → delta), missing stream flag in request body - Restructure as single-module contrib/sarvam-ai with Builder pattern matching Gemini architecture - Add SarvamAiConfig with full API parameter support (temperature, topP, reasoningEffort, wikiGrounding, frequencyPenalty, presencePenalty) - Add SarvamAiLlmConnection for multi-turn streaming chat sessions - Add SarvamSttService with REST + WebSocket streaming STT (saaras:v3) - Add SarvamTtsService with REST + WebSocket streaming TTS (bulbul:v3) - Add SarvamVisionService for Document Intelligence (async job pipeline) - Add SarvamRetryInterceptor with exponential backoff + jitter - Add SarvamAiException with structured error fields - Add proper chat domain models (ChatRequest, ChatResponse, ChatChoice, ChatMessage, ChatUsage) handling both message and delta formats - Remove duplicate Sarvam code from core module - Add 35 unit tests covering all services Co-authored-by: Cursor <cursoragent@cursor.com>
Implements BaseLlm for Sarvam AI's OpenAI-compatible chat completions API with support for both streaming (SSE) and non-streaming modes, tool/function calling, and token usage tracking. Configurable via SARVAM_API_BASE and SARVAM_API_KEY env vars. Co-authored-by: Cursor <cursoragent@cursor.com>
- Add connect/read timeouts (30s/120s) to prevent hanging connections - Add stream_options.include_usage for token tracking in streaming - Fix function call history: serialize assistant tool_calls as proper OpenAI tool_calls array instead of plain text - Forward max_tokens from GenerateContentConfig - Extract shared HTTP connection setup into openConnection() - Make ObjectMapper a static singleton instead of per-tool allocation - Extract streaming finalization into emitFinalStreamResponse() - Log and surface error responses from non-streaming calls - Add proper instanceof checks in normalizeTypeStrings Co-authored-by: Cursor <cursoragent@cursor.com>
- 10 unit tests covering openAiMessageToParts (text, null, tool calls, empty args, priority, fallback), constructor, and connect() - Warn at construction time if SARVAM_API_KEY env var is missing Co-authored-by: Cursor <cursoragent@cursor.com>
Covers Chat (LLM), STT, TTS, Vision, Live Connections, retry logic, configuration, authentication, test coverage, and RAE integration. Co-authored-by: Cursor <cursoragent@cursor.com>
Tags added to 23 files across contrib/sarvam-ai (main + test) and core SarvamBaseLM/SarvamBaseLMTest. Co-authored-by: Cursor <cursoragent@cursor.com>
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.
No description provided.