tts: rename PiperTTSService to PiperHttpTTSService

This commit is contained in:
Aleix Conchillo Flaqué
2026-01-28 23:27:32 -08:00
parent 7456a0a55f
commit eb1bf1e446
3 changed files with 14 additions and 9 deletions

View File

@@ -16,7 +16,7 @@ from pipecat.pipeline.runner import PipelineRunner
from pipecat.pipeline.task import PipelineTask from pipecat.pipeline.task import PipelineTask
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.piper.tts import PiperTTSService from pipecat.services.piper.tts import PiperHttpTTSService
from pipecat.transports.base_transport import BaseTransport, TransportParams from pipecat.transports.base_transport import BaseTransport, TransportParams
from pipecat.transports.daily.transport import DailyParams from pipecat.transports.daily.transport import DailyParams
from pipecat.transports.websocket.fastapi import FastAPIWebsocketParams from pipecat.transports.websocket.fastapi import FastAPIWebsocketParams
@@ -39,7 +39,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
# Create an HTTP session # Create an HTTP session
async with aiohttp.ClientSession() as session: async with aiohttp.ClientSession() as session:
tts = PiperTTSService( tts = PiperHttpTTSService(
base_url=os.getenv("PIPER_BASE_URL"), aiohttp_session=session, sample_rate=24000 base_url=os.getenv("PIPER_BASE_URL"), aiohttp_session=session, sample_rate=24000
) )

View File

@@ -21,9 +21,10 @@ from pipecat.services.tts_service import TTSService
from pipecat.utils.tracing.service_decorators import traced_tts from pipecat.utils.tracing.service_decorators import traced_tts
# This assumes a running TTS service running: https://github.com/OHF-Voice/piper1-gpl/blob/main/docs/API_HTTP.md # This assumes a running TTS service running:
class PiperTTSService(TTSService): # https://github.com/OHF-Voice/piper1-gpl/blob/main/docs/API_HTTP.md
"""Piper TTS service implementation. class PiperHttpTTSService(TTSService):
"""Piper HTTP TTS service implementation.
Provides integration with Piper's HTTP TTS server for text-to-speech Provides integration with Piper's HTTP TTS server for text-to-speech
synthesis. Supports streaming audio generation with configurable sample synthesis. Supports streaming audio generation with configurable sample

View File

@@ -21,7 +21,7 @@ from pipecat.frames.frames import (
TTSStoppedFrame, TTSStoppedFrame,
TTSTextFrame, TTSTextFrame,
) )
from pipecat.services.piper.tts import PiperTTSService from pipecat.services.piper.tts import PiperHttpTTSService
from pipecat.tests.utils import run_test from pipecat.tests.utils import run_test
@@ -67,8 +67,10 @@ async def test_run_piper_tts_success(aiohttp_client):
base_url = str(client.make_url("")).rstrip("/") base_url = str(client.make_url("")).rstrip("/")
async with aiohttp.ClientSession() as session: async with aiohttp.ClientSession() as session:
# Instantiate PiperTTSService with our mock server # Instantiate PiperHttpTTSService with our mock server
tts_service = PiperTTSService(base_url=base_url, aiohttp_session=session, sample_rate=24000) tts_service = PiperHttpTTSService(
base_url=base_url, aiohttp_session=session, sample_rate=24000
)
frames_to_send = [ frames_to_send = [
TTSSpeakFrame(text="Hello world."), TTSSpeakFrame(text="Hello world."),
@@ -117,7 +119,9 @@ async def test_run_piper_tts_error(aiohttp_client):
base_url = str(client.make_url("")).rstrip("/") base_url = str(client.make_url("")).rstrip("/")
async with aiohttp.ClientSession() as session: async with aiohttp.ClientSession() as session:
tts_service = PiperTTSService(base_url=base_url, aiohttp_session=session, sample_rate=24000) tts_service = PiperHttpTTSService(
base_url=base_url, aiohttp_session=session, sample_rate=24000
)
frames_to_send = [ frames_to_send = [
TTSSpeakFrame(text="Error case."), TTSSpeakFrame(text="Error case."),