lokutor 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.
lokutor-1.0.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Lokutor
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.
lokutor-1.0.0/PKG-INFO ADDED
@@ -0,0 +1,212 @@
1
+ Metadata-Version: 2.4
2
+ Name: lokutor
3
+ Version: 1.0.0
4
+ Summary: Production-ready Python SDK for Lokutor Voice Agent - Real-time AI voice conversations
5
+ Home-page: https://github.com/lokutor-ai/lokutor-sdk
6
+ Author: Lokutor
7
+ Author-email: Lokutor <support@lokutor.com>
8
+ License: MIT
9
+ Project-URL: Homepage, https://github.com/lokutor-ai/lokutor-sdk
10
+ Project-URL: Bug Tracker, https://github.com/lokutor-ai/lokutor-sdk/issues
11
+ Keywords: voice,ai,agent,conversation,tts,stt,llm
12
+ Classifier: Development Status :: 5 - Production/Stable
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Topic :: Multimedia :: Sound/Audio :: Speech
17
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
18
+ Requires-Python: >=3.8
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: websocket-client<2.0.0,>=1.0.0
22
+ Requires-Dist: pyaudio>=0.2.13
23
+ Requires-Dist: python-dotenv>=1.0.0
24
+ Provides-Extra: dev
25
+ Requires-Dist: pytest>=6.0; extra == "dev"
26
+ Requires-Dist: pytest-asyncio>=0.18.0; extra == "dev"
27
+ Requires-Dist: black>=22.0; extra == "dev"
28
+ Requires-Dist: flake8>=4.0; extra == "dev"
29
+ Requires-Dist: mypy>=0.900; extra == "dev"
30
+ Provides-Extra: docs
31
+ Requires-Dist: sphinx>=4.0; extra == "docs"
32
+ Requires-Dist: sphinx-rtd-theme>=1.0; extra == "docs"
33
+ Dynamic: author
34
+ Dynamic: home-page
35
+ Dynamic: license-file
36
+ Dynamic: requires-python
37
+
38
+ # Lokutor Voice Agent Python SDK
39
+
40
+ [![Python Version](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
41
+ [![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
42
+ [![PyPI Version](https://img.shields.io/badge/version-1.0.0-blue.svg)](https://pypi.org/project/lokutor/)
43
+
44
+ A powerful, production-grade Python SDK for real-time voice conversations with AI.
45
+ Seamlessly transcribe speech, generate intelligent responses, and synthesize natural speech—all in real-time.
46
+
47
+ ## Features
48
+
49
+ - 🎤 **Real-time Voice Input** - Automatic microphone recording with voice activity detection
50
+ - 🔊 **Natural Speech Output** - High-quality text-to-speech synthesis (44.1kHz)
51
+ - 🧠 **Intelligent Conversations** - LLM-powered responses with context awareness
52
+ - 🎯 **10 Voice Options** - Choose from diverse voices (F1-F5 female, M1-M5 male)
53
+ - 🌍 **Multi-Language** - English, Spanish, French, and more
54
+ - ⚡ **Low Latency** - Raw binary WebSocket streaming for real-time interaction
55
+ - 🛡️ **Production-Ready** - Thread-safe WebSocket management and proper audio buffering
56
+ - 📚 **Easy API** - Minimal code required to get started
57
+
58
+ ## Installation
59
+
60
+ ```bash
61
+ pip install lokutor
62
+ ```
63
+
64
+ Or from source:
65
+
66
+ ```bash
67
+ git clone https://github.com/team-hashing/lokutor_tts
68
+ cd sdk/python
69
+ pip install -e .
70
+ ```
71
+
72
+ Requires `PyAudio` and `websocket-client`.
73
+
74
+ ## Quick Start
75
+
76
+ ### Voice Conversation (Start Speaking!)
77
+
78
+ ```python
79
+ from lokutor import VoiceAgentClient
80
+ from lokutor.config import VoiceStyle, Language
81
+
82
+ client = VoiceAgentClient(api_key="your-api-key")
83
+ client.start_conversation()
84
+ ```
85
+
86
+ ### Standalone Text-to-Speech
87
+
88
+ ```python
89
+ from lokutor import TTSClient, VoiceStyle
90
+
91
+ client = TTSClient(api_key="your-api-key")
92
+ client.synthesize(
93
+ text="Hello world, this is a test of Lokutor streaming TTS.",
94
+ voice=VoiceStyle.F1,
95
+ play=True
96
+ )
97
+ ```
98
+
99
+ ## Core APIs
100
+
101
+ ### 1. `VoiceAgentClient`
102
+
103
+ Full conversational interface that handles VAD, STT, LLM, and TTS orchestration.
104
+
105
+ ```python
106
+ client = VoiceAgentClient(
107
+ api_key="your-key",
108
+ prompt="You are a helpful customer service agent",
109
+ voice=VoiceStyle.F2,
110
+ language=Language.ENGLISH
111
+ )
112
+ client.start_conversation()
113
+ ```
114
+
115
+ **Callbacks:**
116
+ - `on_transcription(text)`: Called when your speech is transcribed.
117
+ - `on_response(text)`: Called when the agent's text response is ready.
118
+ - `on_error(error)`: Called when a connection or server error occurs.
119
+
120
+ ### 2. `TTSClient`
121
+
122
+ For converting text to high-quality streaming audio.
123
+
124
+ ```python
125
+ client = TTSClient(api_key="your-key")
126
+ client.synthesize(
127
+ text="Welcome to our platform",
128
+ voice=VoiceStyle.M2,
129
+ play=True,
130
+ block=True
131
+ )
132
+ ```
133
+
134
+ ## Configuration
135
+
136
+ ### Voice Styles
137
+
138
+ | Female Voices | Male Voices |
139
+ |--------------|-----------|
140
+ | `VoiceStyle.F1` | `VoiceStyle.M1` |
141
+ | `VoiceStyle.F2` | `VoiceStyle.M2` |
142
+ | `VoiceStyle.F3` | `VoiceStyle.M3` |
143
+ | `VoiceStyle.F4` | `VoiceStyle.M4` |
144
+ | `VoiceStyle.F5` | `VoiceStyle.M5` |
145
+
146
+ ### Supported Languages
147
+
148
+ - `Language.ENGLISH`
149
+ - `Language.SPANISH`
150
+ - `Language.FRENCH`
151
+ - `Language.PORTUGUESE`
152
+ - `Language.KOREAN`
153
+
154
+ ## Usage Examples
155
+
156
+ ### Full Conversation with Callbacks
157
+
158
+ ```python
159
+ from lokutor import VoiceAgentClient, VoiceStyle
160
+
161
+ def handle_user_text(text):
162
+ print(f"User said: {text}")
163
+
164
+ def handle_agent_text(text):
165
+ print(f"Agent replied: {text}")
166
+
167
+ client = VoiceAgentClient(
168
+ api_key="demo",
169
+ prompt="You are a friendly pirate assistant",
170
+ on_transcription=handle_user_text,
171
+ on_response=handle_agent_text
172
+ )
173
+
174
+ client.start_conversation()
175
+ ```
176
+
177
+ ### Scripted TTS with Visemes
178
+
179
+ ```python
180
+ from lokutor import TTSClient
181
+
182
+ def handle_visemes(visemes):
183
+ # Perfect for syncing 3D character lip-sync
184
+ print(f"Syncing lips: {visemes}")
185
+
186
+ client = TTSClient(api_key="demo")
187
+ client.synthesize(
188
+ text="Look at my lips moving!",
189
+ visemes=True,
190
+ on_visemes=handle_visemes
191
+ )
192
+ ```
193
+
194
+ ## Troubleshooting
195
+
196
+ ### Connection Issues
197
+ The SDK defaults to `wss://api.lokutor.com`. If you are running a local server, override the `server_url`:
198
+
199
+ ```python
200
+ client = VoiceAgentClient(
201
+ api_key="demo",
202
+ server_url="ws://localhost:8080/ws/agent"
203
+ )
204
+ ```
205
+
206
+ ### PyAudio Installation
207
+ If you encounter issues installing `pyaudio`, you may need to install portaudio first:
208
+ - **macOS**: `brew install portaudio`
209
+ - **Linux**: `sudo apt-get install python3-pyaudio` or `sudo apt-get install portaudio19-dev`
210
+
211
+ ## License
212
+ MIT License
@@ -0,0 +1,175 @@
1
+ # Lokutor Voice Agent Python SDK
2
+
3
+ [![Python Version](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
4
+ [![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
5
+ [![PyPI Version](https://img.shields.io/badge/version-1.0.0-blue.svg)](https://pypi.org/project/lokutor/)
6
+
7
+ A powerful, production-grade Python SDK for real-time voice conversations with AI.
8
+ Seamlessly transcribe speech, generate intelligent responses, and synthesize natural speech—all in real-time.
9
+
10
+ ## Features
11
+
12
+ - 🎤 **Real-time Voice Input** - Automatic microphone recording with voice activity detection
13
+ - 🔊 **Natural Speech Output** - High-quality text-to-speech synthesis (44.1kHz)
14
+ - 🧠 **Intelligent Conversations** - LLM-powered responses with context awareness
15
+ - 🎯 **10 Voice Options** - Choose from diverse voices (F1-F5 female, M1-M5 male)
16
+ - 🌍 **Multi-Language** - English, Spanish, French, and more
17
+ - ⚡ **Low Latency** - Raw binary WebSocket streaming for real-time interaction
18
+ - 🛡️ **Production-Ready** - Thread-safe WebSocket management and proper audio buffering
19
+ - 📚 **Easy API** - Minimal code required to get started
20
+
21
+ ## Installation
22
+
23
+ ```bash
24
+ pip install lokutor
25
+ ```
26
+
27
+ Or from source:
28
+
29
+ ```bash
30
+ git clone https://github.com/team-hashing/lokutor_tts
31
+ cd sdk/python
32
+ pip install -e .
33
+ ```
34
+
35
+ Requires `PyAudio` and `websocket-client`.
36
+
37
+ ## Quick Start
38
+
39
+ ### Voice Conversation (Start Speaking!)
40
+
41
+ ```python
42
+ from lokutor import VoiceAgentClient
43
+ from lokutor.config import VoiceStyle, Language
44
+
45
+ client = VoiceAgentClient(api_key="your-api-key")
46
+ client.start_conversation()
47
+ ```
48
+
49
+ ### Standalone Text-to-Speech
50
+
51
+ ```python
52
+ from lokutor import TTSClient, VoiceStyle
53
+
54
+ client = TTSClient(api_key="your-api-key")
55
+ client.synthesize(
56
+ text="Hello world, this is a test of Lokutor streaming TTS.",
57
+ voice=VoiceStyle.F1,
58
+ play=True
59
+ )
60
+ ```
61
+
62
+ ## Core APIs
63
+
64
+ ### 1. `VoiceAgentClient`
65
+
66
+ Full conversational interface that handles VAD, STT, LLM, and TTS orchestration.
67
+
68
+ ```python
69
+ client = VoiceAgentClient(
70
+ api_key="your-key",
71
+ prompt="You are a helpful customer service agent",
72
+ voice=VoiceStyle.F2,
73
+ language=Language.ENGLISH
74
+ )
75
+ client.start_conversation()
76
+ ```
77
+
78
+ **Callbacks:**
79
+ - `on_transcription(text)`: Called when your speech is transcribed.
80
+ - `on_response(text)`: Called when the agent's text response is ready.
81
+ - `on_error(error)`: Called when a connection or server error occurs.
82
+
83
+ ### 2. `TTSClient`
84
+
85
+ For converting text to high-quality streaming audio.
86
+
87
+ ```python
88
+ client = TTSClient(api_key="your-key")
89
+ client.synthesize(
90
+ text="Welcome to our platform",
91
+ voice=VoiceStyle.M2,
92
+ play=True,
93
+ block=True
94
+ )
95
+ ```
96
+
97
+ ## Configuration
98
+
99
+ ### Voice Styles
100
+
101
+ | Female Voices | Male Voices |
102
+ |--------------|-----------|
103
+ | `VoiceStyle.F1` | `VoiceStyle.M1` |
104
+ | `VoiceStyle.F2` | `VoiceStyle.M2` |
105
+ | `VoiceStyle.F3` | `VoiceStyle.M3` |
106
+ | `VoiceStyle.F4` | `VoiceStyle.M4` |
107
+ | `VoiceStyle.F5` | `VoiceStyle.M5` |
108
+
109
+ ### Supported Languages
110
+
111
+ - `Language.ENGLISH`
112
+ - `Language.SPANISH`
113
+ - `Language.FRENCH`
114
+ - `Language.PORTUGUESE`
115
+ - `Language.KOREAN`
116
+
117
+ ## Usage Examples
118
+
119
+ ### Full Conversation with Callbacks
120
+
121
+ ```python
122
+ from lokutor import VoiceAgentClient, VoiceStyle
123
+
124
+ def handle_user_text(text):
125
+ print(f"User said: {text}")
126
+
127
+ def handle_agent_text(text):
128
+ print(f"Agent replied: {text}")
129
+
130
+ client = VoiceAgentClient(
131
+ api_key="demo",
132
+ prompt="You are a friendly pirate assistant",
133
+ on_transcription=handle_user_text,
134
+ on_response=handle_agent_text
135
+ )
136
+
137
+ client.start_conversation()
138
+ ```
139
+
140
+ ### Scripted TTS with Visemes
141
+
142
+ ```python
143
+ from lokutor import TTSClient
144
+
145
+ def handle_visemes(visemes):
146
+ # Perfect for syncing 3D character lip-sync
147
+ print(f"Syncing lips: {visemes}")
148
+
149
+ client = TTSClient(api_key="demo")
150
+ client.synthesize(
151
+ text="Look at my lips moving!",
152
+ visemes=True,
153
+ on_visemes=handle_visemes
154
+ )
155
+ ```
156
+
157
+ ## Troubleshooting
158
+
159
+ ### Connection Issues
160
+ The SDK defaults to `wss://api.lokutor.com`. If you are running a local server, override the `server_url`:
161
+
162
+ ```python
163
+ client = VoiceAgentClient(
164
+ api_key="demo",
165
+ server_url="ws://localhost:8080/ws/agent"
166
+ )
167
+ ```
168
+
169
+ ### PyAudio Installation
170
+ If you encounter issues installing `pyaudio`, you may need to install portaudio first:
171
+ - **macOS**: `brew install portaudio`
172
+ - **Linux**: `sudo apt-get install python3-pyaudio` or `sudo apt-get install portaudio19-dev`
173
+
174
+ ## License
175
+ MIT License
@@ -0,0 +1,8 @@
1
+ """
2
+ Lokutor Voice Agent Python SDK
3
+ """
4
+
5
+ from .client import VoiceAgentClient, TTSClient, simple_conversation, simple_tts
6
+ from .config import VoiceStyle, Language
7
+
8
+ __all__ = ["VoiceAgentClient", "TTSClient", "simple_conversation", "simple_tts", "VoiceStyle", "Language"]