smallestai 0.1.0__tar.gz → 1.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: smallestai
3
- Version: 0.1.0
3
+ Version: 1.2.0
4
4
  Summary: Official Python client for the Smallest AI API
5
5
  Author-email: Smallest <info@smallest.ai>
6
6
  License: MIT
@@ -62,18 +62,12 @@ Currently, the library supports direct synthesis and the ability to synthesize s
62
62
 
63
63
  ## Installation
64
64
 
65
- To install the package, follow these steps:
66
-
67
- 1. Clone the repository:
68
- ```bash
69
- git clone https://github.com/smallest-inc/smallest-python-sdk.git
70
- ```
71
-
72
- 2. Navigate to the cloned directory and install the package:
73
- ```bash
74
- cd smallest-python
75
- pip install .
76
- ```
65
+ To install the latest version available
66
+ ```bash
67
+ pip install smallestai
68
+ ```
69
+ When using an SDK in your application, make sure to pin to at least the major version (e.g., ==1.*). This helps ensure your application remains stable and avoids potential issues from breaking changes in future updates.
70
+
77
71
 
78
72
  ## Get the API Key
79
73
 
@@ -94,9 +88,7 @@ from smallest import Smallest
94
88
 
95
89
  def main():
96
90
  client = Smallest(api_key=os.environ.get("SMALLEST_API_KEY"))
97
- audio_data = client.synthesize("Hello, this is a test for sync synthesis function.")
98
- with open("sync_synthesize.wav", "wb") as f:
99
- f.write(audio_data)
91
+ client.synthesize("Hello, this is a test for sync synthesis function.", save_as="sync_synthesize.wav")
100
92
 
101
93
  if __name__ == "__main__":
102
94
  main()
@@ -113,7 +105,7 @@ if __name__ == "__main__":
113
105
  - `remove_extra_silence`: Remove additional silence (default: True)
114
106
 
115
107
  ### Async
116
- A synchronous text-to-speech synthesis client.
108
+ Asynchronous text-to-speech synthesis client.
117
109
 
118
110
  **Basic Usage:**
119
111
  ```python
@@ -126,9 +118,9 @@ client = AsyncSmallest(api_key=os.environ.get("SMALLEST_API_KEY"))
126
118
 
127
119
  async def main():
128
120
  async with client as tts:
129
- audio_bytes = await tts.synthesize("Hello, this is a test of the async synthesis function.")
121
+ audio_bytes = await tts.synthesize("Hello, this is a test of the async synthesis function.")
130
122
  async with aiofiles.open("async_synthesize.wav", "wb") as f:
131
- await f.write(audio_bytes)
123
+ await f.write(audio_bytes) # alternatively you can use the `save_as` parameter.
132
124
 
133
125
  if __name__ == "__main__":
134
126
  asyncio.run(main())
@@ -35,18 +35,12 @@ Currently, the library supports direct synthesis and the ability to synthesize s
35
35
 
36
36
  ## Installation
37
37
 
38
- To install the package, follow these steps:
39
-
40
- 1. Clone the repository:
41
- ```bash
42
- git clone https://github.com/smallest-inc/smallest-python-sdk.git
43
- ```
44
-
45
- 2. Navigate to the cloned directory and install the package:
46
- ```bash
47
- cd smallest-python
48
- pip install .
49
- ```
38
+ To install the latest version available
39
+ ```bash
40
+ pip install smallestai
41
+ ```
42
+ When using an SDK in your application, make sure to pin to at least the major version (e.g., ==1.*). This helps ensure your application remains stable and avoids potential issues from breaking changes in future updates.
43
+
50
44
 
51
45
  ## Get the API Key
52
46
 
@@ -67,9 +61,7 @@ from smallest import Smallest
67
61
 
68
62
  def main():
69
63
  client = Smallest(api_key=os.environ.get("SMALLEST_API_KEY"))
70
- audio_data = client.synthesize("Hello, this is a test for sync synthesis function.")
71
- with open("sync_synthesize.wav", "wb") as f:
72
- f.write(audio_data)
64
+ client.synthesize("Hello, this is a test for sync synthesis function.", save_as="sync_synthesize.wav")
73
65
 
74
66
  if __name__ == "__main__":
75
67
  main()
@@ -86,7 +78,7 @@ if __name__ == "__main__":
86
78
  - `remove_extra_silence`: Remove additional silence (default: True)
87
79
 
88
80
  ### Async
89
- A synchronous text-to-speech synthesis client.
81
+ Asynchronous text-to-speech synthesis client.
90
82
 
91
83
  **Basic Usage:**
92
84
  ```python
