orbitalsai 1.0.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.
@@ -0,0 +1,147 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ pip-wheel-metadata/
24
+ share/python-wheels/
25
+ *.egg-info/
26
+ .installed.cfg
27
+ *.egg
28
+ MANIFEST
29
+
30
+ # PyInstaller
31
+ # Usually these files are written by a python script from a template
32
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
33
+ *.manifest
34
+ *.spec
35
+
36
+ # Installer logs
37
+ pip-log.txt
38
+ pip-delete-this-directory.txt
39
+
40
+ # Unit test / coverage reports
41
+ htmlcov/
42
+ .tox/
43
+ .nox/
44
+ .coverage
45
+ .coverage.*
46
+ .cache
47
+ nosetests.xml
48
+ coverage.xml
49
+ *.cover
50
+ *.py,cover
51
+ .hypothesis/
52
+ .pytest_cache/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ target/
76
+
77
+ # Jupyter Notebook
78
+ .ipynb_checkpoints
79
+
80
+ # IPython
81
+ profile_default/
82
+ ipython_config.py
83
+
84
+ # pyenv
85
+ .python-version
86
+
87
+ # pipenv
88
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
90
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
91
+ # install all needed dependencies.
92
+ #Pipfile.lock
93
+
94
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
95
+ __pypackages__/
96
+
97
+ # Celery stuff
98
+ celerybeat-schedule
99
+ celerybeat.pid
100
+
101
+ # SageMath parsed files
102
+ *.sage.py
103
+
104
+ # Environments
105
+ .env
106
+ .venv
107
+ env/
108
+ venv/
109
+ ENV/
110
+ env.bak/
111
+ venv.bak/
112
+
113
+ # Spyder project settings
114
+ .spyderproject
115
+ .spyproject
116
+
117
+ # Rope project settings
118
+ .ropeproject
119
+
120
+ # mkdocs documentation
121
+ /site
122
+
123
+ # mypy
124
+ .mypy_cache/
125
+ .dmypy.json
126
+ dmypy.json
127
+
128
+ # Pyre type checker
129
+ .pyre/
130
+
131
+ # IDE
132
+ .vscode/
133
+ .idea/
134
+ *.swp
135
+ *.swo
136
+ *~
137
+
138
+ # OS
139
+ .DS_Store
140
+ Thumbs.db
141
+
142
+ # Audio files for testing
143
+ *.mp3
144
+ *.wav
145
+ *.m4a
146
+ *.ogg
147
+ *.flac
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 OrbitalsAI
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,439 @@
1
+ Metadata-Version: 2.4
2
+ Name: orbitalsai
3
+ Version: 1.0.0
4
+ Summary: A simple and powerful Python SDK for the OrbitalsAI API
5
+ Home-page: https://github.com/orbitalsai/orbitalsai-python-sdk
6
+ Author: OrbitalsAI
7
+ Author-email: OrbitalsAI <support@orbitalsai.com>
8
+ Maintainer-email: OrbitalsAI <support@orbitalsai.com>
9
+ License: MIT
10
+ Project-URL: Homepage, https://github.com/orbitalsai/orbitalsai-python-sdk
11
+ Project-URL: Documentation, https://docs.orbitalsai.com
12
+ Project-URL: Repository, https://github.com/orbitalsai/orbitalsai-python-sdk
13
+ Project-URL: Bug Tracker, https://github.com/orbitalsai/orbitalsai-python-sdk/issues
14
+ Keywords: ai,transcription,audio,speech,african languages,srt,subtitles
15
+ Classifier: Development Status :: 4 - Beta
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: License :: OSI Approved :: MIT License
18
+ Classifier: Operating System :: OS Independent
19
+ Classifier: Programming Language :: Python :: 3
20
+ Classifier: Programming Language :: Python :: 3.8
21
+ Classifier: Programming Language :: Python :: 3.9
22
+ Classifier: Programming Language :: Python :: 3.10
23
+ Classifier: Programming Language :: Python :: 3.11
24
+ Classifier: Programming Language :: Python :: 3.12
25
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
26
+ Classifier: Topic :: Multimedia :: Sound/Audio :: Speech
27
+ Requires-Python: >=3.8
28
+ Description-Content-Type: text/markdown
29
+ License-File: LICENSE
30
+ Requires-Dist: requests>=2.25.0
31
+ Requires-Dist: aiohttp>=3.8.0
32
+ Requires-Dist: python-dateutil>=2.8.0
33
+ Provides-Extra: dev
34
+ Requires-Dist: pytest>=6.0; extra == "dev"
35
+ Requires-Dist: pytest-asyncio>=0.18.0; extra == "dev"
36
+ Requires-Dist: black>=21.0; extra == "dev"
37
+ Requires-Dist: flake8>=3.9; extra == "dev"
38
+ Requires-Dist: mypy>=0.910; extra == "dev"
39
+ Dynamic: author
40
+ Dynamic: home-page
41
+ Dynamic: license-file
42
+ Dynamic: requires-python
43
+
44
+ # OrbitalsAI Python SDK
45
+
46
+ [![PyPI version](https://badge.fury.io/py/orbitalsai.svg)](https://badge.fury.io/py/orbitalsai)
47
+ [![Python Support](https://img.shields.io/pypi/pyversions/orbitalsai.svg)](https://pypi.org/project/orbitalsai/)
48
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
49
+
50
+ A simple and powerful Python SDK for the OrbitalsAI API. Transcribe audio files in multiple African languages with optional SRT subtitle generation.
51
+
52
+ ## ✨ Features
53
+
54
+ - 🚀 **Simple API** - Just 3 lines to transcribe audio
55
+ - 🔄 **Sync & Async** - Use synchronously or asynchronously
56
+ - 🌍 **African Languages** - Support for Hausa, Igbo, Yoruba, Swahili, and more
57
+ - 📝 **SRT Subtitles** - Generate subtitle files automatically
58
+ - 💰 **Balance Management** - Built-in billing and usage tracking
59
+ - 🔒 **Secure** - API key authentication
60
+ - 📦 **Easy Installation** - `pip install orbitalsai`
61
+
62
+ ## 🚀 Quick Start
63
+
64
+ ### Installation
65
+
66
+ ```bash
67
+ pip install orbitalsai
68
+ ```
69
+
70
+ ### Basic Usage
71
+
72
+ ```python
73
+ import orbitalsai
74
+
75
+ # Initialize client
76
+ client = orbitalsai.Client(api_key="your_api_key_here")
77
+
78
+ # Transcribe audio (waits automatically)
79
+ transcript = client.transcribe("audio.mp3")
80
+ print(transcript.text)
81
+ ```
82
+
83
+ That's it! 🎉
84
+
85
+ ## 📖 Table of Contents
86
+
87
+ - [Installation](#installation)
88
+ - [Quick Start](#quick-start)
89
+ - [Authentication](#authentication)
90
+ - [Basic Transcription](#basic-transcription)
91
+ - [Advanced Features](#advanced-features)
92
+ - [Async Usage](#async-usage)
93
+ - [Error Handling](#error-handling)
94
+ - [API Reference](#api-reference)
95
+ - [Supported Languages](#supported-languages)
96
+ - [Supported Formats](#supported-formats)
97
+ - [Troubleshooting](#troubleshooting)
98
+
99
+ ## 🔑 Authentication
100
+
101
+ Get your API key from the [OrbitalsAI Dashboard](https://dashboard.orbitalsai.com).
102
+
103
+ ```python
104
+ import orbitalsai
105
+
106
+ client = orbitalsai.Client(api_key="your_api_key_here")
107
+ ```
108
+
109
+ ## 🎵 Basic Transcription
110
+
111
+ ### Simple Transcription
112
+
113
+ ```python
114
+ import orbitalsai
115
+
116
+ client = orbitalsai.Client(api_key="your_api_key_here")
117
+
118
+ # Transcribe audio file
119
+ transcript = client.transcribe("audio.mp3")
120
+ print(transcript.text)
121
+ ```
122
+
123
+ ### With Language and SRT
124
+
125
+ ```python
126
+ import orbitalsai
127
+
128
+ client = orbitalsai.Client(api_key="your_api_key_here")
129
+
130
+ # Transcribe in Hausa with SRT subtitles
131
+ transcript = client.transcribe(
132
+ "audio.mp3",
133
+ language="hausa",
134
+ generate_srt=True
135
+ )
136
+
137
+ print(transcript.text)
138
+ print(transcript.srt_content) # SRT subtitle content
139
+ ```
140
+
141
+ ### Don't Wait (Advanced)
142
+
143
+ ```python
144
+ import orbitalsai
145
+
146
+ client = orbitalsai.Client(api_key="your_api_key_here")
147
+
148
+ # Start transcription without waiting
149
+ task = client.transcribe("audio.mp3", wait=False)
150
+ print(f"Task started: {task.task_id}")
151
+
152
+ # Check status later
153
+ status = client.get_task(task.task_id)
154
+ if status.status == "completed":
155
+ print(status.result_text)
156
+
157
+ # Or wait for completion
158
+ transcript = client.wait_for_task(task.task_id)
159
+ print(transcript.text)
160
+ ```
161
+
162
+ ## 🔄 Async Usage
163
+
164
+ Perfect for processing multiple files or building web applications.
165
+
166
+ ```python
167
+ import asyncio
168
+ import orbitalsai
169
+
170
+ async def main():
171
+ async with orbitalsai.AsyncClient(api_key="your_api_key_here") as client:
172
+ # Transcribe multiple files concurrently
173
+ tasks = await asyncio.gather(
174
+ client.transcribe("audio1.mp3"),
175
+ client.transcribe("audio2.wav"),
176
+ client.transcribe("audio3.m4a")
177
+ )
178
+
179
+ for transcript in tasks:
180
+ print(transcript.text)
181
+
182
+ asyncio.run(main())
183
+ ```
184
+
185
+ ## 💰 Balance Management
186
+
187
+ ### Check Balance
188
+
189
+ ```python
190
+ import orbitalsai
191
+
192
+ client = orbitalsai.Client(api_key="your_api_key_here")
193
+
194
+ balance = client.get_balance()
195
+ print(f"Current balance: ${balance.balance:.2f}")
196
+ print(f"Last updated: {balance.last_updated}")
197
+ ```
198
+
199
+ ### Usage History
200
+
201
+ ```python
202
+ import orbitalsai
203
+ from datetime import date, timedelta
204
+
205
+ client = orbitalsai.Client(api_key="QDOBQ2PJ.4ThV4fwk-27hpBvh8pYVvAdOOQlA4Lk1fJQdI6EL9Yk")
206
+
207
+ # Get last 7 days of usage
208
+ end_date = date.today()
209
+ start_date = end_date - timedelta(days=7)
210
+
211
+ usage = client.get_daily_usage(start_date=start_date, end_date=end_date)
212
+ print(f"Total cost: ${usage.total_cost:.2f}")
213
+ print(f"Total audio processed: {usage.total_audio_seconds:.1f} seconds")
214
+
215
+ for day in usage.daily_records:
216
+ print(f"{day.date}: ${day.total_cost:.4f} ({day.transcription_usage:.1f}s transcription)")
217
+ ```
218
+
219
+ ## 🛠️ Advanced Features
220
+
221
+ ### List All Tasks
222
+
223
+ ```python
224
+ import orbitalsai
225
+
226
+ client = orbitalsai.Client(api_key="your_api_key_here")
227
+
228
+ tasks = client.list_tasks()
229
+ for task in tasks:
230
+ print(f"Task {task.task_id}: {task.status} - {task.original_filename}")
231
+ ```
232
+
233
+ ### Get User Information
234
+
235
+ ```python
236
+ import orbitalsai
237
+
238
+ client = orbitalsai.Client(api_key="your_api_key_here")
239
+
240
+ user = client.get_user()
241
+ print(f"User: {user.first_name} {user.last_name} ({user.email})")
242
+ print(f"Verified: {user.is_verified}")
243
+ ```
244
+
245
+ ## ⚠️ Error Handling
246
+
247
+ The SDK provides specific exceptions for different error scenarios.
248
+
249
+ ```python
250
+ import orbitalsai
251
+ from orbitalsai.exceptions import (
252
+ AuthenticationError, InsufficientBalanceError,
253
+ UnsupportedFileError, UnsupportedLanguageError,
254
+ TranscriptionError, TimeoutError
255
+ )
256
+
257
+ client = orbitalsai.Client(api_key="your_api_key_here")
258
+
259
+ try:
260
+ transcript = client.transcribe("audio.mp3", language="hausa")
261
+ print(transcript.text)
262
+
263
+ except UnsupportedFileError:
264
+ print("File format not supported")
265
+ except UnsupportedLanguageError:
266
+ print("Language not supported")
267
+ except InsufficientBalanceError:
268
+ print("Not enough credits")
269
+ except AuthenticationError:
270
+ print("Invalid API key")
271
+ except TranscriptionError as e:
272
+ print(f"Transcription failed: {e}")
273
+ except TimeoutError:
274
+ print("Transcription timed out")
275
+ except Exception as e:
276
+ print(f"Unexpected error: {e}")
277
+ ```
278
+
279
+ ## 📚 API Reference
280
+
281
+ ### Client Methods
282
+
283
+ #### `transcribe(file_path, language="english", generate_srt=False, wait=True, timeout=300, poll_interval=5)`
284
+
285
+ Transcribe an audio file.
286
+
287
+ **Parameters:**
288
+ - `file_path` (str): Path to the audio file
289
+ - `language` (str): Language code (default: "english")
290
+ - `generate_srt` (bool): Generate SRT subtitles (default: False)
291
+ - `wait` (bool): Wait for completion (default: True)
292
+ - `timeout` (int): Maximum wait time in seconds (default: 300)
293
+ - `poll_interval` (int): Seconds between status checks (default: 5)
294
+
295
+ **Returns:** `Transcript` object (if wait=True) or `TranscriptTask` object (if wait=False)
296
+
297
+ #### `get_task(task_id)`
298
+
299
+ Get the status of a transcription task.
300
+
301
+ **Parameters:**
302
+ - `task_id` (int): ID of the task
303
+
304
+ **Returns:** `TranscriptTask` object
305
+
306
+ #### `wait_for_task(task_id, timeout=300, poll_interval=5)`
307
+
308
+ Wait for a task to complete.
309
+
310
+ **Parameters:**
311
+ - `task_id` (int): ID of the task
312
+ - `timeout` (int): Maximum wait time in seconds
313
+ - `poll_interval` (int): Seconds between status checks
314
+
315
+ **Returns:** `Transcript` object
316
+
317
+ #### `list_tasks()`
318
+
319
+ Get all transcription tasks for the current user.
320
+
321
+ **Returns:** List of `TranscriptTask` objects
322
+
323
+ #### `get_balance()`
324
+
325
+ Get the current user's balance.
326
+
327
+ **Returns:** `Balance` object
328
+
329
+ #### `get_usage_history(start_date=None, end_date=None, page=1, page_size=50)`
330
+
331
+ Get usage history for the current user.
332
+
333
+ **Returns:** `UsageHistory` object
334
+
335
+ #### `get_daily_usage(start_date=None, end_date=None, page=1, page_size=30)`
336
+
337
+ Get daily usage history for the current user.
338
+
339
+ **Returns:** `DailyUsage` object
340
+
341
+ #### `get_user()`
342
+
343
+ Get current user details.
344
+
345
+ **Returns:** `User` object
346
+
347
+ ### Data Models
348
+
349
+ #### `Transcript`
350
+ - `text` (str): Transcribed text
351
+ - `srt_content` (str, optional): SRT subtitle content
352
+ - `task_id` (int): Task ID
353
+ - `original_filename` (str): Original filename
354
+ - `audio_url` (str, optional): URL to processed audio
355
+
356
+ #### `TranscriptTask`
357
+ - `task_id` (int): Task ID
358
+ - `status` (str): Task status ("pending", "processing", "completed", "failed")
359
+ - `original_filename` (str): Original filename
360
+ - `audio_url` (str, optional): URL to processed audio
361
+ - `srt_requested` (bool): Whether SRT was requested
362
+ - `result_text` (str, optional): Transcribed text
363
+ - `srt_content` (str, optional): SRT subtitle content
364
+ - `error` (str, optional): Error message if failed
365
+
366
+ #### `Balance`
367
+ - `balance` (float): Current balance in credits
368
+ - `last_updated` (datetime): Last update timestamp
369
+
370
+ ## 🌍 Supported Languages
371
+
372
+ - **English** (`english`)
373
+ - **Hausa** (`hausa`)
374
+ - **Igbo** (`igbo`)
375
+ - **Yoruba** (`yoruba`)
376
+ - **Swahili** (`swahili`)
377
+ - **Pidgin** (`pidgin`)
378
+ - **Kinyarwanda** (`kinyarwanda`)
379
+
380
+ ## 📁 Supported Formats
381
+
382
+ ### Audio Formats
383
+ - WAV (`.wav`, `.wave`)
384
+ - MP3 (`.mp3`, `.mpeg`)
385
+ - OGG (`.ogg`, `.oga`)
386
+ - FLAC (`.flac`)
387
+ - AAC (`.aac`)
388
+ - M4A (`.m4a`)
389
+ - WMA (`.wma`)
390
+ - AMR (`.amr`)
391
+ - 3GP (`.3gp`)
392
+
393
+ ### Maximum File Size
394
+ - **200 MB** per file
395
+
396
+ ## 🔧 Troubleshooting
397
+
398
+ ### Common Issues
399
+
400
+ **Q: I get "Invalid API key" error**
401
+ A: Make sure your API key is correct. Get it from the [OrbitalsAI Dashboard](https://dashboard.orbitalsai.com).
402
+
403
+ **Q: I get "Insufficient balance" error**
404
+ A: Add credits to your account through the dashboard.
405
+
406
+ **Q: I get "Unsupported file format" error**
407
+ A: Make sure your audio file is in a supported format (see [Supported Formats](#supported-formats)).
408
+
409
+ **Q: Transcription takes too long**
410
+ A: Large files take longer to process. You can increase the timeout:
411
+ ```python
412
+ transcript = client.transcribe("large_file.mp3", timeout=600) # 10 minutes
413
+ ```
414
+
415
+ **Q: I get "Unsupported language" error**
416
+ A: Make sure you're using a supported language code (see [Supported Languages](#supported-languages)).
417
+
418
+ ### Getting Help
419
+
420
+ - 📧 Email: support@orbitalsai.com
421
+ - 🐛 Issues: [GitHub Issues](https://github.com/orbitalsai/orbitalsai-python-sdk/issues)
422
+ - 📖 Docs: [Documentation](https://docs.orbitalsai.com)
423
+
424
+ ## 📄 License
425
+
426
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
427
+
428
+ ## 🤝 Contributing
429
+
430
+ Contributions are welcome! Please feel free to submit a Pull Request.
431
+
432
+ ## 🙏 Acknowledgments
433
+
434
+ - Built for the African AI community
435
+ - Powered by OrbitalsAI
436
+
437
+ ---
438
+
439
+ Made by the OrbitalsAI team