feat: enable Sarvam Models

This commit is contained in:
Abhishek Kumar 2026-01-12 18:04:10 +05:30
parent 92bdfd6cac
commit 514d9c5238
4 changed files with 25 additions and 18 deletions

View file

@ -166,7 +166,7 @@ async def initiate_call(
workflow_run_id=workflow_run.id,
)
except Exception as e:
logger.error(
logger.warning(
f"Failed to initiate call for workflow run {workflow_run.id}: {e}"
)
raise HTTPException(

View file

@ -14,6 +14,7 @@ from pydantic import BaseModel
from sqlalchemy import text
from sqlalchemy.future import select
from starlette.responses import HTMLResponse
from starlette.websockets import WebSocketDisconnect
from api.db import db_client
from api.db.models import OrganizationConfigurationModel, UserModel
@ -563,9 +564,15 @@ async def websocket_endpoint(
websocket, workflow_id, user_id, workflow_run_id
)
except WebSocketDisconnect as e:
logger.info(f"WebSocket disconnected: code={e.code}, reason={e.reason}")
except Exception as e:
logger.error(f"Error in WebSocket connection: {e}")
await websocket.close(1011, "Internal server error")
try:
await websocket.close(1011, "Internal server error")
except RuntimeError:
# WebSocket already closed, ignore
pass
@router.post("/twilio/status-callback/{workflow_run_id}")

View file

@ -263,13 +263,13 @@ SARVAM_LANGUAGES = [
]
# @register_tts
# class SarvamTTSConfiguration(BaseTTSConfiguration):
# provider: Literal[ServiceProviders.SARVAM] = ServiceProviders.SARVAM
# model: str = Field(default="bulbul:v2", json_schema_extra={"examples": SARVAM_TTS_MODELS})
# voice: str = Field(default="anushka", json_schema_extra={"examples": SARVAM_VOICES})
# language: str = Field(default="hi-IN", json_schema_extra={"examples": SARVAM_LANGUAGES})
# api_key: str
@register_tts
class SarvamTTSConfiguration(BaseTTSConfiguration):
provider: Literal[ServiceProviders.SARVAM] = ServiceProviders.SARVAM
model: str = Field(default="bulbul:v2", json_schema_extra={"examples": SARVAM_TTS_MODELS})
voice: str = Field(default="anushka", json_schema_extra={"examples": SARVAM_VOICES})
language: str = Field(default="hi-IN", json_schema_extra={"examples": SARVAM_LANGUAGES})
api_key: str
TTSConfig = Annotated[
@ -278,7 +278,7 @@ TTSConfig = Annotated[
OpenAITTSService,
ElevenlabsTTSConfiguration,
DograhTTSService,
# SarvamTTSConfiguration,
SarvamTTSConfiguration,
],
Field(discriminator="provider"),
]
@ -369,12 +369,12 @@ class DograhSTTService(BaseSTTConfiguration):
SARVAM_STT_MODELS = ["saarika:v2.5", "saaras:v2"]
# @register_stt
# class SarvamSTTConfiguration(BaseSTTConfiguration):
# provider: Literal[ServiceProviders.SARVAM] = ServiceProviders.SARVAM
# model: str = Field(default="saarika:v2.5", json_schema_extra={"examples": SARVAM_STT_MODELS})
# language: str = Field(default="hi-IN", json_schema_extra={"examples": SARVAM_LANGUAGES})
# api_key: str
@register_stt
class SarvamSTTConfiguration(BaseSTTConfiguration):
provider: Literal[ServiceProviders.SARVAM] = ServiceProviders.SARVAM
model: str = Field(default="saarika:v2.5", json_schema_extra={"examples": SARVAM_STT_MODELS})
language: str = Field(default="hi-IN", json_schema_extra={"examples": SARVAM_LANGUAGES})
api_key: str
# Speechmatics STT Service
@ -423,7 +423,7 @@ STTConfig = Annotated[
OpenAISTTConfiguration,
DograhSTTService,
SpeechmaticsSTTConfiguration,
# SarvamSTTConfiguration,
SarvamSTTConfiguration,
],
Field(discriminator="provider"),
]

@ -1 +1 @@
Subproject commit dffa63e802834b6c10403522ef7b06400f5bf027
Subproject commit a1d3062446240b6b27ebc787d28578e4561e7441