Move config to main file
This commit is contained in:
@@ -17,9 +17,7 @@ from pipecat.pipeline.task import PipelineParams, PipelineTask
|
|||||||
from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContext
|
from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContext
|
||||||
from pipecat.services.cartesia.tts import CartesiaTTSService
|
from pipecat.services.cartesia.tts import CartesiaTTSService
|
||||||
from pipecat.services.openai.llm import OpenAILLMService
|
from pipecat.services.openai.llm import OpenAILLMService
|
||||||
from pipecat.services.soniox.config import SonioxInputParams
|
|
||||||
from pipecat.services.soniox.stt import SonioxSTTService
|
from pipecat.services.soniox.stt import SonioxSTTService
|
||||||
from pipecat.transcriptions.language import Language
|
|
||||||
from pipecat.transports.base_transport import BaseTransport, TransportParams
|
from pipecat.transports.base_transport import BaseTransport, TransportParams
|
||||||
from pipecat.transports.network.fastapi_websocket import FastAPIWebsocketParams
|
from pipecat.transports.network.fastapi_websocket import FastAPIWebsocketParams
|
||||||
from pipecat.transports.services.daily import DailyParams
|
from pipecat.transports.services.daily import DailyParams
|
||||||
|
|||||||
@@ -16,13 +16,9 @@ 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.frame_processor import FrameDirection, FrameProcessor
|
from pipecat.processors.frame_processor import FrameDirection, FrameProcessor
|
||||||
from pipecat.services.soniox.config import SonioxInputParams
|
|
||||||
from pipecat.services.soniox.stt import SonioxSTTService
|
from pipecat.services.soniox.stt import SonioxSTTService
|
||||||
from pipecat.transcriptions.language import Language
|
|
||||||
from pipecat.transports.base_transport import BaseTransport, TransportParams
|
from pipecat.transports.base_transport import BaseTransport, TransportParams
|
||||||
from pipecat.transports.network.fastapi_websocket import FastAPIWebsocketParams
|
from pipecat.transports.network.fastapi_websocket import FastAPIWebsocketParams
|
||||||
from pipecat.transports.network.small_webrtc import SmallWebRTCTransport
|
|
||||||
from pipecat.transports.network.webrtc_connection import SmallWebRTCConnection
|
|
||||||
from pipecat.transports.services.daily import DailyParams
|
from pipecat.transports.services.daily import DailyParams
|
||||||
|
|
||||||
load_dotenv(override=True)
|
load_dotenv(override=True)
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
#
|
|
||||||
# Copyright (c) 2024–2025, Daily
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: BSD 2-Clause License
|
|
||||||
#
|
|
||||||
|
|
||||||
from typing import List, Optional
|
|
||||||
|
|
||||||
from pydantic import BaseModel
|
|
||||||
|
|
||||||
from pipecat.transcriptions.language import Language
|
|
||||||
|
|
||||||
|
|
||||||
class SonioxInputParams(BaseModel):
|
|
||||||
"""Real-time transcription settings.
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
languages: List of language codes to use for transcription
|
|
||||||
code_switching: Whether to auto-detect language changes during transcription
|
|
||||||
"""
|
|
||||||
|
|
||||||
model: str = "stt-rt-preview"
|
|
||||||
|
|
||||||
audio_format: Optional[str] = "pcm_s16le"
|
|
||||||
num_channels: Optional[int] = 1
|
|
||||||
sample_rate: Optional[int] = 16000
|
|
||||||
|
|
||||||
language_hints: Optional[List[Language]] = None
|
|
||||||
context: Optional[str] = None
|
|
||||||
|
|
||||||
enable_non_final_tokens: Optional[bool] = True
|
|
||||||
max_non_final_tokens_duration_ms: Optional[int] = None
|
|
||||||
|
|
||||||
enable_endpoint_detection: Optional[bool] = True
|
|
||||||
|
|
||||||
client_reference_id: Optional[str] = None
|
|
||||||
@@ -10,6 +10,7 @@ import time
|
|||||||
from typing import AsyncGenerator, List, Optional
|
from typing import AsyncGenerator, List, Optional
|
||||||
|
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
|
from pydantic import BaseModel
|
||||||
|
|
||||||
from pipecat.frames.frames import (
|
from pipecat.frames.frames import (
|
||||||
CancelFrame,
|
CancelFrame,
|
||||||
@@ -22,7 +23,6 @@ from pipecat.frames.frames import (
|
|||||||
UserStoppedSpeakingFrame,
|
UserStoppedSpeakingFrame,
|
||||||
)
|
)
|
||||||
from pipecat.processors.frame_processor import FrameDirection
|
from pipecat.processors.frame_processor import FrameDirection
|
||||||
from pipecat.services.soniox.config import SonioxInputParams
|
|
||||||
from pipecat.services.stt_service import STTService
|
from pipecat.services.stt_service import STTService
|
||||||
from pipecat.transcriptions.language import Language
|
from pipecat.transcriptions.language import Language
|
||||||
from pipecat.utils.time import time_now_iso8601
|
from pipecat.utils.time import time_now_iso8601
|
||||||
@@ -45,6 +45,31 @@ END_TOKEN = "<end>"
|
|||||||
FINALIZED_TOKEN = "<fin>"
|
FINALIZED_TOKEN = "<fin>"
|
||||||
|
|
||||||
|
|
||||||
|
class SonioxInputParams(BaseModel):
|
||||||
|
"""Real-time transcription settings.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
languages: List of language codes to use for transcription
|
||||||
|
code_switching: Whether to auto-detect language changes during transcription
|
||||||
|
"""
|
||||||
|
|
||||||
|
model: str = "stt-rt-preview"
|
||||||
|
|
||||||
|
audio_format: Optional[str] = "pcm_s16le"
|
||||||
|
num_channels: Optional[int] = 1
|
||||||
|
sample_rate: Optional[int] = 16000
|
||||||
|
|
||||||
|
language_hints: Optional[List[Language]] = None
|
||||||
|
context: Optional[str] = None
|
||||||
|
|
||||||
|
enable_non_final_tokens: Optional[bool] = True
|
||||||
|
max_non_final_tokens_duration_ms: Optional[int] = None
|
||||||
|
|
||||||
|
enable_endpoint_detection: Optional[bool] = True
|
||||||
|
|
||||||
|
client_reference_id: Optional[str] = None
|
||||||
|
|
||||||
|
|
||||||
def is_end_token(token: dict) -> bool:
|
def is_end_token(token: dict) -> bool:
|
||||||
"""Determine if a token is an end token."""
|
"""Determine if a token is an end token."""
|
||||||
return token["text"] == END_TOKEN or token["text"] == FINALIZED_TOKEN
|
return token["text"] == END_TOKEN or token["text"] == FINALIZED_TOKEN
|
||||||
|
|||||||
Reference in New Issue
Block a user