make sure warnings are always displayed
This commit is contained in:
@@ -41,13 +41,15 @@ def create_default_resampler(**kwargs) -> BaseAudioResampler:
|
|||||||
"""
|
"""
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
warnings.warn(
|
with warnings.catch_warnings():
|
||||||
"`create_default_resampler` is deprecated. "
|
warnings.simplefilter("always")
|
||||||
"Use `create_stream_resampler` for real-time processing scenarios or "
|
warnings.warn(
|
||||||
"`create_file_resampler` for batch processing of complete audio files.",
|
"`create_default_resampler` is deprecated. "
|
||||||
DeprecationWarning,
|
"Use `create_stream_resampler` for real-time processing scenarios or "
|
||||||
stacklevel=2,
|
"`create_file_resampler` for batch processing of complete audio files.",
|
||||||
)
|
DeprecationWarning,
|
||||||
|
stacklevel=2,
|
||||||
|
)
|
||||||
return SOXRAudioResampler(**kwargs)
|
return SOXRAudioResampler(**kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ LLM processing, and text-to-speech components in conversational AI pipelines.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
import warnings
|
|
||||||
from abc import abstractmethod
|
from abc import abstractmethod
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import Dict, List, Literal, Optional, Set
|
from typing import Dict, List, Literal, Optional, Set
|
||||||
@@ -326,11 +325,15 @@ class LLMContextResponseAggregator(BaseLLMResponseAggregator):
|
|||||||
Returns:
|
Returns:
|
||||||
LLMContextFrame containing the current context.
|
LLMContextFrame containing the current context.
|
||||||
"""
|
"""
|
||||||
warnings.warn(
|
import warnings
|
||||||
"get_context_frame() is deprecated and will be removed in a future version. To trigger an LLM response, use LLMRunFrame instead.",
|
|
||||||
DeprecationWarning,
|
with warnings.catch_warnings():
|
||||||
stacklevel=2,
|
warnings.simplefilter("always")
|
||||||
)
|
warnings.warn(
|
||||||
|
"get_context_frame() is deprecated and will be removed in a future version. To trigger an LLM response, use LLMRunFrame instead.",
|
||||||
|
DeprecationWarning,
|
||||||
|
stacklevel=2,
|
||||||
|
)
|
||||||
return self._get_context_frame()
|
return self._get_context_frame()
|
||||||
|
|
||||||
def _get_context_frame(self) -> OpenAILLMContextFrame:
|
def _get_context_frame(self) -> OpenAILLMContextFrame:
|
||||||
@@ -1035,12 +1038,16 @@ class LLMUserResponseAggregator(LLMUserContextAggregator):
|
|||||||
params: Configuration parameters for aggregation behavior.
|
params: Configuration parameters for aggregation behavior.
|
||||||
**kwargs: Additional arguments passed to parent class.
|
**kwargs: Additional arguments passed to parent class.
|
||||||
"""
|
"""
|
||||||
warnings.warn(
|
import warnings
|
||||||
"LLMUserResponseAggregator is deprecated and will be removed in a future version. "
|
|
||||||
"Use LLMUserContextAggregator or another LLM-specific subclass instead.",
|
with warnings.catch_warnings():
|
||||||
DeprecationWarning,
|
warnings.simplefilter("always")
|
||||||
stacklevel=2,
|
warnings.warn(
|
||||||
)
|
"LLMUserResponseAggregator is deprecated and will be removed in a future version. "
|
||||||
|
"Use LLMUserContextAggregator or another LLM-specific subclass instead.",
|
||||||
|
DeprecationWarning,
|
||||||
|
stacklevel=2,
|
||||||
|
)
|
||||||
super().__init__(context=OpenAILLMContext(messages), params=params, **kwargs)
|
super().__init__(context=OpenAILLMContext(messages), params=params, **kwargs)
|
||||||
|
|
||||||
async def _process_aggregation(self):
|
async def _process_aggregation(self):
|
||||||
@@ -1078,12 +1085,16 @@ class LLMAssistantResponseAggregator(LLMAssistantContextAggregator):
|
|||||||
params: Configuration parameters for aggregation behavior.
|
params: Configuration parameters for aggregation behavior.
|
||||||
**kwargs: Additional arguments passed to parent class.
|
**kwargs: Additional arguments passed to parent class.
|
||||||
"""
|
"""
|
||||||
warnings.warn(
|
import warnings
|
||||||
"LLMAssistantResponseAggregator is deprecated and will be removed in a future version. "
|
|
||||||
"Use LLMAssistantContextAggregator or another LLM-specific subclass instead.",
|
with warnings.catch_warnings():
|
||||||
DeprecationWarning,
|
warnings.simplefilter("always")
|
||||||
stacklevel=2,
|
warnings.warn(
|
||||||
)
|
"LLMAssistantResponseAggregator is deprecated and will be removed in a future version. "
|
||||||
|
"Use LLMAssistantContextAggregator or another LLM-specific subclass instead.",
|
||||||
|
DeprecationWarning,
|
||||||
|
stacklevel=2,
|
||||||
|
)
|
||||||
super().__init__(context=OpenAILLMContext(messages), params=params, **kwargs)
|
super().__init__(context=OpenAILLMContext(messages), params=params, **kwargs)
|
||||||
|
|
||||||
async def push_aggregation(self):
|
async def push_aggregation(self):
|
||||||
|
|||||||
@@ -452,12 +452,14 @@ class FrameProcessor(BaseObject):
|
|||||||
"""
|
"""
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
warnings.warn(
|
with warnings.catch_warnings():
|
||||||
"`FrameProcessor.wait_for_task()` is deprecated. "
|
warnings.simplefilter("always")
|
||||||
"Use `await task` or `await asyncio.wait_for(task, timeout)` instead.",
|
warnings.warn(
|
||||||
DeprecationWarning,
|
"`FrameProcessor.wait_for_task()` is deprecated. "
|
||||||
stacklevel=2,
|
"Use `await task` or `await asyncio.wait_for(task, timeout)` instead.",
|
||||||
)
|
DeprecationWarning,
|
||||||
|
stacklevel=2,
|
||||||
|
)
|
||||||
|
|
||||||
if timeout:
|
if timeout:
|
||||||
await asyncio.wait_for(task, timeout)
|
await asyncio.wait_for(task, timeout)
|
||||||
|
|||||||
@@ -122,11 +122,13 @@ async def configure_with_args(aiohttp_session: aiohttp.ClientSession, parser=Non
|
|||||||
"""
|
"""
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
warnings.warn(
|
with warnings.catch_warnings():
|
||||||
"configure_with_args is deprecated. Use configure() instead.",
|
warnings.simplefilter("always")
|
||||||
DeprecationWarning,
|
warnings.warn(
|
||||||
stacklevel=2,
|
"configure_with_args is deprecated. Use configure() instead.",
|
||||||
)
|
DeprecationWarning,
|
||||||
|
stacklevel=2,
|
||||||
|
)
|
||||||
|
|
||||||
room_url, token = await configure(aiohttp_session)
|
room_url, token = await configure(aiohttp_session)
|
||||||
return (room_url, token, None)
|
return (room_url, token, None)
|
||||||
|
|||||||
@@ -11,11 +11,11 @@ _warned_modules = set()
|
|||||||
|
|
||||||
|
|
||||||
def _warn_deprecated_access(globals: Dict[str, Any], attr, old: str, new: str):
|
def _warn_deprecated_access(globals: Dict[str, Any], attr, old: str, new: str):
|
||||||
import warnings
|
|
||||||
|
|
||||||
# Only warn once per old->new module pair
|
# Only warn once per old->new module pair
|
||||||
module_key = (old, new)
|
module_key = (old, new)
|
||||||
if module_key not in _warned_modules:
|
if module_key not in _warned_modules:
|
||||||
|
import warnings
|
||||||
|
|
||||||
with warnings.catch_warnings():
|
with warnings.catch_warnings():
|
||||||
warnings.simplefilter("always")
|
warnings.simplefilter("always")
|
||||||
warnings.warn(
|
warnings.warn(
|
||||||
|
|||||||
@@ -271,11 +271,13 @@ class CartesiaTTSService(AudioContextWordTTSService):
|
|||||||
voice_config["id"] = self._voice_id
|
voice_config["id"] = self._voice_id
|
||||||
|
|
||||||
if self._settings["emotion"]:
|
if self._settings["emotion"]:
|
||||||
warnings.warn(
|
with warnings.catch_warnings():
|
||||||
"The 'emotion' parameter in __experimental_controls is deprecated and will be removed in a future version.",
|
warnings.simplefilter("always")
|
||||||
DeprecationWarning,
|
warnings.warn(
|
||||||
stacklevel=2,
|
"The 'emotion' parameter in __experimental_controls is deprecated and will be removed in a future version.",
|
||||||
)
|
DeprecationWarning,
|
||||||
|
stacklevel=2,
|
||||||
|
)
|
||||||
voice_config["__experimental_controls"] = {}
|
voice_config["__experimental_controls"] = {}
|
||||||
if self._settings["emotion"]:
|
if self._settings["emotion"]:
|
||||||
voice_config["__experimental_controls"]["emotion"] = self._settings["emotion"]
|
voice_config["__experimental_controls"]["emotion"] = self._settings["emotion"]
|
||||||
@@ -606,11 +608,13 @@ class CartesiaHttpTTSService(TTSService):
|
|||||||
voice_config = {"mode": "id", "id": self._voice_id}
|
voice_config = {"mode": "id", "id": self._voice_id}
|
||||||
|
|
||||||
if self._settings["emotion"]:
|
if self._settings["emotion"]:
|
||||||
warnings.warn(
|
with warnings.catch_warnings():
|
||||||
"The 'emotion' parameter in voice.__experimental_controls is deprecated and will be removed in a future version.",
|
warnings.simplefilter("always")
|
||||||
DeprecationWarning,
|
warnings.warn(
|
||||||
stacklevel=2,
|
"The 'emotion' parameter in voice.__experimental_controls is deprecated and will be removed in a future version.",
|
||||||
)
|
DeprecationWarning,
|
||||||
|
stacklevel=2,
|
||||||
|
)
|
||||||
voice_config["__experimental_controls"] = {"emotion": self._settings["emotion"]}
|
voice_config["__experimental_controls"] = {"emotion": self._settings["emotion"]}
|
||||||
|
|
||||||
await self.start_ttfb_metrics()
|
await self.start_ttfb_metrics()
|
||||||
|
|||||||
@@ -120,12 +120,14 @@ class FishAudioTTSService(InterruptibleTTSService):
|
|||||||
if model:
|
if model:
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
warnings.warn(
|
with warnings.catch_warnings():
|
||||||
"Parameter 'model' is deprecated and will be removed in a future version. "
|
warnings.simplefilter("always")
|
||||||
"Use 'reference_id' instead.",
|
warnings.warn(
|
||||||
DeprecationWarning,
|
"Parameter 'model' is deprecated and will be removed in a future version. "
|
||||||
stacklevel=2,
|
"Use 'reference_id' instead.",
|
||||||
)
|
DeprecationWarning,
|
||||||
|
stacklevel=2,
|
||||||
|
)
|
||||||
reference_id = model
|
reference_id = model
|
||||||
|
|
||||||
self._api_key = api_key
|
self._api_key = api_key
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ supporting multiple languages, custom vocabulary, and various audio processing o
|
|||||||
import asyncio
|
import asyncio
|
||||||
import base64
|
import base64
|
||||||
import json
|
import json
|
||||||
import warnings
|
|
||||||
from typing import Any, AsyncGenerator, Dict, Literal, Optional
|
from typing import Any, AsyncGenerator, Dict, Literal, Optional
|
||||||
|
|
||||||
import aiohttp
|
import aiohttp
|
||||||
@@ -173,12 +172,16 @@ class _InputParamsDescriptor:
|
|||||||
"""Descriptor for backward compatibility with deprecation warning."""
|
"""Descriptor for backward compatibility with deprecation warning."""
|
||||||
|
|
||||||
def __get__(self, obj, objtype=None):
|
def __get__(self, obj, objtype=None):
|
||||||
warnings.warn(
|
import warnings
|
||||||
"GladiaSTTService.InputParams is deprecated and will be removed in a future version. "
|
|
||||||
"Import and use GladiaInputParams directly instead.",
|
with warnings.catch_warnings():
|
||||||
DeprecationWarning,
|
warnings.simplefilter("always")
|
||||||
stacklevel=2,
|
warnings.warn(
|
||||||
)
|
"GladiaSTTService.InputParams is deprecated and will be removed in a future version. "
|
||||||
|
"Import and use GladiaInputParams directly instead.",
|
||||||
|
DeprecationWarning,
|
||||||
|
stacklevel=2,
|
||||||
|
)
|
||||||
return GladiaInputParams
|
return GladiaInputParams
|
||||||
|
|
||||||
|
|
||||||
@@ -234,12 +237,14 @@ class GladiaSTTService(STTService):
|
|||||||
|
|
||||||
# Warn about deprecated language parameter if it's used
|
# Warn about deprecated language parameter if it's used
|
||||||
if params.language is not None:
|
if params.language is not None:
|
||||||
warnings.warn(
|
with warnings.catch_warnings():
|
||||||
"The 'language' parameter is deprecated and will be removed in a future version. "
|
warnings.simplefilter("always")
|
||||||
"Use 'language_config' instead.",
|
warnings.warn(
|
||||||
DeprecationWarning,
|
"The 'language' parameter is deprecated and will be removed in a future version. "
|
||||||
stacklevel=2,
|
"Use 'language_config' instead.",
|
||||||
)
|
DeprecationWarning,
|
||||||
|
stacklevel=2,
|
||||||
|
)
|
||||||
|
|
||||||
self._api_key = api_key
|
self._api_key = api_key
|
||||||
self._region = region
|
self._region = region
|
||||||
|
|||||||
@@ -65,12 +65,14 @@ class GoogleLLMOpenAIBetaService(OpenAILLMService):
|
|||||||
"""
|
"""
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
warnings.warn(
|
with warnings.catch_warnings():
|
||||||
"GoogleLLMOpenAIBetaService is deprecated and will be removed in a future version. "
|
warnings.simplefilter("always")
|
||||||
"Use GoogleLLMService instead for better integration with Google's native API.",
|
warnings.warn(
|
||||||
DeprecationWarning,
|
"GoogleLLMOpenAIBetaService is deprecated and will be removed in a future version. "
|
||||||
stacklevel=2,
|
"Use GoogleLLMService instead for better integration with Google's native API.",
|
||||||
)
|
DeprecationWarning,
|
||||||
|
stacklevel=2,
|
||||||
|
)
|
||||||
|
|
||||||
super().__init__(api_key=api_key, base_url=base_url, model=model, **kwargs)
|
super().__init__(api_key=api_key, base_url=base_url, model=model, **kwargs)
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import io
|
|||||||
import json
|
import json
|
||||||
import struct
|
import struct
|
||||||
import uuid
|
import uuid
|
||||||
import warnings
|
|
||||||
from typing import AsyncGenerator, Optional
|
from typing import AsyncGenerator, Optional
|
||||||
|
|
||||||
import aiohttp
|
import aiohttp
|
||||||
@@ -455,11 +454,15 @@ class PlayHTHttpTTSService(TTSService):
|
|||||||
|
|
||||||
# Warn about deprecated protocol parameter if explicitly provided
|
# Warn about deprecated protocol parameter if explicitly provided
|
||||||
if protocol:
|
if protocol:
|
||||||
warnings.warn(
|
import warnings
|
||||||
"The 'protocol' parameter is deprecated and will be removed in a future version.",
|
|
||||||
DeprecationWarning,
|
with warnings.catch_warnings():
|
||||||
stacklevel=2,
|
warnings.simplefilter("always")
|
||||||
)
|
warnings.warn(
|
||||||
|
"The 'protocol' parameter is deprecated and will be removed in a future version.",
|
||||||
|
DeprecationWarning,
|
||||||
|
stacklevel=2,
|
||||||
|
)
|
||||||
|
|
||||||
params = params or PlayHTHttpTTSService.InputParams()
|
params = params or PlayHTHttpTTSService.InputParams()
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
import base64
|
import base64
|
||||||
import json
|
import json
|
||||||
import warnings
|
|
||||||
from typing import Any, AsyncGenerator, Mapping, Optional
|
from typing import Any, AsyncGenerator, Mapping, Optional
|
||||||
|
|
||||||
import aiohttp
|
import aiohttp
|
||||||
@@ -356,11 +355,15 @@ class SarvamTTSService(InterruptibleTTSService):
|
|||||||
)
|
)
|
||||||
params = params or SarvamTTSService.InputParams()
|
params = params or SarvamTTSService.InputParams()
|
||||||
if aiohttp_session is not None:
|
if aiohttp_session is not None:
|
||||||
warnings.warn(
|
import warnings
|
||||||
"The 'aiohttp_session' parameter is deprecated and will be removed in a future version. ",
|
|
||||||
DeprecationWarning,
|
with warnings.catch_warnings():
|
||||||
stacklevel=2,
|
warnings.simplefilter("always")
|
||||||
)
|
warnings.warn(
|
||||||
|
"The 'aiohttp_session' parameter is deprecated and will be removed in a future version. ",
|
||||||
|
DeprecationWarning,
|
||||||
|
stacklevel=2,
|
||||||
|
)
|
||||||
# WebSocket endpoint URL
|
# WebSocket endpoint URL
|
||||||
self._websocket_url = f"{url}?model={model}"
|
self._websocket_url = f"{url}?model={model}"
|
||||||
self._api_key = api_key
|
self._api_key = api_key
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import asyncio
|
|||||||
import datetime
|
import datetime
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import warnings
|
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from typing import Any, AsyncGenerator
|
from typing import Any, AsyncGenerator
|
||||||
@@ -1107,6 +1106,8 @@ def _check_deprecated_args(kwargs: dict, params: SpeechmaticsSTTService.InputPar
|
|||||||
|
|
||||||
# Show deprecation warnings
|
# Show deprecation warnings
|
||||||
def _deprecation_warning(old: str, new: str | None = None):
|
def _deprecation_warning(old: str, new: str | None = None):
|
||||||
|
import warnings
|
||||||
|
|
||||||
with warnings.catch_warnings():
|
with warnings.catch_warnings():
|
||||||
warnings.simplefilter("always")
|
warnings.simplefilter("always")
|
||||||
if new:
|
if new:
|
||||||
|
|||||||
@@ -276,11 +276,13 @@ class TTSService(AIService):
|
|||||||
"""
|
"""
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
warnings.warn(
|
with warnings.catch_warnings():
|
||||||
"`TTSService.say()` is deprecated. Push a `TTSSpeakFrame` instead.",
|
warnings.simplefilter("always")
|
||||||
DeprecationWarning,
|
warnings.warn(
|
||||||
stacklevel=2,
|
"`TTSService.say()` is deprecated. Push a `TTSSpeakFrame` instead.",
|
||||||
)
|
DeprecationWarning,
|
||||||
|
stacklevel=2,
|
||||||
|
)
|
||||||
|
|
||||||
await self.queue_frame(TTSSpeakFrame(text))
|
await self.queue_frame(TTSSpeakFrame(text))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user