Skip to content

Commit 27d1d8b

Browse files
committed
Fix tests and mypy issues
1 parent 52b6335 commit 27d1d8b

10 files changed

Lines changed: 15 additions & 13 deletions

File tree

.fernignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ src/elevenlabs/conversational_ai/conversation.py
66
src/elevenlabs/conversational_ai/default_audio_interface.py
77
src/elevenlabs/realtime_tts.py
88
src/elevenlabs/play.py
9+
src/elevenlabs/realtime_tts.py
910
src/elevenlabs/webhooks.py
1011

1112
# Ignore CI files

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ client = ElevenLabs(
8383
api_key="YOUR_API_KEY",
8484
)
8585

86-
response = client.voices.get_all()
86+
response = client.voices.search()
8787
print(response.voices)
8888
```
8989

@@ -106,7 +106,7 @@ client = ElevenLabs(
106106
api_key="YOUR_API_KEY",
107107
)
108108

109-
voice = client.voices.add(
109+
voice = client.voices.ivc.create(
110110
name="Alex",
111111
description="An old American male voice with a slight hoarseness in his throat. Perfect for news", # Optional
112112
files=["./sample_0.mp3", "./sample_1.mp3", "./sample_2.mp3"],
@@ -123,7 +123,7 @@ from elevenlabs.client import ElevenLabs
123123

124124
client = ElevenLabs()
125125

126-
audio_stream = client.text_to_speech.convert_as_stream(
126+
audio_stream = client.text_to_speech.stream(
127127
text="This is a test",
128128
voice_id="JBFqnCBsd6RMkjVDRZzb",
129129
model_id="eleven_multilingual_v2"
@@ -153,7 +153,7 @@ eleven = AsyncElevenLabs(
153153
)
154154

155155
async def print_models() -> None:
156-
models = await eleven.models.get_all()
156+
models = await eleven.models.list()
157157
print(models)
158158

159159
asyncio.run(print_models())

src/elevenlabs/realtime_tts.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ def text_chunker(chunks: typing.Iterator[str]) -> typing.Iterator[str]:
4242
class RealtimeTextToSpeechClient(TextToSpeechClient):
4343
def __init__(self, *, client_wrapper: SyncClientWrapper):
4444
super().__init__(client_wrapper=client_wrapper)
45+
self._client_wrapper = client_wrapper
4546
self._ws_base_url = urllib.parse.urlparse(self._client_wrapper.get_environment().base)._replace(scheme="wss").geturl()
4647

4748
def convert_realtime(

tests/test_audio_isolation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def test_audio_isolation() -> None:
99
client = ElevenLabs()
1010
audio_file = open(DEFAULT_VOICE_FILE, "rb")
1111
try:
12-
audio_stream = client.audio_isolation.audio_isolation(audio=audio_file)
12+
audio_stream = client.audio_isolation.convert(audio=audio_file)
1313
audio = b"".join(chunk for chunk in audio_stream)
1414
assert isinstance(audio, bytes), "Combined audio should be bytes"
1515
if not IN_GITHUB:
@@ -23,7 +23,7 @@ def test_audio_isolation_as_stream():
2323
client = ElevenLabs()
2424
audio_file = open(DEFAULT_VOICE_FILE, "rb")
2525
try:
26-
audio_stream = client.audio_isolation.audio_isolation_stream(audio=audio_file)
26+
audio_stream = client.audio_isolation.stream(audio=audio_file)
2727
audio = b"".join(chunk for chunk in audio_stream)
2828
assert isinstance(audio, bytes), "Combined audio should be bytes"
2929
if not IN_GITHUB:

tests/test_convai.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def test_conversation_basic_flow():
9191
def test_conversation_with_auth():
9292
# Mock setup
9393
mock_client = MagicMock()
94-
mock_client.conversational_ai.get_signed_url.return_value.signed_url = "wss://signed.url"
94+
mock_client.conversational_ai.conversations.get_signed_url.return_value.signed_url = "wss://signed.url"
9595
mock_ws = create_mock_websocket(
9696
[
9797
{
@@ -116,7 +116,7 @@ def test_conversation_with_auth():
116116
conversation.wait_for_session_end()
117117

118118
# Assertions
119-
mock_client.conversational_ai.get_signed_url.assert_called_once_with(agent_id=TEST_AGENT_ID)
119+
mock_client.conversational_ai.conversations.get_signed_url.assert_called_once_with(agent_id=TEST_AGENT_ID)
120120

121121
def test_conversation_with_dynamic_variables():
122122
# Mock setup

tests/test_history.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
def test_history():
55
client = ElevenLabs()
66
page_size = 5
7-
history = client.history.get_all(page_size=page_size)
7+
history = client.history.list(page_size=page_size)
88
assert isinstance(history, GetSpeechHistoryResponse)

tests/test_models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44

55
def test_models_get_all():
66
client = ElevenLabs()
7-
models = client.models.get_all()
7+
models = client.models.list()
88
assert len(models) > 0
99
assert isinstance(models[0], Model)

tests/test_sts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def test_sts_as_stream():
2222
client = ElevenLabs()
2323
audio_file = open(DEFAULT_VOICE_FILE, "rb")
2424
try:
25-
audio_stream = client.speech_to_speech.convert_as_stream(voice_id=DEFAULT_VOICE, audio=audio_file)
25+
audio_stream = client.speech_to_speech.stream(voice_id=DEFAULT_VOICE, audio=audio_file)
2626
audio = b"".join(chunk for chunk in audio_stream)
2727
assert isinstance(audio, bytes), "Combined audio should be bytes"
2828
if not IN_GITHUB:

tests/test_tts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def test_tts_convert_with_voice_settings() -> None:
3535
def test_tts_convert_as_stream():
3636
async def main():
3737
async_client = AsyncElevenLabs()
38-
results = async_client.text_to_speech.convert_as_stream(
38+
results = async_client.text_to_speech.stream(
3939
text=DEFAULT_TEXT, voice_id=DEFAULT_VOICE, model_id=DEFAULT_MODEL
4040
)
4141
out = b""

tests/test_voices.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def test_get_voice():
1616

1717
def test_get_voices():
1818
client = ElevenLabs()
19-
response = client.voices.get_all()
19+
response = client.voices.search()
2020

2121
assert len(response.voices) > 0
2222

0 commit comments

Comments
 (0)