Skip to content

Commit 2d095ae

Browse files
committed
Release 0.0.5
1 parent 2a6f7bf commit 2d095ae

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+111
-107
lines changed

README.md

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# MurfAi Python Library
1+
# Murf Python Library
22

33
[![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-Built%20with%20Fern-brightgreen)](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2Fmurf-ai%2Fmurf-python-sdk)
44
[![pypi](https://img.shields.io/pypi/v/murf)](https://pypi.python.org/pypi/murf)
55

6-
The MurfAi Python library provides convenient access to the MurfAi API from Python.
6+
The Murf Python library provides convenient access to the Murf API from Python.
77

88
## Installation
99

@@ -20,14 +20,17 @@ A full reference for this library is available [here](./reference.md).
2020
Instantiate and use the client with the following:
2121

2222
```python
23-
from murf_ai import Murf
23+
from murf import Murf
2424

2525
client = Murf(
2626
api_key="YOUR_API_KEY",
2727
)
28-
client.speech_resource.generate_speech(
29-
text="text",
30-
voice_id="voiceId",
28+
client.text_to_speech.generate(
29+
channel_type="STEREO",
30+
format="MP3",
31+
sample_rate=44100.0,
32+
text="Hello, world!",
33+
voice_id="en-US-natalie",
3134
)
3235
```
3336

@@ -38,17 +41,20 @@ The SDK also exports an `async` client so that you can make non-blocking calls t
3841
```python
3942
import asyncio
4043

41-
from murf_ai import AsyncMurf
44+
from murf import AsyncMurf
4245

4346
client = AsyncMurf(
4447
api_key="YOUR_API_KEY",
4548
)
4649

4750

4851
async def main() -> None:
49-
await client.speech_resource.generate_speech(
50-
text="text",
51-
voice_id="voiceId",
52+
await client.text_to_speech.generate(
53+
channel_type="STEREO",
54+
format="MP3",
55+
sample_rate=44100.0,
56+
text="Hello, world!",
57+
voice_id="en-US-natalie",
5258
)
5359

5460

@@ -61,10 +67,10 @@ When the API returns a non-success status code (4xx or 5xx response), a subclass
6167
will be thrown.
6268

6369
```python
64-
from murf_ai.core.api_error import ApiError
70+
from murf.core.api_error import ApiError
6571

6672
try:
67-
client.speech_resource.generate_speech(...)
73+
client.text_to_speech.generate(...)
6874
except ApiError as e:
6975
print(e.status_code)
7076
print(e.body)
@@ -87,7 +93,7 @@ A request is deemed retriable when any of the following HTTP status codes is ret
8793
Use the `max_retries` request option to configure this behavior.
8894

8995
```python
90-
client.speech_resource.generate_speech(..., request_options={
96+
client.text_to_speech.generate(..., request_options={
9197
"max_retries": 1
9298
})
9399
```
@@ -98,7 +104,7 @@ The SDK defaults to a 60 second timeout. You can configure this with a timeout o
98104

99105
```python
100106

101-
from murf_ai import Murf
107+
from murf import Murf
102108

103109
client = Murf(
104110
...,
@@ -107,7 +113,7 @@ client = Murf(
107113

108114

109115
# Override timeout for a specific method
110-
client.speech_resource.generate_speech(..., request_options={
116+
client.text_to_speech.generate(..., request_options={
111117
"timeout_in_seconds": 1
112118
})
113119
```
@@ -118,7 +124,7 @@ You can override the `httpx` client to customize it for your use-case. Some comm
118124
and transports.
119125
```python
120126
import httpx
121-
from murf_ai import Murf
127+
from murf import Murf
122128

123129
client = Murf(
124130
...,

poetry.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "murf"
33

44
[tool.poetry]
55
name = "murf"
6-
version = "0.0.3"
6+
version = "0.0.5"
77
description = ""
88
readme = "README.md"
99
authors = []
@@ -27,7 +27,7 @@ classifiers = [
2727
"Typing :: Typed"
2828
]
2929
packages = [
30-
{ include = "murf_ai", from = "src"}
30+
{ include = "murf", from = "src"}
3131
]
3232

3333
[project.urls]

reference.md

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Reference
2-
## AuthenticationResource
3-
<details><summary><code>client.authentication_resource.<a href="src/murf_ai/authentication_resource/client.py">create_auth_token</a>()</code></summary>
2+
## Auth
3+
<details><summary><code>client.auth.<a href="src/murf/auth/client.py">generate_token</a>()</code></summary>
44
<dl>
55
<dd>
66

@@ -27,12 +27,12 @@ Generates an auth token for authenticating your requests
2727
<dd>
2828

2929
```python
30-
from murf_ai import Murf
30+
from murf import Murf
3131

3232
client = Murf(
3333
api_key="YOUR_API_KEY",
3434
)
35-
client.authentication_resource.create_auth_token()
35+
client.auth.generate_token()
3636

3737
```
3838
</dd>
@@ -60,8 +60,8 @@ client.authentication_resource.create_auth_token()
6060
</dl>
6161
</details>
6262

63-
## SpeechResource
64-
<details><summary><code>client.speech_resource.<a href="src/murf_ai/speech_resource/client.py">generate_speech</a>(...)</code></summary>
63+
## TextToSpeech
64+
<details><summary><code>client.text_to_speech.<a href="src/murf/text_to_speech/client.py">generate</a>(...)</code></summary>
6565
<dl>
6666
<dd>
6767

@@ -88,14 +88,17 @@ Returns a url to the generated audio file along with other associated properties
8888
<dd>
8989

9090
```python
91-
from murf_ai import Murf
91+
from murf import Murf
9292

9393
client = Murf(
9494
api_key="YOUR_API_KEY",
9595
)
96-
client.speech_resource.generate_speech(
97-
text="text",
98-
voice_id="voiceId",
96+
client.text_to_speech.generate(
97+
channel_type="STEREO",
98+
format="MP3",
99+
sample_rate=44100.0,
100+
text="Hello, world!",
101+
voice_id="en-US-natalie",
99102
)
100103

101104
```
@@ -128,14 +131,6 @@ client.speech_resource.generate_speech(
128131
<dl>
129132
<dd>
130133

131-
**token:** `typing.Optional[str]`
132-
133-
</dd>
134-
</dl>
135-
136-
<dl>
137-
<dd>
138-
139134
**audio_duration:** `typing.Optional[float]` — This parameter allows specifying the duration (in seconds) for the generated audio. If the value is 0, this parameter will be ignored. Only available for Gen2 model.
140135

141136
</dd>
@@ -253,7 +248,7 @@ An object used to define custom pronunciations.
253248
</dl>
254249
</details>
255250

256-
<details><summary><code>client.speech_resource.<a href="src/murf_ai/speech_resource/client.py">list_voices</a>(...)</code></summary>
251+
<details><summary><code>client.text_to_speech.<a href="src/murf/text_to_speech/client.py">get_voices</a>(...)</code></summary>
257252
<dl>
258253
<dd>
259254

@@ -280,12 +275,12 @@ Returns a list of available voices for speech synthesis
280275
<dd>
281276

282277
```python
283-
from murf_ai import Murf
278+
from murf import Murf
284279

285280
client = Murf(
286281
api_key="YOUR_API_KEY",
287282
)
288-
client.speech_resource.list_voices()
283+
client.text_to_speech.get_voices()
289284

290285
```
291286
</dd>
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818
ServiceUnavailableError,
1919
UnauthorizedError,
2020
)
21-
from . import authentication_resource, speech_resource
21+
from . import auth, text_to_speech
2222
from .client import AsyncMurf, Murf
2323
from .environment import MurfEnvironment
24-
from .speech_resource import GenerateSpeechRequestModelVersion
24+
from .text_to_speech import GenerateSpeechRequestModelVersion
2525
from .version import __version__
2626

2727
__all__ = [
@@ -44,6 +44,6 @@
4444
"UnauthorizedError",
4545
"WordDuration",
4646
"__version__",
47-
"authentication_resource",
48-
"speech_resource",
47+
"auth",
48+
"text_to_speech",
4949
]

src/murf_ai/authentication_resource/__init__.py renamed to src/murf/auth/__init__.py

File renamed without changes.

src/murf_ai/authentication_resource/client.py renamed to src/murf/auth/client.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
from ..core.client_wrapper import AsyncClientWrapper
1414

1515

16-
class AuthenticationResourceClient:
16+
class AuthClient:
1717
def __init__(self, *, client_wrapper: SyncClientWrapper):
1818
self._client_wrapper = client_wrapper
1919

20-
def create_auth_token(self, *, request_options: typing.Optional[RequestOptions] = None) -> AuthTokenResponse:
20+
def generate_token(self, *, request_options: typing.Optional[RequestOptions] = None) -> AuthTokenResponse:
2121
"""
2222
Generates an auth token for authenticating your requests
2323
@@ -33,12 +33,12 @@ def create_auth_token(self, *, request_options: typing.Optional[RequestOptions]
3333
3434
Examples
3535
--------
36-
from murf_ai import Murf
36+
from murf import Murf
3737
3838
client = Murf(
3939
api_key="YOUR_API_KEY",
4040
)
41-
client.authentication_resource.create_auth_token()
41+
client.auth.generate_token()
4242
"""
4343
_response = self._client_wrapper.httpx_client.request(
4444
"v1/auth/token",
@@ -90,11 +90,11 @@ def create_auth_token(self, *, request_options: typing.Optional[RequestOptions]
9090
raise ApiError(status_code=_response.status_code, body=_response_json)
9191

9292

93-
class AsyncAuthenticationResourceClient:
93+
class AsyncAuthClient:
9494
def __init__(self, *, client_wrapper: AsyncClientWrapper):
9595
self._client_wrapper = client_wrapper
9696

97-
async def create_auth_token(self, *, request_options: typing.Optional[RequestOptions] = None) -> AuthTokenResponse:
97+
async def generate_token(self, *, request_options: typing.Optional[RequestOptions] = None) -> AuthTokenResponse:
9898
"""
9999
Generates an auth token for authenticating your requests
100100
@@ -112,15 +112,15 @@ async def create_auth_token(self, *, request_options: typing.Optional[RequestOpt
112112
--------
113113
import asyncio
114114
115-
from murf_ai import AsyncMurf
115+
from murf import AsyncMurf
116116
117117
client = AsyncMurf(
118118
api_key="YOUR_API_KEY",
119119
)
120120
121121
122122
async def main() -> None:
123-
await client.authentication_resource.create_auth_token()
123+
await client.auth.generate_token()
124124
125125
126126
asyncio.run(main())

0 commit comments

Comments
 (0)