From 8eea8ec091b29dbed7a0ac3a810fc690e638f877 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?The=CC=81o=20Monnom?= Date: Mon, 28 Oct 2024 18:15:44 -0700 Subject: [PATCH] wip errors --- livekit-agents/livekit/agents/stt/__init__.py | 2 +- .../livekit-plugins-azure/livekit/plugins/azure/tts.py | 8 +++----- .../livekit-plugins-clova/livekit/plugins/clova/stt.py | 5 +---- .../livekit/plugins/deepgram/stt.py | 1 - .../livekit/plugins/elevenlabs/tts.py | 6 ++---- .../livekit-plugins-google/livekit/plugins/google/stt.py | 2 +- .../livekit-plugins-google/livekit/plugins/google/tts.py | 5 +---- .../livekit-plugins-openai/livekit/plugins/openai/llm.py | 1 - .../livekit-plugins-openai/livekit/plugins/openai/tts.py | 1 - .../livekit-plugins-playht/livekit/plugins/playht/tts.py | 2 +- 10 files changed, 10 insertions(+), 23 deletions(-) diff --git a/livekit-agents/livekit/agents/stt/__init__.py b/livekit-agents/livekit/agents/stt/__init__.py index 40934d686..ba3da8b62 100644 --- a/livekit-agents/livekit/agents/stt/__init__.py +++ b/livekit-agents/livekit/agents/stt/__init__.py @@ -1,13 +1,13 @@ from .stream_adapter import StreamAdapter, StreamAdapterWrapper from .stt import ( STT, + RecognitionUsage, SpeechData, SpeechEvent, SpeechEventType, SpeechStream, STTCapabilities, STTMetrics, - RecognitionUsage, ) __all__ = [ diff --git a/livekit-plugins/livekit-plugins-azure/livekit/plugins/azure/tts.py b/livekit-plugins/livekit-plugins-azure/livekit/plugins/azure/tts.py index 4fc98e98e..f638fd6b9 100644 --- a/livekit-plugins/livekit-plugins-azure/livekit/plugins/azure/tts.py +++ b/livekit-plugins/livekit-plugins-azure/livekit/plugins/azure/tts.py @@ -12,24 +12,22 @@ from __future__ import annotations -import contextlib import asyncio +import contextlib import os from dataclasses import dataclass from typing import Literal from livekit.agents import ( APIConnectionError, - APIStatusError, APITimeoutError, tts, utils, ) -from .log import logger - import azure.cognitiveservices.speech as speechsdk # type: ignore +from .log import logger AZURE_SAMPLE_RATE: int = 16000 AZURE_BITS_PER_SAMPLE: int = 16 @@ -231,7 +229,7 @@ def _cleanup() -> None: try: await asyncio.to_thread(_cleanup) except Exception: - logger.exception(f"failed to cleanup resources") + logger.exception("failed to cleanup resources") class _PushAudioOutputStreamCallback(speechsdk.audio.PushAudioOutputStreamCallback): diff --git a/livekit-plugins/livekit-plugins-clova/livekit/plugins/clova/stt.py b/livekit-plugins/livekit-plugins-clova/livekit/plugins/clova/stt.py index 90074f0b0..ef7367c77 100644 --- a/livekit-plugins/livekit-plugins-clova/livekit/plugins/clova/stt.py +++ b/livekit-plugins/livekit-plugins-clova/livekit/plugins/clova/stt.py @@ -14,24 +14,21 @@ from __future__ import annotations +import asyncio import io import json -import asyncio import os import time import wave from typing import Optional, Union import aiohttp - from livekit.agents import ( - APIConnectionError, APIStatusError, APITimeoutError, stt, utils, ) - from livekit.agents.stt import SpeechEventType, STTCapabilities from livekit.agents.utils import AudioBuffer, merge_frames from livekit.plugins.clova.constants import CLOVA_INPUT_SAMPLE_RATE diff --git a/livekit-plugins/livekit-plugins-deepgram/livekit/plugins/deepgram/stt.py b/livekit-plugins/livekit-plugins-deepgram/livekit/plugins/deepgram/stt.py index 5f876ef12..192d56959 100644 --- a/livekit-plugins/livekit-plugins-deepgram/livekit/plugins/deepgram/stt.py +++ b/livekit-plugins/livekit-plugins-deepgram/livekit/plugins/deepgram/stt.py @@ -35,7 +35,6 @@ stt, utils, ) - from livekit.agents.utils import AudioBuffer, merge_frames from .log import logger diff --git a/livekit-plugins/livekit-plugins-elevenlabs/livekit/plugins/elevenlabs/tts.py b/livekit-plugins/livekit-plugins-elevenlabs/livekit/plugins/elevenlabs/tts.py index 2abfb3f87..fb3fa28d9 100644 --- a/livekit-plugins/livekit-plugins-elevenlabs/livekit/plugins/elevenlabs/tts.py +++ b/livekit-plugins/livekit-plugins-elevenlabs/livekit/plugins/elevenlabs/tts.py @@ -22,6 +22,8 @@ from dataclasses import dataclass from typing import Any, List, Literal +import aiohttp +from livekit import rtc from livekit.agents import ( APIConnectionError, APIStatusError, @@ -31,10 +33,6 @@ utils, ) - -import aiohttp -from livekit import rtc - from .log import logger from .models import TTSEncoding, TTSModels diff --git a/livekit-plugins/livekit-plugins-google/livekit/plugins/google/stt.py b/livekit-plugins/livekit-plugins-google/livekit/plugins/google/stt.py index 6b5d1a3ff..fe378ab6c 100644 --- a/livekit-plugins/livekit-plugins-google/livekit/plugins/google/stt.py +++ b/livekit-plugins/livekit-plugins-google/livekit/plugins/google/stt.py @@ -20,7 +20,6 @@ from typing import AsyncIterable, List, Union from livekit import agents, rtc - from livekit.agents import ( APIConnectionError, APIStatusError, @@ -29,6 +28,7 @@ utils, ) +from google.api_core.exceptions import DeadlineExceeded, GoogleAPICallError from google.auth import default as gauth_default from google.auth.exceptions import DefaultCredentialsError from google.cloud.speech_v2 import SpeechAsyncClient diff --git a/livekit-plugins/livekit-plugins-google/livekit/plugins/google/tts.py b/livekit-plugins/livekit-plugins-google/livekit/plugins/google/tts.py index f4df932d7..6721fd986 100644 --- a/livekit-plugins/livekit-plugins-google/livekit/plugins/google/tts.py +++ b/livekit-plugins/livekit-plugins-google/livekit/plugins/google/tts.py @@ -25,13 +25,10 @@ utils, ) - +from google.api_core.exceptions import DeadlineExceeded, GoogleAPICallError from google.cloud import texttospeech from google.cloud.texttospeech_v1.types import SsmlVoiceGender, SynthesizeSpeechResponse -from google.api_core.exceptions import DeadlineExceeded, GoogleAPICallError - -from .log import logger from .models import AudioEncoding, Gender, SpeechLanguages diff --git a/livekit-plugins/livekit-plugins-openai/livekit/plugins/openai/llm.py b/livekit-plugins/livekit-plugins-openai/livekit/plugins/openai/llm.py index 59eb235c3..cf0587a91 100644 --- a/livekit-plugins/livekit-plugins-openai/livekit/plugins/openai/llm.py +++ b/livekit-plugins/livekit-plugins-openai/livekit/plugins/openai/llm.py @@ -26,7 +26,6 @@ APIStatusError, APITimeoutError, llm, - utils, ) import openai diff --git a/livekit-plugins/livekit-plugins-openai/livekit/plugins/openai/tts.py b/livekit-plugins/livekit-plugins-openai/livekit/plugins/openai/tts.py index 6ecd537b3..df28af959 100644 --- a/livekit-plugins/livekit-plugins-openai/livekit/plugins/openai/tts.py +++ b/livekit-plugins/livekit-plugins-openai/livekit/plugins/openai/tts.py @@ -28,7 +28,6 @@ import openai -from .log import logger from .models import TTSModels, TTSVoices from .utils import AsyncAzureADTokenProvider diff --git a/livekit-plugins/livekit-plugins-playht/livekit/plugins/playht/tts.py b/livekit-plugins/livekit-plugins-playht/livekit/plugins/playht/tts.py index 3172f0188..81fd6b76f 100644 --- a/livekit-plugins/livekit-plugins-playht/livekit/plugins/playht/tts.py +++ b/livekit-plugins/livekit-plugins-playht/livekit/plugins/playht/tts.py @@ -1,7 +1,7 @@ from __future__ import annotations -import os import asyncio +import os from dataclasses import dataclass from typing import Any, List, Literal