processors(realtime-ai): update it to use groq by default
This commit is contained in:
@@ -36,7 +36,10 @@ async def main(room_url, token):
|
|||||||
transcription_enabled=True,
|
transcription_enabled=True,
|
||||||
))
|
))
|
||||||
|
|
||||||
rtai = RealtimeAIProcessor(transport=transport, tts_api_key=os.getenv("CARTESIA_API_KEY"))
|
rtai = RealtimeAIProcessor(
|
||||||
|
transport=transport,
|
||||||
|
llm_api_key=os.getenv("OPENAI_API_KEY"),
|
||||||
|
tts_api_key=os.getenv("CARTESIA_API_KEY"))
|
||||||
|
|
||||||
runner = PipelineRunner()
|
runner = PipelineRunner()
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ from pipecat.processors.aggregators.llm_response import (
|
|||||||
from pipecat.processors.frame_processor import FrameDirection, FrameProcessor
|
from pipecat.processors.frame_processor import FrameDirection, FrameProcessor
|
||||||
from pipecat.services.ai_services import AIService
|
from pipecat.services.ai_services import AIService
|
||||||
from pipecat.services.cartesia import CartesiaTTSService
|
from pipecat.services.cartesia import CartesiaTTSService
|
||||||
from pipecat.services.ollama import OLLamaLLMService
|
from pipecat.services.openai import OpenAILLMService
|
||||||
from pipecat.transports.base_transport import BaseTransport
|
from pipecat.transports.base_transport import BaseTransport
|
||||||
from pipecat.vad.silero import SileroVAD
|
from pipecat.vad.silero import SileroVAD
|
||||||
|
|
||||||
@@ -77,13 +77,15 @@ class RealtimeAIProcessor(FrameProcessor):
|
|||||||
transport: BaseTransport,
|
transport: BaseTransport,
|
||||||
setup: RealtimeAISetup | None = None,
|
setup: RealtimeAISetup | None = None,
|
||||||
llm_api_key: str = "",
|
llm_api_key: str = "",
|
||||||
|
llm_base_url: str = "https://api.groq.com/openai/v1",
|
||||||
tts_api_key: str = "",
|
tts_api_key: str = "",
|
||||||
llm_cls: Type[AIService] = OLLamaLLMService,
|
llm_cls: Type[AIService] = OpenAILLMService,
|
||||||
tts_cls: Type[AIService] = CartesiaTTSService):
|
tts_cls: Type[AIService] = CartesiaTTSService):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self._transport = transport
|
self._transport = transport
|
||||||
self._setup = setup
|
self._setup = setup
|
||||||
self._llm_api_key = llm_api_key
|
self._llm_api_key = llm_api_key
|
||||||
|
self._llm_base_url = llm_base_url
|
||||||
self._tts_api_key = tts_api_key
|
self._tts_api_key = tts_api_key
|
||||||
self._llm_cls = llm_cls
|
self._llm_cls = llm_cls
|
||||||
self._tts_cls = tts_cls
|
self._tts_cls = tts_cls
|
||||||
@@ -130,7 +132,10 @@ class RealtimeAIProcessor(FrameProcessor):
|
|||||||
self._tma_in = LLMUserResponseAggregator(setup.config.llm.messages)
|
self._tma_in = LLMUserResponseAggregator(setup.config.llm.messages)
|
||||||
self._tma_out = LLMAssistantResponseAggregator(setup.config.llm.messages)
|
self._tma_out = LLMAssistantResponseAggregator(setup.config.llm.messages)
|
||||||
|
|
||||||
self._llm = self._llm_cls(model=setup.config.llm.model)
|
self._llm = self._llm_cls(
|
||||||
|
base_url=self._llm_base_url,
|
||||||
|
api_key=self._llm_api_key,
|
||||||
|
model=setup.config.llm.model)
|
||||||
|
|
||||||
self._tts = self._tts_cls(api_key=self._tts_api_key, voice_id=setup.config.tts.voice)
|
self._tts = self._tts_cls(api_key=self._tts_api_key, voice_id=setup.config.tts.voice)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user