Update 07z foundational examples to use SarvamLLMService

This commit is contained in:
Mark Backman
2026-03-19 09:03:38 -04:00
parent 99b478b897
commit 696123f2c5
3 changed files with 13 additions and 9 deletions

View File

@@ -23,7 +23,7 @@ from pipecat.processors.aggregators.llm_response_universal import (
) )
from pipecat.runner.types import RunnerArguments from pipecat.runner.types import RunnerArguments
from pipecat.runner.utils import create_transport from pipecat.runner.utils import create_transport
from pipecat.services.openai.llm import OpenAILLMService from pipecat.services.sarvam.llm import SarvamLLMService
from pipecat.services.sarvam.stt import SarvamSTTService from pipecat.services.sarvam.stt import SarvamSTTService
from pipecat.services.sarvam.tts import SarvamHttpTTSService from pipecat.services.sarvam.tts import SarvamHttpTTSService
from pipecat.transcriptions.language import Language from pipecat.transcriptions.language import Language
@@ -72,9 +72,9 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
), ),
) )
llm = OpenAILLMService( llm = SarvamLLMService(
api_key=os.getenv("OPENAI_API_KEY"), api_key=os.getenv("SARVAM_API_KEY"),
settings=OpenAILLMService.Settings( settings=SarvamLLMService.Settings(
system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.", system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.",
), ),
) )

View File

@@ -21,7 +21,7 @@ from pipecat.processors.aggregators.llm_response_universal import (
) )
from pipecat.runner.types import RunnerArguments from pipecat.runner.types import RunnerArguments
from pipecat.runner.utils import create_transport from pipecat.runner.utils import create_transport
from pipecat.services.openai.llm import OpenAILLMService from pipecat.services.sarvam.llm import SarvamLLMService
from pipecat.services.sarvam.stt import SarvamSTTService from pipecat.services.sarvam.stt import SarvamSTTService
from pipecat.services.sarvam.tts import SarvamTTSService from pipecat.services.sarvam.tts import SarvamTTSService
from pipecat.transports.base_transport import BaseTransport, TransportParams from pipecat.transports.base_transport import BaseTransport, TransportParams
@@ -66,9 +66,9 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
voice="manisha", voice="manisha",
), ),
) )
llm = OpenAILLMService( llm = SarvamLLMService(
api_key=os.getenv("OPENAI_API_KEY"), api_key=os.getenv("SARVAM_API_KEY"),
settings=OpenAILLMService.Settings( settings=SarvamLLMService.Settings(
system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.", system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.",
), ),
) )

View File

@@ -81,7 +81,11 @@ class SarvamLLMService(OpenAILLMService):
**kwargs: Additional keyword arguments passed to ``OpenAILLMService``. **kwargs: Additional keyword arguments passed to ``OpenAILLMService``.
""" """
# Initialize default_settings with hardcoded defaults # Initialize default_settings with hardcoded defaults
default_settings = self.Settings(model="sarvam-30b") default_settings = self.Settings(
model="sarvam-30b",
wiki_grounding=None,
reasoning_effort=None,
)
# Apply settings delta (canonical API, always wins) # Apply settings delta (canonical API, always wins)
if settings is not None: if settings is not None: