wrapper fixes
This commit is contained in:
@@ -23,7 +23,6 @@ from pipecat.processors.aggregators.llm_response_universal import (
|
||||
)
|
||||
from pipecat.runner.types import RunnerArguments
|
||||
from pipecat.runner.utils import create_transport
|
||||
from pipecat.services.openai.base_llm import OpenAILLMSettings
|
||||
from pipecat.services.sarvam.llm import SarvamLLMService
|
||||
from pipecat.services.sarvam.stt import SarvamSTTService
|
||||
from pipecat.services.sarvam.tts import SarvamTTSService
|
||||
@@ -60,34 +59,24 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
|
||||
logger.info("Starting bot")
|
||||
|
||||
stt = SarvamSTTService(
|
||||
model="saaras:v3",
|
||||
settings=SarvamSTTService.Settings(model="saaras:v3"),
|
||||
api_key=_require_env("SARVAM_API_KEY"),
|
||||
)
|
||||
|
||||
tts = SarvamTTSService(
|
||||
model="bulbul:v3",
|
||||
settings=SarvamTTSService.Settings(model="bulbul:v3"),
|
||||
api_key=_require_env("SARVAM_API_KEY"),
|
||||
)
|
||||
|
||||
llm = SarvamLLMService(
|
||||
api_key=_require_env("SARVAM_API_KEY"),
|
||||
model="sarvam-30b",
|
||||
settings=SarvamLLMService.Settings(model="sarvam-30b"),
|
||||
system_instruction=(
|
||||
"You are a helpful LLM in a WebRTC call. Your goal is to demonstrate your capabilities in a succinct way. Your output will be spoken aloud, so avoid special characters that can't easily be spoken, such as emojis or bullet points. Respond to what the user said in a creative and helpful way."
|
||||
),
|
||||
)
|
||||
|
||||
messages: list[Any] = [
|
||||
{
|
||||
"role": "system",
|
||||
"content": (
|
||||
"You are a helpful LLM in a WebRTC call. Your goal is to "
|
||||
"demonstrate your capabilities in a succinct way. Your output "
|
||||
"will be spoken aloud, so avoid special characters that can't "
|
||||
"easily be spoken, such as emojis or bullet points. Respond to "
|
||||
"what the user said in a creative and helpful way."
|
||||
),
|
||||
},
|
||||
]
|
||||
|
||||
context = LLMContext(messages)
|
||||
context = LLMContext()
|
||||
user_aggregator, assistant_aggregator = LLMContextAggregatorPair(
|
||||
context,
|
||||
user_params=LLMUserAggregatorParams(vad_analyzer=SileroVADAnalyzer()),
|
||||
@@ -117,12 +106,14 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
|
||||
@transport.event_handler("on_client_connected")
|
||||
async def on_client_connected(transport, client):
|
||||
logger.info("Client connected")
|
||||
messages.append({"role": "system", "content": "Please introduce yourself to the user."})
|
||||
context.add_message({"role": "user", "content": "Please introduce yourself to the user."})
|
||||
await task.queue_frames([LLMRunFrame()])
|
||||
|
||||
await asyncio.sleep(10)
|
||||
logger.info("Updating Sarvam LLM settings: temperature=0.1")
|
||||
await task.queue_frame(LLMUpdateSettingsFrame(delta=OpenAILLMSettings(temperature=0.1)))
|
||||
await task.queue_frame(
|
||||
LLMUpdateSettingsFrame(delta=SarvamLLMService.Settings(temperature=0.1))
|
||||
)
|
||||
|
||||
@transport.event_handler("on_client_disconnected")
|
||||
async def on_client_disconnected(transport, client):
|
||||
|
||||
Reference in New Issue
Block a user