gladiaio-sdk-0.4.0
توضیحات
Gladia SDK for Python
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | gladiaio-sdk-0.4.0 |
| نام | gladiaio-sdk |
| نسخه کتابخانه | 0.4.0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | - |
| ایمیل نویسنده | - |
| آدرس صفحه اصلی | - |
| آدرس اینترنتی | https://pypi.org/project/gladiaio-sdk/ |
| مجوز | - |
# Gladia Python SDK
A Python SDK for the Gladia API.
## Requirements
You need Python 3.10+ for this package.
It may work on lower versions but they are not supported / tested.
## Installation
### Using pip
```bash
pip install gladiaio-sdk
```
### Using uv
```bash
uv add gladiaio-sdk
```
## Usage
To use the SDK, import `GladiaClient` and create a new instance of it.
You can also configure `api_key`, `api_url` and `region` through their respective environment variables: `GLADIA_API_KEY`, `GLADIA_API_URL` and `GLADIA_REGION`.
```python
from gladiaio_sdk import GladiaClient
gladia_client = GladiaClient(
api_key="your_api_key"
)
```
## Live V2
### Threaded vs Async
Our Python SDK supports sync/threaded and asyncio versions.
To get the sync/threaded version, do:
```python
live_client = gladia_client.live_v2()
```
And to get the async version:
```python
live_client = gladia_client.live_v2_async()
```
### Usage
Once you decided between sync and async client, you can use the client to run a Live session:
```python
# Create session
live_session = live_client.start_session(
LiveV2InitRequest(
language_config=LiveV2LanguageConfig(
languages=["en"],
),
messages_config=LiveV2MessagesConfig(
receive_partial_transcripts=True,
),
)
)
# Add listeners
@live_session.on("message")
def on_message(message: LiveV2WebSocketMessage):
if message.type == "transcript":
print(f"{'F' if message.data.is_final else 'P'} | {message.data.utterance.text.strip()}")
@live_session.once("started")
def on_started(response: LiveV2InitResponse):
print(f"Session {response.id} started")
@live_session.on("error")
def on_error(error: Exception):
print(f"An error occurred during live session: {error}")
@live_session.once("ended")
def on_ended(ended: LiveV2EndedMessage):
print(f"Session {live_session.session_id} ended")
# Send audio
live_session.send_audio(audio_bytes)
# ...
live_session.send_audio(audio_bytes)
# Stop the recording when all audio have been sent.
# Remaining audio will be processed and after post-processing,
# the session is ended.
live_session.stop_recording()
```
نیازمندی
| مقدار | نام |
|---|---|
| - | anyio==4.11.0 |
| - | certifi==2025.8.3 |
| - | dataclasses-json==0.6.7 |
| ython_full_versio | exceptiongroup==1.3.0; |
| - | h11==0.16.0 |
| - | httpcore==1.0.9 |
| - | httpx==0.28.1 |
| - | idna==3.10 |
| - | marshmallow==3.26.1 |
| - | mypy-extensions==1.1.0 |
| - | packaging==25.0 |
| - | pyee==13.0.0 |
| - | sniffio==1.3.1 |
| - | typing-extensions==4.15.0 |
| - | typing-inspect==0.9.0 |
| - | websockets==15.0.1 |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| <4,>=3.10 | Python |
نحوه نصب
نصب پکیج whl gladiaio-sdk-0.4.0:
pip install gladiaio-sdk-0.4.0.whl
نصب پکیج tar.gz gladiaio-sdk-0.4.0:
pip install gladiaio-sdk-0.4.0.tar.gz