Add changelog for #4340
This commit is contained in:
1
changelog/4340.added.md
Normal file
1
changelog/4340.added.md
Normal file
@@ -0,0 +1 @@
|
|||||||
|
- Added `XAISTTService` for real-time speech-to-text using xAI's voice STT WebSocket API (`wss://api.x.ai/v1/stt`). Streams raw audio (PCM, µ-law, or A-law) and emits interim and final transcription frames driven by the server's `is_final` / `speech_final` flags. Settings expose `interim_results`, `endpointing`, `language`, `multichannel`, `channels`, and `diarize`. Requires the `xai` optional extra (`pip install "pipecat-ai[xai]"`).
|
||||||
@@ -9,12 +9,10 @@ import os
|
|||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
|
|
||||||
from pipecat.audio.vad.silero import SileroVADAnalyzer
|
|
||||||
from pipecat.frames.frames import Frame, TranscriptionFrame
|
from pipecat.frames.frames import Frame, TranscriptionFrame
|
||||||
from pipecat.pipeline.pipeline import Pipeline
|
from pipecat.pipeline.pipeline import Pipeline
|
||||||
from pipecat.pipeline.runner import PipelineRunner
|
from pipecat.pipeline.runner import PipelineRunner
|
||||||
from pipecat.pipeline.task import PipelineTask
|
from pipecat.pipeline.task import PipelineTask
|
||||||
from pipecat.processors.audio.vad_processor import VADProcessor
|
|
||||||
from pipecat.processors.frame_processor import FrameDirection, FrameProcessor
|
from pipecat.processors.frame_processor import FrameDirection, FrameProcessor
|
||||||
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
|
||||||
@@ -58,9 +56,8 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
|
|||||||
)
|
)
|
||||||
|
|
||||||
tl = TranscriptionLogger()
|
tl = TranscriptionLogger()
|
||||||
vad_processor = VADProcessor(vad_analyzer=SileroVADAnalyzer())
|
|
||||||
|
|
||||||
pipeline = Pipeline([transport.input(), vad_processor, stt, tl])
|
pipeline = Pipeline([transport.input(), stt, tl])
|
||||||
|
|
||||||
task = PipelineTask(
|
task = PipelineTask(
|
||||||
pipeline,
|
pipeline,
|
||||||
|
|||||||
@@ -321,7 +321,6 @@ class XAISTTService(WebsocketSTTService):
|
|||||||
async def _handle_message(self, message: dict[str, Any]):
|
async def _handle_message(self, message: dict[str, Any]):
|
||||||
"""Branch on xAI STT event type."""
|
"""Branch on xAI STT event type."""
|
||||||
msg_type = message.get("type")
|
msg_type = message.get("type")
|
||||||
print(f"xAI STT message: {message}")
|
|
||||||
|
|
||||||
if msg_type == "transcript.created":
|
if msg_type == "transcript.created":
|
||||||
self._session_ready.set()
|
self._session_ready.set()
|
||||||
|
|||||||
Reference in New Issue
Block a user