livekit-plugins-palabra 1.7.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.
@@ -0,0 +1,180 @@
1
+ **/.vscode
2
+ **/.DS_Store
3
+ .env
4
+
5
+ # Byte-compiled / optimized / DLL files
6
+ __pycache__/
7
+ *.py[cod]
8
+ *$py.class
9
+
10
+ # C extensions
11
+ *.so
12
+
13
+ # Distribution / packaging
14
+ .Python
15
+ build/
16
+ develop-eggs/
17
+ dist/
18
+ downloads/
19
+ eggs/
20
+ .eggs/
21
+ lib/
22
+ lib64/
23
+ parts/
24
+ sdist/
25
+ var/
26
+ wheels/
27
+ share/python-wheels/
28
+ *.egg-info/
29
+ .installed.cfg
30
+ *.egg
31
+ MANIFEST
32
+
33
+ # PyInstaller
34
+ # Usually these files are written by a python script from a template
35
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
36
+ *.manifest
37
+ *.spec
38
+
39
+ # Installer logs
40
+ pip-log.txt
41
+ pip-delete-this-directory.txt
42
+
43
+ # Unit test / coverage reports
44
+ htmlcov/
45
+ .tox/
46
+ .nox/
47
+ .coverage
48
+ .coverage.*
49
+ .cache
50
+ nosetests.xml
51
+ coverage.xml
52
+ *.cover
53
+ *.py,cover
54
+ .hypothesis/
55
+ .pytest_cache/
56
+ cover/
57
+
58
+ # Translations
59
+ *.mo
60
+ *.pot
61
+
62
+ # Django stuff:
63
+ *.log
64
+ local_settings.py
65
+ db.sqlite3
66
+ db.sqlite3-journal
67
+
68
+ # Flask stuff:
69
+ instance/
70
+ .webassets-cache
71
+
72
+ # Scrapy stuff:
73
+ .scrapy
74
+
75
+ # Sphinx documentation
76
+ docs/_build/
77
+
78
+ # PyBuilder
79
+ .pybuilder/
80
+ target/
81
+
82
+ # Jupyter Notebook
83
+ .ipynb_checkpoints
84
+
85
+ # IPython
86
+ profile_default/
87
+ ipython_config.py
88
+
89
+ # pyenv
90
+ # For a library or package, you might want to ignore these files since the code is
91
+ # intended to run in multiple environments; otherwise, check them in:
92
+ # .python-version
93
+
94
+ # pipenv
95
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
96
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
97
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
98
+ # install all needed dependencies.
99
+ #Pipfile.lock
100
+
101
+ # poetry
102
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
103
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
104
+ # commonly ignored for libraries.
105
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
106
+ #poetry.lock
107
+
108
+ # pdm
109
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
110
+ #pdm.lock
111
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
112
+ # in version control.
113
+ # https://pdm.fming.dev/#use-with-ide
114
+ .pdm.toml
115
+
116
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
117
+ __pypackages__/
118
+
119
+ # Celery stuff
120
+ celerybeat-schedule
121
+ celerybeat.pid
122
+
123
+ # SageMath parsed files
124
+ *.sage.py
125
+
126
+ # Environments
127
+ .env
128
+ .venv
129
+ env/
130
+ venv/
131
+ ENV/
132
+ env.bak/
133
+ venv.bak/
134
+
135
+ # Spyder project settings
136
+ .spyderproject
137
+ .spyproject
138
+
139
+ # Rope project settings
140
+ .ropeproject
141
+
142
+ # mkdocs documentation
143
+ /site
144
+
145
+ # mypy
146
+ .mypy_cache/
147
+ .dmypy.json
148
+ dmypy.json
149
+
150
+ # trunk
151
+ .trunk/
152
+
153
+ # Pyre type checker
154
+ .pyre/
155
+
156
+ # pytype static type analyzer
157
+ .pytype/
158
+
159
+ # Cython debug symbols
160
+ cython_debug/
161
+
162
+ # PyCharm
163
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
164
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
165
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
166
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
167
+ .idea/
168
+
169
+ node_modules
170
+
171
+ credentials.json
172
+ pyrightconfig.json
173
+ docs/
174
+
175
+ # Database files
176
+ *.db
177
+
178
+
179
+ # Examples for development
180
+ examples/dev/*
@@ -0,0 +1,102 @@
1
+ Metadata-Version: 2.5
2
+ Name: livekit-plugins-palabra
3
+ Version: 1.7.1
4
+ Summary: LiveKit Agents plugin for Palabra realtime STT and TTS.
5
+ Project-URL: Documentation, https://docs.livekit.io
6
+ Project-URL: Website, https://palabra.ai/
7
+ Project-URL: Source, https://github.com/livekit/agents
8
+ Author-email: LiveKit <hello@livekit.io>
9
+ License-Expression: Apache-2.0
10
+ Keywords: ai,audio,livekit,palabra,realtime,stt,tts,voice
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: Apache Software License
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3 :: Only
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Topic :: Multimedia :: Sound/Audio
17
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
18
+ Requires-Python: >=3.10.0
19
+ Requires-Dist: livekit-agents>=1.7.1
20
+ Requires-Dist: palabra-ai>=2.0.2
21
+ Description-Content-Type: text/markdown
22
+
23
+ # Palabra plugin for LiveKit Agents
24
+
25
+ Support for Palabra realtime [Speech-to-Text](https://platform.palabra.ai/docs/speech-to-text/realtime-stt) and [Text-to-Speech](https://platform.palabra.ai/docs/text-to-speech/realtime-tts) APIs, using WebSocket streaming interfaces.
26
+
27
+ See [STT documentation](https://docs.livekit.io/agents/models/stt/palabra/) and [TTS documentation](https://docs.livekit.io/agents/models/tts/palabra/) for more information.
28
+
29
+ ## Installation
30
+
31
+ ```bash
32
+ pip install livekit-plugins-palabra
33
+ ```
34
+
35
+ ## Pre-requisites
36
+
37
+ The Palabra plugin requires an API key to authenticate. You can create one at [platform.palabra.ai/api-keys](https://platform.palabra.ai/api-keys).
38
+
39
+ Set the API key in your `.env` file:
40
+
41
+ ```
42
+ PALABRA_API_KEY=<your_palabra_api_key>
43
+ ```
44
+
45
+
46
+
47
+ ## Usage
48
+
49
+
50
+
51
+ ### Speech-to-Text (STT)
52
+
53
+ Use Palabra STT in an `AgentSession` or as a standalone streaming transcription service. The spoken language is auto-detected by default:
54
+
55
+ ```python
56
+ from livekit.agents import AgentSession
57
+ from livekit.plugins import palabra
58
+
59
+ session = AgentSession(
60
+ stt=palabra.STT(),
61
+ # ... llm, tts, etc.
62
+ )
63
+ ```
64
+
65
+
66
+
67
+ ### Live translation
68
+
69
+ Palabra STT can translate speech on the fly. With `translate_languages` set, each emitted `SpeechData` maps as: `language`/`text` = the translation; `source_languages`/`source_texts` = the original speech. Final transcripts arrive already in the target language, so a translating agent works without an LLM in the loop:
70
+
71
+ ```python
72
+ stt = palabra.STT(translate_languages=["es"])
73
+ ```
74
+
75
+
76
+
77
+ ### Text-to-Speech (TTS)
78
+
79
+ Use Palabra TTS for real-time speech synthesis:
80
+
81
+ ```python
82
+ from livekit.plugins import palabra
83
+
84
+ session = AgentSession(
85
+ tts=palabra.TTS(
86
+ language="en",
87
+ voice_id="default_low", # or "default_high", or any Palabra voice id
88
+ speed=0.5, # 0.0-1.0; 0.5 is natural conversational pace
89
+ ),
90
+ # ... stt, llm, etc.
91
+ )
92
+ ```
93
+
94
+ The TTS streams over one persistent WebSocket session: text chunks coming from the LLM are tokenized into sentences and synthesized as they arrive, and an interruption cancels the in-flight synthesis server-side.
95
+
96
+ ## More information and reference
97
+
98
+ - [Palabra realtime STT API](https://platform.palabra.ai/docs/speech-to-text/realtime-stt)
99
+ - [Palabra realtime TTS API](https://platform.palabra.ai/docs/text-to-speech/realtime-tts)
100
+ - [Palabra platform](https://platform.palabra.ai) — API keys and usage
101
+ - [palabra-ai Python SDK](https://pypi.org/project/palabra-ai/) — the transport this plugin builds on
102
+
@@ -0,0 +1,80 @@
1
+ # Palabra plugin for LiveKit Agents
2
+
3
+ Support for Palabra realtime [Speech-to-Text](https://platform.palabra.ai/docs/speech-to-text/realtime-stt) and [Text-to-Speech](https://platform.palabra.ai/docs/text-to-speech/realtime-tts) APIs, using WebSocket streaming interfaces.
4
+
5
+ See [STT documentation](https://docs.livekit.io/agents/models/stt/palabra/) and [TTS documentation](https://docs.livekit.io/agents/models/tts/palabra/) for more information.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ pip install livekit-plugins-palabra
11
+ ```
12
+
13
+ ## Pre-requisites
14
+
15
+ The Palabra plugin requires an API key to authenticate. You can create one at [platform.palabra.ai/api-keys](https://platform.palabra.ai/api-keys).
16
+
17
+ Set the API key in your `.env` file:
18
+
19
+ ```
20
+ PALABRA_API_KEY=<your_palabra_api_key>
21
+ ```
22
+
23
+
24
+
25
+ ## Usage
26
+
27
+
28
+
29
+ ### Speech-to-Text (STT)
30
+
31
+ Use Palabra STT in an `AgentSession` or as a standalone streaming transcription service. The spoken language is auto-detected by default:
32
+
33
+ ```python
34
+ from livekit.agents import AgentSession
35
+ from livekit.plugins import palabra
36
+
37
+ session = AgentSession(
38
+ stt=palabra.STT(),
39
+ # ... llm, tts, etc.
40
+ )
41
+ ```
42
+
43
+
44
+
45
+ ### Live translation
46
+
47
+ Palabra STT can translate speech on the fly. With `translate_languages` set, each emitted `SpeechData` maps as: `language`/`text` = the translation; `source_languages`/`source_texts` = the original speech. Final transcripts arrive already in the target language, so a translating agent works without an LLM in the loop:
48
+
49
+ ```python
50
+ stt = palabra.STT(translate_languages=["es"])
51
+ ```
52
+
53
+
54
+
55
+ ### Text-to-Speech (TTS)
56
+
57
+ Use Palabra TTS for real-time speech synthesis:
58
+
59
+ ```python
60
+ from livekit.plugins import palabra
61
+
62
+ session = AgentSession(
63
+ tts=palabra.TTS(
64
+ language="en",
65
+ voice_id="default_low", # or "default_high", or any Palabra voice id
66
+ speed=0.5, # 0.0-1.0; 0.5 is natural conversational pace
67
+ ),
68
+ # ... stt, llm, etc.
69
+ )
70
+ ```
71
+
72
+ The TTS streams over one persistent WebSocket session: text chunks coming from the LLM are tokenized into sentences and synthesized as they arrive, and an interruption cancels the in-flight synthesis server-side.
73
+
74
+ ## More information and reference
75
+
76
+ - [Palabra realtime STT API](https://platform.palabra.ai/docs/speech-to-text/realtime-stt)
77
+ - [Palabra realtime TTS API](https://platform.palabra.ai/docs/text-to-speech/realtime-tts)
78
+ - [Palabra platform](https://platform.palabra.ai) — API keys and usage
79
+ - [palabra-ai Python SDK](https://pypi.org/project/palabra-ai/) — the transport this plugin builds on
80
+
@@ -0,0 +1,68 @@
1
+ # Copyright 2023 LiveKit, Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ """Palabra plugin for LiveKit Agents: realtime STT and TTS on the ``palabra-ai`` SDK.
16
+
17
+ Importing this package registers the plugin via ``Plugin.register_plugin``.
18
+ Docs: https://docs.livekit.io/agents/models/stt/ and .../tts/.
19
+ """
20
+
21
+ from .models import (
22
+ DEFAULT_DEACCENT_STRENGTH,
23
+ DEFAULT_LANGUAGE,
24
+ DEFAULT_MODEL,
25
+ DEFAULT_SAMPLE_RATE,
26
+ DEFAULT_VOICE_ID,
27
+ TTSLanguages,
28
+ TTSModels,
29
+ )
30
+ from .stt import STT, SpeechStream
31
+ from .tts import TTS, SynthesizeStream
32
+ from .version import __version__
33
+
34
+ __all__ = [
35
+ "STT",
36
+ "SpeechStream",
37
+ "TTS",
38
+ "SynthesizeStream",
39
+ "TTSModels",
40
+ "TTSLanguages",
41
+ "DEFAULT_LANGUAGE",
42
+ "DEFAULT_VOICE_ID",
43
+ "DEFAULT_MODEL",
44
+ "DEFAULT_DEACCENT_STRENGTH",
45
+ "DEFAULT_SAMPLE_RATE",
46
+ "__version__",
47
+ ]
48
+
49
+ from livekit.agents import Plugin
50
+
51
+ from .log import logger
52
+
53
+
54
+ class PalabraPlugin(Plugin):
55
+ def __init__(self) -> None:
56
+ super().__init__(__name__, __version__, __package__, logger)
57
+
58
+
59
+ Plugin.register_plugin(PalabraPlugin())
60
+
61
+ # Hide non-exported names from the generated pdoc output.
62
+ _module = dir()
63
+ NOT_IN_ALL = [m for m in _module if m not in __all__]
64
+
65
+ __pdoc__ = {}
66
+
67
+ for n in NOT_IN_ALL:
68
+ __pdoc__[n] = False
@@ -0,0 +1,3 @@
1
+ import logging
2
+
3
+ logger = logging.getLogger("livekit.plugins.palabra")
@@ -0,0 +1,27 @@
1
+ # Copyright 2023 LiveKit, Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ from typing import Literal
16
+
17
+ TTSModels = Literal["auto"]
18
+ """Palabra synthesis model. ``"auto"`` lets the server choose the model."""
19
+
20
+ TTSLanguages = Literal["en", "en-us", "en-gb", "de", "es", "fr", "it", "nl", "pt", "ru"]
21
+ """Languages documented for the realtime-TTS WebSocket endpoint."""
22
+
23
+ DEFAULT_MODEL = "auto"
24
+ DEFAULT_LANGUAGE = "en"
25
+ DEFAULT_VOICE_ID = "default_low"
26
+ DEFAULT_DEACCENT_STRENGTH = 1.0
27
+ DEFAULT_SAMPLE_RATE = 24000