sayna-client 0.0.1__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.

Potentially problematic release.


This version of sayna-client might be problematic. Click here for more details.

@@ -0,0 +1,228 @@
1
+ Metadata-Version: 2.4
2
+ Name: sayna-client
3
+ Version: 0.0.1
4
+ Summary: Python SDK for Sayna server-side WebSocket connections
5
+ Author: Sayna Team
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/sayna/saysdk
8
+ Project-URL: Repository, https://github.com/sayna/saysdk
9
+ Project-URL: Documentation, https://github.com/sayna/saysdk/tree/main/python-sdk
10
+ Project-URL: Issues, https://github.com/sayna/saysdk/issues
11
+ Keywords: sayna,websocket,sdk,server,real-time
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
+ Classifier: Topic :: Communications
24
+ Classifier: Framework :: AsyncIO
25
+ Classifier: Typing :: Typed
26
+ Requires-Python: >=3.9
27
+ Description-Content-Type: text/markdown
28
+ Requires-Dist: aiohttp>=3.9.0
29
+ Requires-Dist: pydantic>=2.0.0
30
+ Provides-Extra: dev
31
+ Requires-Dist: pytest>=8.0.0; extra == "dev"
32
+ Requires-Dist: pytest-asyncio>=0.23.0; extra == "dev"
33
+ Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
34
+ Requires-Dist: mypy>=1.8.0; extra == "dev"
35
+ Requires-Dist: ruff>=0.6.0; extra == "dev"
36
+
37
+ # Sayna Python SDK
38
+
39
+ Python SDK for Sayna server-side WebSocket connections, enabling real-time voice interactions with speech-to-text (STT) and text-to-speech (TTS) capabilities.
40
+
41
+ ## Features
42
+
43
+ - 🎤 **Speech-to-Text**: Real-time transcription with support for multiple providers (Deepgram, Google, etc.)
44
+ - 🔊 **Text-to-Speech**: High-quality voice synthesis with various TTS providers (ElevenLabs, Google, etc.)
45
+ - 🔌 **WebSocket Connection**: Async/await support with aiohttp
46
+ - ✅ **Type Safety**: Full type hints with Pydantic models
47
+ - 🚀 **Easy to Use**: Simple, intuitive API
48
+ - 📦 **Modern Python**: Built for Python 3.9+
49
+
50
+ ## Installation
51
+
52
+ ### Using pip
53
+
54
+ ```bash
55
+ pip install sayna-client
56
+ ```
57
+
58
+ ### Using uv (recommended for faster installation)
59
+
60
+ ```bash
61
+ uv pip install sayna-client
62
+ ```
63
+
64
+ ### From source
65
+
66
+ ```bash
67
+ git clone https://github.com/sayna/saysdk.git
68
+ cd saysdk/python-sdk
69
+ pip install -e .
70
+ ```
71
+
72
+ ## Development Setup
73
+
74
+ This project supports both traditional pip and modern uv package managers.
75
+
76
+ ### Option 1: Traditional Setup with pip
77
+
78
+ ```bash
79
+ # Create a virtual environment
80
+ python -m venv .venv
81
+
82
+ # Activate the virtual environment
83
+ # On Linux/macOS:
84
+ source .venv/bin/activate
85
+ # On Windows:
86
+ # .venv\Scripts\activate
87
+
88
+ # Install development dependencies
89
+ pip install -e ".[dev]"
90
+ ```
91
+
92
+ ### Option 2: Modern Setup with uv (Faster)
93
+
94
+ ```bash
95
+ # Install uv if you haven't already
96
+ pip install uv
97
+
98
+ # Create a virtual environment with uv
99
+ uv venv
100
+
101
+ # Activate the virtual environment
102
+ source .venv/bin/activate # On Linux/macOS
103
+ # .venv\Scripts\activate on Windows
104
+
105
+ # Install development dependencies with uv
106
+ uv pip install -e ".[dev]"
107
+ ```
108
+
109
+ ## Quick Start
110
+
111
+ ```python
112
+ import asyncio
113
+ from sayna_client import SaynaClient, STTConfig, TTSConfig
114
+
115
+ async def main():
116
+ # Initialize the client
117
+ client = SaynaClient(
118
+ url="wss://api.sayna.com/ws",
119
+ api_key="your-api-key"
120
+ )
121
+
122
+ # Configure STT and TTS
123
+ stt_config = STTConfig(
124
+ provider="deepgram",
125
+ language="en-US",
126
+ sample_rate=16000,
127
+ channels=1,
128
+ punctuation=True,
129
+ encoding="linear16",
130
+ model="nova-2"
131
+ )
132
+
133
+ tts_config = TTSConfig(
134
+ provider="elevenlabs",
135
+ voice_id="your-voice-id",
136
+ speaking_rate=1.0,
137
+ audio_format="mp3",
138
+ sample_rate=24000,
139
+ connection_timeout=5000,
140
+ request_timeout=10000,
141
+ model="eleven_multilingual_v2",
142
+ pronunciations=[]
143
+ )
144
+
145
+ # Connect to Sayna
146
+ await client.connect()
147
+
148
+ # Your application logic here
149
+
150
+ # Disconnect when done
151
+ await client.disconnect()
152
+
153
+ if __name__ == "__main__":
154
+ asyncio.run(main())
155
+ ```
156
+
157
+ ## Development
158
+
159
+ ### Running Tests
160
+
161
+ ```bash
162
+ # Run all tests
163
+ pytest
164
+
165
+ # Run with coverage
166
+ pytest --cov=sayna_client --cov-report=html
167
+
168
+ # Run specific test file
169
+ pytest tests/test_client.py
170
+ ```
171
+
172
+ ### Type Checking
173
+
174
+ ```bash
175
+ mypy src/sayna_client
176
+ ```
177
+
178
+ ### Linting and Formatting
179
+
180
+ This project uses [Ruff](https://github.com/astral-sh/ruff) for linting and formatting:
181
+
182
+ ```bash
183
+ # Check code
184
+ ruff check .
185
+
186
+ # Format code
187
+ ruff format .
188
+
189
+ # Fix auto-fixable issues
190
+ ruff check --fix .
191
+ ```
192
+
193
+ ### Project Structure
194
+
195
+ ```
196
+ python-sdk/
197
+ ├── src/
198
+ │ └── sayna_client/ # Main package
199
+ │ ├── __init__.py # Package exports
200
+ │ ├── client.py # SaynaClient implementation
201
+ │ ├── types.py # Pydantic models
202
+ │ ├── errors.py # Custom exceptions
203
+ │ └── py.typed # PEP 561 marker
204
+ ├── tests/ # Test suite
205
+ ├── examples/ # Usage examples
206
+ ├── pyproject.toml # Package configuration
207
+ ├── requirements.txt # Runtime dependencies
208
+ ├── requirements-dev.txt # Development dependencies
209
+ └── README.md # This file
210
+ ```
211
+
212
+ ## Requirements
213
+
214
+ - Python 3.9 or higher
215
+ - aiohttp >= 3.9.0
216
+ - pydantic >= 2.0.0
217
+
218
+ ## License
219
+
220
+ MIT License - see LICENSE file for details
221
+
222
+ ## Contributing
223
+
224
+ Contributions are welcome! Please feel free to submit a Pull Request.
225
+
226
+ ## Support
227
+
228
+ For issues and questions, please visit the [GitHub Issues](https://github.com/sayna/saysdk/issues) page.
@@ -0,0 +1,192 @@
1
+ # Sayna Python SDK
2
+
3
+ Python SDK for Sayna server-side WebSocket connections, enabling real-time voice interactions with speech-to-text (STT) and text-to-speech (TTS) capabilities.
4
+
5
+ ## Features
6
+
7
+ - 🎤 **Speech-to-Text**: Real-time transcription with support for multiple providers (Deepgram, Google, etc.)
8
+ - 🔊 **Text-to-Speech**: High-quality voice synthesis with various TTS providers (ElevenLabs, Google, etc.)
9
+ - 🔌 **WebSocket Connection**: Async/await support with aiohttp
10
+ - ✅ **Type Safety**: Full type hints with Pydantic models
11
+ - 🚀 **Easy to Use**: Simple, intuitive API
12
+ - 📦 **Modern Python**: Built for Python 3.9+
13
+
14
+ ## Installation
15
+
16
+ ### Using pip
17
+
18
+ ```bash
19
+ pip install sayna-client
20
+ ```
21
+
22
+ ### Using uv (recommended for faster installation)
23
+
24
+ ```bash
25
+ uv pip install sayna-client
26
+ ```
27
+
28
+ ### From source
29
+
30
+ ```bash
31
+ git clone https://github.com/sayna/saysdk.git
32
+ cd saysdk/python-sdk
33
+ pip install -e .
34
+ ```
35
+
36
+ ## Development Setup
37
+
38
+ This project supports both traditional pip and modern uv package managers.
39
+
40
+ ### Option 1: Traditional Setup with pip
41
+
42
+ ```bash
43
+ # Create a virtual environment
44
+ python -m venv .venv
45
+
46
+ # Activate the virtual environment
47
+ # On Linux/macOS:
48
+ source .venv/bin/activate
49
+ # On Windows:
50
+ # .venv\Scripts\activate
51
+
52
+ # Install development dependencies
53
+ pip install -e ".[dev]"
54
+ ```
55
+
56
+ ### Option 2: Modern Setup with uv (Faster)
57
+
58
+ ```bash
59
+ # Install uv if you haven't already
60
+ pip install uv
61
+
62
+ # Create a virtual environment with uv
63
+ uv venv
64
+
65
+ # Activate the virtual environment
66
+ source .venv/bin/activate # On Linux/macOS
67
+ # .venv\Scripts\activate on Windows
68
+
69
+ # Install development dependencies with uv
70
+ uv pip install -e ".[dev]"
71
+ ```
72
+
73
+ ## Quick Start
74
+
75
+ ```python
76
+ import asyncio
77
+ from sayna_client import SaynaClient, STTConfig, TTSConfig
78
+
79
+ async def main():
80
+ # Initialize the client
81
+ client = SaynaClient(
82
+ url="wss://api.sayna.com/ws",
83
+ api_key="your-api-key"
84
+ )
85
+
86
+ # Configure STT and TTS
87
+ stt_config = STTConfig(
88
+ provider="deepgram",
89
+ language="en-US",
90
+ sample_rate=16000,
91
+ channels=1,
92
+ punctuation=True,
93
+ encoding="linear16",
94
+ model="nova-2"
95
+ )
96
+
97
+ tts_config = TTSConfig(
98
+ provider="elevenlabs",
99
+ voice_id="your-voice-id",
100
+ speaking_rate=1.0,
101
+ audio_format="mp3",
102
+ sample_rate=24000,
103
+ connection_timeout=5000,
104
+ request_timeout=10000,
105
+ model="eleven_multilingual_v2",
106
+ pronunciations=[]
107
+ )
108
+
109
+ # Connect to Sayna
110
+ await client.connect()
111
+
112
+ # Your application logic here
113
+
114
+ # Disconnect when done
115
+ await client.disconnect()
116
+
117
+ if __name__ == "__main__":
118
+ asyncio.run(main())
119
+ ```
120
+
121
+ ## Development
122
+
123
+ ### Running Tests
124
+
125
+ ```bash
126
+ # Run all tests
127
+ pytest
128
+
129
+ # Run with coverage
130
+ pytest --cov=sayna_client --cov-report=html
131
+
132
+ # Run specific test file
133
+ pytest tests/test_client.py
134
+ ```
135
+
136
+ ### Type Checking
137
+
138
+ ```bash
139
+ mypy src/sayna_client
140
+ ```
141
+
142
+ ### Linting and Formatting
143
+
144
+ This project uses [Ruff](https://github.com/astral-sh/ruff) for linting and formatting:
145
+
146
+ ```bash
147
+ # Check code
148
+ ruff check .
149
+
150
+ # Format code
151
+ ruff format .
152
+
153
+ # Fix auto-fixable issues
154
+ ruff check --fix .
155
+ ```
156
+
157
+ ### Project Structure
158
+
159
+ ```
160
+ python-sdk/
161
+ ├── src/
162
+ │ └── sayna_client/ # Main package
163
+ │ ├── __init__.py # Package exports
164
+ │ ├── client.py # SaynaClient implementation
165
+ │ ├── types.py # Pydantic models
166
+ │ ├── errors.py # Custom exceptions
167
+ │ └── py.typed # PEP 561 marker
168
+ ├── tests/ # Test suite
169
+ ├── examples/ # Usage examples
170
+ ├── pyproject.toml # Package configuration
171
+ ├── requirements.txt # Runtime dependencies
172
+ ├── requirements-dev.txt # Development dependencies
173
+ └── README.md # This file
174
+ ```
175
+
176
+ ## Requirements
177
+
178
+ - Python 3.9 or higher
179
+ - aiohttp >= 3.9.0
180
+ - pydantic >= 2.0.0
181
+
182
+ ## License
183
+
184
+ MIT License - see LICENSE file for details
185
+
186
+ ## Contributing
187
+
188
+ Contributions are welcome! Please feel free to submit a Pull Request.
189
+
190
+ ## Support
191
+
192
+ For issues and questions, please visit the [GitHub Issues](https://github.com/sayna/saysdk/issues) page.
@@ -0,0 +1,149 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "sayna-client"
7
+ version = "0.0.1"
8
+ description = "Python SDK for Sayna server-side WebSocket connections"
9
+ readme = "README.md"
10
+ requires-python = ">=3.9"
11
+ license = {text = "MIT"}
12
+ authors = [
13
+ {name = "Sayna Team"}
14
+ ]
15
+ keywords = ["sayna", "websocket", "sdk", "server", "real-time"]
16
+ classifiers = [
17
+ "Development Status :: 3 - Alpha",
18
+ "Intended Audience :: Developers",
19
+ "License :: OSI Approved :: MIT License",
20
+ "Operating System :: OS Independent",
21
+ "Programming Language :: Python :: 3",
22
+ "Programming Language :: Python :: 3.9",
23
+ "Programming Language :: Python :: 3.10",
24
+ "Programming Language :: Python :: 3.11",
25
+ "Programming Language :: Python :: 3.12",
26
+ "Programming Language :: Python :: 3.13",
27
+ "Topic :: Software Development :: Libraries :: Python Modules",
28
+ "Topic :: Communications",
29
+ "Framework :: AsyncIO",
30
+ "Typing :: Typed",
31
+ ]
32
+
33
+ dependencies = [
34
+ "aiohttp>=3.9.0",
35
+ "pydantic>=2.0.0",
36
+ ]
37
+
38
+ [project.optional-dependencies]
39
+ dev = [
40
+ "pytest>=8.0.0",
41
+ "pytest-asyncio>=0.23.0",
42
+ "pytest-cov>=4.1.0",
43
+ "mypy>=1.8.0",
44
+ "ruff>=0.6.0",
45
+ ]
46
+
47
+ [project.urls]
48
+ Homepage = "https://github.com/sayna/saysdk"
49
+ Repository = "https://github.com/sayna/saysdk"
50
+ Documentation = "https://github.com/sayna/saysdk/tree/main/python-sdk"
51
+ Issues = "https://github.com/sayna/saysdk/issues"
52
+
53
+ [tool.setuptools.packages.find]
54
+ where = ["src"]
55
+ include = ["sayna_client*"]
56
+
57
+ [tool.setuptools.package-data]
58
+ sayna_client = ["py.typed"]
59
+
60
+ # Ruff configuration - Modern Python linter and formatter
61
+ [tool.ruff]
62
+ target-version = "py39"
63
+ line-length = 100
64
+
65
+ [tool.ruff.lint]
66
+ select = [
67
+ "E", # pycodestyle errors
68
+ "W", # pycodestyle warnings
69
+ "F", # pyflakes
70
+ "I", # isort
71
+ "B", # flake8-bugbear
72
+ "C4", # flake8-comprehensions
73
+ "UP", # pyupgrade
74
+ "ARG", # flake8-unused-arguments
75
+ "SIM", # flake8-simplify
76
+ "TCH", # flake8-type-checking
77
+ "PL", # pylint
78
+ "RUF", # ruff-specific rules
79
+ ]
80
+ ignore = [
81
+ "E501", # line too long (handled by formatter)
82
+ "PLR0913", # too many arguments
83
+ "PLR2004", # magic value used in comparison
84
+ "RUF022", # __all__ is not sorted (we use semantic grouping)
85
+ ]
86
+
87
+ [tool.ruff.lint.per-file-ignores]
88
+ "tests/**/*.py" = ["ARG", "PLR2004"]
89
+
90
+ [tool.ruff.lint.isort]
91
+ known-first-party = ["sayna_client"]
92
+
93
+ # MyPy configuration - Static type checker
94
+ [tool.mypy]
95
+ python_version = "3.9"
96
+ strict = true
97
+ warn_return_any = true
98
+ warn_unused_configs = true
99
+ disallow_untyped_defs = true
100
+ disallow_any_generics = true
101
+ disallow_subclassing_any = true
102
+ disallow_untyped_calls = true
103
+ disallow_incomplete_defs = true
104
+ check_untyped_defs = true
105
+ no_implicit_optional = true
106
+ warn_redundant_casts = true
107
+ warn_unused_ignores = true
108
+ warn_no_return = true
109
+ follow_imports = "normal"
110
+ show_error_codes = true
111
+
112
+ [[tool.mypy.overrides]]
113
+ module = "tests.*"
114
+ disallow_untyped_defs = false
115
+
116
+ # Pytest configuration
117
+ [tool.pytest.ini_options]
118
+ minversion = "8.0"
119
+ testpaths = ["tests"]
120
+ python_files = ["test_*.py"]
121
+ python_classes = ["Test*"]
122
+ python_functions = ["test_*"]
123
+ asyncio_mode = "auto"
124
+ addopts = [
125
+ "--strict-markers",
126
+ "--strict-config",
127
+ "--cov=sayna_client",
128
+ "--cov-report=term-missing",
129
+ "--cov-report=html",
130
+ ]
131
+
132
+ # Coverage configuration
133
+ [tool.coverage.run]
134
+ source = ["src"]
135
+ omit = [
136
+ "*/tests/*",
137
+ "*/examples/*",
138
+ ]
139
+
140
+ [tool.coverage.report]
141
+ exclude_lines = [
142
+ "pragma: no cover",
143
+ "def __repr__",
144
+ "raise AssertionError",
145
+ "raise NotImplementedError",
146
+ "if __name__ == .__main__.:",
147
+ "if TYPE_CHECKING:",
148
+ "@abstractmethod",
149
+ ]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,74 @@
1
+ """Sayna Python SDK for server-side WebSocket connections."""
2
+
3
+ from sayna_client.client import SaynaClient
4
+ from sayna_client.errors import (
5
+ SaynaConnectionError,
6
+ SaynaError,
7
+ SaynaNotConnectedError,
8
+ SaynaNotReadyError,
9
+ SaynaServerError,
10
+ SaynaValidationError,
11
+ )
12
+ from sayna_client.types import (
13
+ ClearMessage,
14
+ ConfigMessage,
15
+ ErrorMessage,
16
+ HealthResponse,
17
+ LiveKitConfig,
18
+ LiveKitTokenRequest,
19
+ LiveKitTokenResponse,
20
+ MessageMessage,
21
+ OutgoingMessage,
22
+ Participant,
23
+ ParticipantDisconnectedMessage,
24
+ Pronunciation,
25
+ ReadyMessage,
26
+ SaynaMessage,
27
+ SendMessageMessage,
28
+ SpeakMessage,
29
+ SpeakRequest,
30
+ STTConfig,
31
+ STTResultMessage,
32
+ TTSConfig,
33
+ TTSPlaybackCompleteMessage,
34
+ VoiceDescriptor,
35
+ )
36
+
37
+ __version__ = "0.0.1"
38
+
39
+ __all__ = [
40
+ # Client
41
+ "SaynaClient",
42
+ # Errors
43
+ "SaynaError",
44
+ "SaynaNotConnectedError",
45
+ "SaynaNotReadyError",
46
+ "SaynaConnectionError",
47
+ "SaynaValidationError",
48
+ "SaynaServerError",
49
+ # Configuration Types
50
+ "STTConfig",
51
+ "TTSConfig",
52
+ "LiveKitConfig",
53
+ "Pronunciation",
54
+ # WebSocket Message Types
55
+ "ConfigMessage",
56
+ "SpeakMessage",
57
+ "ClearMessage",
58
+ "SendMessageMessage",
59
+ "ReadyMessage",
60
+ "STTResultMessage",
61
+ "ErrorMessage",
62
+ "SaynaMessage",
63
+ "MessageMessage",
64
+ "Participant",
65
+ "ParticipantDisconnectedMessage",
66
+ "TTSPlaybackCompleteMessage",
67
+ "OutgoingMessage",
68
+ # REST API Types
69
+ "HealthResponse",
70
+ "VoiceDescriptor",
71
+ "LiveKitTokenRequest",
72
+ "LiveKitTokenResponse",
73
+ "SpeakRequest",
74
+ ]