updated the example to use stereo audio and pass in the context. also updated the service to send the transcripts if they're available
This commit is contained in:
@@ -15,10 +15,9 @@ import aiohttp
|
||||
from loguru import logger
|
||||
|
||||
from pipecat.frames.frames import CancelFrame, EndFrame, Frame
|
||||
from pipecat.processors.audio import audio_buffer_processor
|
||||
from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContext
|
||||
from pipecat.processors.audio.audio_buffer_processor import AudioBufferProcessor
|
||||
from pipecat.processors.frame_processor import FrameDirection
|
||||
from pipecat.services.ai_services import AIService
|
||||
|
||||
try:
|
||||
import aiofiles
|
||||
@@ -69,6 +68,7 @@ class CanonicalMetricsService(AIService):
|
||||
api_url: str = "https://voiceapp.canonical.chat/api/v1",
|
||||
assistant_speaks_first: bool = True,
|
||||
output_dir: str = "recordings",
|
||||
context: OpenAILLMContext | None = None,
|
||||
**kwargs,
|
||||
):
|
||||
super().__init__(**kwargs)
|
||||
@@ -80,6 +80,7 @@ class CanonicalMetricsService(AIService):
|
||||
self._assistant = assistant
|
||||
self._assistant_speaks_first = assistant_speaks_first
|
||||
self._output_dir = output_dir
|
||||
self._context = context
|
||||
|
||||
async def stop(self, frame: EndFrame):
|
||||
await super().stop(frame)
|
||||
@@ -190,6 +191,9 @@ class CanonicalMetricsService(AIService):
|
||||
"callId": self._call_id,
|
||||
"assistant": {"id": self._assistant, "speaksFirst": self._assistant_speaks_first},
|
||||
}
|
||||
if self._context is not None:
|
||||
params["transcript"] = self._context.messages
|
||||
|
||||
logger.debug(f"Completing upload for {params['filename']}")
|
||||
logger.debug(f"Slug: {params['slug']}")
|
||||
response = await self._aiohttp_session.post(
|
||||
|
||||
Reference in New Issue
Block a user