@@ -99,9 +91,9 @@ client = AsyncSmallest(api_key=os.environ.get("SMALLEST_API_KEY"))
99
91
 
100
92
  async def main():
101
93
  async with client as tts:
102
- audio_bytes = await tts.synthesize("Hello, this is a test of the async synthesis function.")
94
+ audio_bytes = await tts.synthesize("Hello, this is a test of the async synthesis function.")
103
95
  async with aiofiles.open("async_synthesize.wav", "wb") as f:
104
- await f.write(audio_bytes)
96
+ await f.write(audio_bytes) # alternatively you can use the `save_as` parameter.
105
97
 
106
98
  if __name__ == "__main__":
107
99
  asyncio.run(main())
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "smallestai"
3
- version = "0.1.0"
3
+ version = "1.2.0"
4
4
  description = "Official Python client for the Smallest AI API"
5
5
  authors = [
6
6
  {name = "Smallest", email = "info@smallest.ai"},
@@ -1,4 +1,5 @@
1
1
  import os
2
+ import wave
2
3
  import copy
3
4
  import requests
4
5
  from typing import Optional, Union, List
@@ -128,7 +129,11 @@ class Smallest:
128
129
  with open(save_as, "wb") as wf:
129
130
  wf.write(audio_content)
130
131
  else:
131
- raise TTSError("WAV header is required for saving audio. Set 'add_wav_header=True' to add a WAV header.")
132
+ with wave.open(save_as, "wb") as wf:
133
+ wf.setnchannels(1)
134
+ wf.setsampwidth(2)
135
+ wf.setframerate(self.opts.sample_rate)
136
+ wf.writeframes(audio_content)
132
137
  return None
133
138
 
134
139
  return audio_content
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: smallestai
3
- Version: 0.1.0
3
+ Version: 1.2.0
4
4
  Summary: Official Python client for the Smallest AI API
5
5
  Author-email: Smallest <info@smallest.ai>
6
6
  License: MIT
@@ -62,18 +62,12 @@ Currently, the library supports direct synthesis and the ability to synthesize s
62
62
 
63
63
  ## Installation
64
64
 
65
- To install the package, follow these steps:
66
-
67
- 1. Clone the repository:
68
- ```bash
69
- git clone https://github.com/smallest-inc/smallest-python-sdk.git
70
- ```
71
-
72
- 2. Navigate to the cloned directory and install the package:
73
- ```bash
74
- cd smallest-python
75
- pip install .
76
- ```
65
+ To install the latest version available
66
+ ```bash
67
+ pip install smallestai
68
+ ```
69
+ When using an SDK in your application, make sure to pin to at least the major version (e.g., ==1.*). This helps ensure your application remains stable and avoids potential issues from breaking changes in future updates.
70
+
77
71
 
78
72
  ## Get the API Key
79
73
 
@@ -94,9 +88,7 @@ from smallest import Smallest
94
88
 
95
89
  def main():
96
90
  client = Smallest(api_key=os.environ.get("SMALLEST_API_KEY"))
97
- audio_data = client.synthesize("Hello, this is a test for sync synthesis function.")
98
- with open("sync_synthesize.wav", "wb") as f:
99
- f.write(audio_data)
91
+ client.synthesize("Hello, this is a test for sync synthesis function.", save_as="sync_synthesize.wav")
100
92
 
101
93
  if __name__ == "__main__":
102
94
  main()
@@ -113,7 +105,7 @@ if __name__ == "__main__":
113
105
  - `remove_extra_silence`: Remove additional silence (default: True)
114
106
 
115
107
  ### Async
116
- A synchronous text-to-speech synthesis client.
108
+ Asynchronous text-to-speech synthesis client.
117
109
 
118
110
  **Basic Usage:**
119
111
  ```python
@@ -126,9 +118,9 @@ client = AsyncSmallest(api_key=os.environ.get("SMALLEST_API_KEY"))
126
118
 
127
119
  async def main():
128
120
  async with client as tts:
129
- audio_bytes = await tts.synthesize("Hello, this is a test of the async synthesis function.")
121
+ audio_bytes = await tts.synthesize("Hello, this is a test of the async synthesis function.")
130
122
  async with aiofiles.open("async_synthesize.wav", "wb") as f:
131
- await f.write(audio_bytes)
123
+ await f.write(audio_bytes) # alternatively you can use the `save_as` parameter.
132
124
 
133
125
  if __name__ == "__main__":
134
126
  asyncio.run(main())
File without changes
File without changes
File without changes