Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ dynamic = ["version"]

[tool.poetry]
name = "elevenlabs"
version = "2.49.0"
version = "2.49.1"
description = ""
readme = "README.md"
authors = []
Expand Down
4 changes: 2 additions & 2 deletions src/elevenlabs/core/client_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ def __init__(

def get_headers(self) -> typing.Dict[str, str]:
headers: typing.Dict[str, str] = {
"User-Agent": "elevenlabs/2.49.0",
"User-Agent": "elevenlabs/2.49.1",
"X-Fern-Language": "Python",
"X-Fern-SDK-Name": "elevenlabs",
"X-Fern-SDK-Version": "2.49.0",
"X-Fern-SDK-Version": "2.49.1",
**(self.get_custom_headers() or {}),
}
if self._api_key is not None:
Expand Down
5 changes: 5 additions & 0 deletions src/elevenlabs/speech_engine/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from ..types.privacy_config_input import PrivacyConfigInput
from ..types.sort_direction import SortDirection
from ..types.speech_engine_config import SpeechEngineConfig
from ..types.speech_engine_conversation_initiation_client_data_config import SpeechEngineConversationInitiationClientDataConfig
from ..types.speech_engine_response import SpeechEngineResponse
from ..types.tts_conversational_config_input import TtsConversationalConfigInput
from .raw_client import AsyncRawSpeechEngineClient, RawSpeechEngineClient
Expand Down Expand Up @@ -112,6 +113,7 @@ def create(
call_limits: typing.Optional[AgentCallLimits] = OMIT,
language: typing.Optional[str] = OMIT,
tags: typing.Optional[typing.Sequence[str]] = OMIT,
overrides: typing.Optional[SpeechEngineConversationInitiationClientDataConfig] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> SpeechEngineResponse:
"""
Expand Down Expand Up @@ -181,6 +183,7 @@ def create(
call_limits=call_limits,
language=language,
tags=tags,
overrides=overrides,
request_options=request_options,
)
return _response.data
Expand Down Expand Up @@ -427,6 +430,7 @@ async def create(
call_limits: typing.Optional[AgentCallLimits] = OMIT,
language: typing.Optional[str] = OMIT,
tags: typing.Optional[typing.Sequence[str]] = OMIT,
overrides: typing.Optional[SpeechEngineConversationInitiationClientDataConfig] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> SpeechEngineResponse:
"""
Expand Down Expand Up @@ -504,6 +508,7 @@ async def main() -> None:
call_limits=call_limits,
language=language,
tags=tags,
overrides=overrides,
request_options=request_options,
)
return _response.data
Expand Down
9 changes: 9 additions & 0 deletions src/elevenlabs/speech_engine/raw_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from ..types.privacy_config_input import PrivacyConfigInput
from ..types.sort_direction import SortDirection
from ..types.speech_engine_config import SpeechEngineConfig
from ..types.speech_engine_conversation_initiation_client_data_config import SpeechEngineConversationInitiationClientDataConfig
from ..types.speech_engine_response import SpeechEngineResponse
from ..types.tts_conversational_config_input import TtsConversationalConfigInput

Expand Down Expand Up @@ -120,6 +121,7 @@ def create(
call_limits: typing.Optional[AgentCallLimits] = OMIT,
language: typing.Optional[str] = OMIT,
tags: typing.Optional[typing.Sequence[str]] = OMIT,
overrides: typing.Optional[SpeechEngineConversationInitiationClientDataConfig] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[SpeechEngineResponse]:
"""
Expand Down Expand Up @@ -193,6 +195,9 @@ def create(
),
"language": language,
"tags": tags,
"overrides": convert_and_respect_annotation_metadata(
object_=overrides, annotation=SpeechEngineConversationInitiationClientDataConfig, direction="write"
),
},
headers={
"content-type": "application/json",
Expand Down Expand Up @@ -525,6 +530,7 @@ async def create(
call_limits: typing.Optional[AgentCallLimits] = OMIT,
language: typing.Optional[str] = OMIT,
tags: typing.Optional[typing.Sequence[str]] = OMIT,
overrides: typing.Optional[SpeechEngineConversationInitiationClientDataConfig] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[SpeechEngineResponse]:
"""
Expand Down Expand Up @@ -598,6 +604,9 @@ async def create(
),
"language": language,
"tags": tags,
"overrides": convert_and_respect_annotation_metadata(
object_=overrides, annotation=SpeechEngineConversationInitiationClientDataConfig, direction="write"
),
},
headers={
"content-type": "application/json",
Expand Down
6 changes: 6 additions & 0 deletions src/elevenlabs/speech_engine/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from .server import SpeechEngineServer
from .session import SpeechEngineSession
from .types import WebSocketLike
from ..types.speech_engine_response import SpeechEngineResponse

logger = logging.getLogger("elevenlabs.speech_engine")

Expand Down Expand Up @@ -116,10 +117,15 @@ def __init__(
self,
engine_id: str,
client_wrapper: typing.Any = None,
response: typing.Optional[SpeechEngineResponse] = None,
) -> None:
self.engine_id = engine_id
self._client_wrapper = client_wrapper

# Full API response, accessible as engine.config.asr, engine.config.overrides, etc.
# None when the resource is constructed directly without an API call.
self.config: typing.Optional[SpeechEngineResponse] = response

def _get_api_key(self) -> typing.Optional[str]:
if self._client_wrapper is None:
return None
Expand Down
19 changes: 15 additions & 4 deletions src/elevenlabs/speech_engine_custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from .types.conversation_config_input import ConversationConfigInput
from .types.privacy_config_input import PrivacyConfigInput
from .types.speech_engine_config import SpeechEngineConfig
from .types.speech_engine_conversation_initiation_client_data_config import SpeechEngineConversationInitiationClientDataConfig
from .types.tts_conversational_config_input import TtsConversationalConfigInput

OMIT = typing.cast(typing.Any, ...)
Expand All @@ -31,6 +32,7 @@ def create( # type: ignore[override]
call_limits: typing.Optional[AgentCallLimits] = OMIT,
language: typing.Optional[str] = OMIT,
tags: typing.Optional[typing.Sequence[str]] = OMIT,
overrides: typing.Optional[SpeechEngineConversationInitiationClientDataConfig] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> SpeechEngineResource:
"""Create a Speech Engine resource.
Expand All @@ -52,11 +54,13 @@ def create( # type: ignore[override]
call_limits=call_limits,
language=language,
tags=tags,
overrides=overrides,
request_options=request_options,
)
return SpeechEngineResource(
engine_id=response.speech_engine_id,
client_wrapper=self._raw_client._client_wrapper,
response=response,
)

def get( # type: ignore[override]
Expand All @@ -73,10 +77,11 @@ def get( # type: ignore[override]
:meth:`~SpeechEngineResource.create_session`,
:meth:`~SpeechEngineResource.verify_request`).
"""
super().get(speech_engine_id, request_options=request_options)
response = super().get(speech_engine_id, request_options=request_options)
return SpeechEngineResource(
engine_id=speech_engine_id,
client_wrapper=self._raw_client._client_wrapper,
response=response,
)

def update( # type: ignore[override]
Expand All @@ -103,7 +108,7 @@ def update( # type: ignore[override]
:meth:`~SpeechEngineResource.create_session`,
:meth:`~SpeechEngineResource.verify_request`).
"""
super().update(
response = super().update(
speech_engine_id,
name=name,
speech_engine=speech_engine,
Expand All @@ -120,6 +125,7 @@ def update( # type: ignore[override]
return SpeechEngineResource(
engine_id=speech_engine_id,
client_wrapper=self._raw_client._client_wrapper,
response=response,
)


Expand All @@ -139,6 +145,7 @@ async def create( # type: ignore[override]
call_limits: typing.Optional[AgentCallLimits] = OMIT,
language: typing.Optional[str] = OMIT,
tags: typing.Optional[typing.Sequence[str]] = OMIT,
overrides: typing.Optional[SpeechEngineConversationInitiationClientDataConfig] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> SpeechEngineResource:
"""Create a Speech Engine resource.
Expand All @@ -160,11 +167,13 @@ async def create( # type: ignore[override]
call_limits=call_limits,
language=language,
tags=tags,
overrides=overrides,
request_options=request_options,
)
return SpeechEngineResource(
engine_id=response.speech_engine_id,
client_wrapper=self._raw_client._client_wrapper,
response=response,
)

async def get( # type: ignore[override]
Expand All @@ -181,10 +190,11 @@ async def get( # type: ignore[override]
:meth:`~SpeechEngineResource.create_session`,
:meth:`~SpeechEngineResource.verify_request`).
"""
await super().get(speech_engine_id, request_options=request_options)
response = await super().get(speech_engine_id, request_options=request_options)
return SpeechEngineResource(
engine_id=speech_engine_id,
client_wrapper=self._raw_client._client_wrapper,
response=response,
)

async def update( # type: ignore[override]
Expand All @@ -211,7 +221,7 @@ async def update( # type: ignore[override]
:meth:`~SpeechEngineResource.create_session`,
:meth:`~SpeechEngineResource.verify_request`).
"""
await super().update(
response = await super().update(
speech_engine_id,
name=name,
speech_engine=speech_engine,
Expand All @@ -228,4 +238,5 @@ async def update( # type: ignore[override]
return SpeechEngineResource(
engine_id=speech_engine_id,
client_wrapper=self._raw_client._client_wrapper,
response=response,
)
Loading