pipecat-respeecher 0.1.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,207 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
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
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
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
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ #uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ #poetry.lock
109
+ #poetry.toml
110
+
111
+ # pdm
112
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115
+ #pdm.lock
116
+ #pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # pixi
121
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122
+ #pixi.lock
123
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124
+ # in the .venv directory. It is recommended not to include this directory in version control.
125
+ .pixi
126
+
127
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128
+ __pypackages__/
129
+
130
+ # Celery stuff
131
+ celerybeat-schedule
132
+ celerybeat.pid
133
+
134
+ # SageMath parsed files
135
+ *.sage.py
136
+
137
+ # Environments
138
+ .env
139
+ .envrc
140
+ .venv
141
+ env/
142
+ venv/
143
+ ENV/
144
+ env.bak/
145
+ venv.bak/
146
+
147
+ # Spyder project settings
148
+ .spyderproject
149
+ .spyproject
150
+
151
+ # Rope project settings
152
+ .ropeproject
153
+
154
+ # mkdocs documentation
155
+ /site
156
+
157
+ # mypy
158
+ .mypy_cache/
159
+ .dmypy.json
160
+ dmypy.json
161
+
162
+ # Pyre type checker
163
+ .pyre/
164
+
165
+ # pytype static type analyzer
166
+ .pytype/
167
+
168
+ # Cython debug symbols
169
+ cython_debug/
170
+
171
+ # PyCharm
172
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
173
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
174
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
175
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
176
+ #.idea/
177
+
178
+ # Abstra
179
+ # Abstra is an AI-powered process automation framework.
180
+ # Ignore directories containing user credentials, local state, and settings.
181
+ # Learn more at https://abstra.io/docs
182
+ .abstra/
183
+
184
+ # Visual Studio Code
185
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
186
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
187
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
188
+ # you could uncomment the following to ignore the entire vscode folder
189
+ # .vscode/
190
+
191
+ # Ruff stuff:
192
+ .ruff_cache/
193
+
194
+ # PyPI configuration file
195
+ .pypirc
196
+
197
+ # Cursor
198
+ # Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
199
+ # exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
200
+ # refer to https://docs.cursor.com/context/ignore-files
201
+ .cursorignore
202
+ .cursorindexingignore
203
+
204
+ # Marimo
205
+ marimo/_static/
206
+ marimo/_lsp/
207
+ __marimo__/
@@ -0,0 +1 @@
1
+ 3.11
@@ -0,0 +1,25 @@
1
+ BSD 2-Clause License
2
+
3
+ Copyright (c) 2024–2025, Daily
4
+ Copyright (c) 2025, Respeecher
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ 1. Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ 2. Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,110 @@
1
+ Metadata-Version: 2.4
2
+ Name: pipecat-respeecher
3
+ Version: 0.1.0
4
+ Summary: Respeecher real-time TTS plugin for Pipecat
5
+ Author-email: Respeecher <nv@respeecher.com>
6
+ Maintainer-email: Respeecher <nv@respeecher.com>
7
+ License-Expression: BSD-2-Clause
8
+ Project-URL: homepage, https://www.respeecher.com/real-time-tts-api
9
+ Project-URL: documentation, https://space.respeecher.com/docs
10
+ Project-URL: source, https://github.com/respeecher/pipecat-respeecher
11
+ Keywords: tts,pipecat-ai,pipecat
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
+ Requires-Python: >=3.10
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Requires-Dist: pipecat-ai>=0.0.99
23
+ Requires-Dist: respeecher>=1.1.9
24
+ Dynamic: license-file
25
+
26
+ # Pipecat Respeecher Real-Time TTS Integration
27
+
28
+ This is an official Respeecher integration for [Pipecat](https://pipecat.ai).
29
+
30
+ [Learn more](https://www.respeecher.com/real-time-tts-api) about our real-time TTS API
31
+ ([Україномовна/Ukrainian TTS](https://www.respeecher.com/uk/real-time-tts-api)).
32
+
33
+ **Maintainer: [Respeecher](https://www.respeecher.com/)**
34
+
35
+ ## Installation
36
+
37
+ To be published.
38
+
39
+ ## Running the Example
40
+
41
+ [`example.py`](./example.py) is a complete Pipecat pipeline with Respeecher TTS.
42
+ (See [`example-ukrainian.py`](./example-ukrainian.py) for a Ukrainian language pipeline.)
43
+ You can use it as a starting point for your agent,
44
+ or you can head over to [Example Snippets](#example-snippets)
45
+ if you already have a pipeline and just want to switch TTS.
46
+
47
+ The complete pipeline example requires a
48
+ [Deepgram](https://docs.pipecat.ai/server/services/stt/deepgram) API key for
49
+ Speech-to-Text, either a [Google Gemini](https://docs.pipecat.ai/server/services/llm/gemini)
50
+ API key or a [Cerebras](https://docs.pipecat.ai/server/services/llm/cerebras) API key for LLM,
51
+ and a [Respeecher Space](https://space.respeecher.com/api-keys) API key.
52
+ The Speech-to-Text and LLM services are just an example and can generally be swapped for any
53
+ other [supported Pipecat service](https://docs.pipecat.ai/server/services/supported-services).
54
+
55
+ 1. Clone this repository.
56
+ 2. Copy `env.example` to `.env` and fill in your API keys.
57
+ 3. Assuming you have the [uv](https://docs.astral.sh/uv/getting-started/installation/)
58
+ Python package manager installed, run `uv run example.py`, head over to
59
+ http://localhost:7860, and click _Connect_.
60
+ (The first run of `uv run example.py` may be slow because uv installs packages
61
+ and Pipecat downloads local models.)
62
+ The agent should greet you (both in text and in speech),
63
+ and you can converse with it through the chat interface or with your microphone.
64
+ (Make sure you have granted microphone access to the web page and that the microphone button
65
+ is not in the muted state.)
66
+
67
+ ## Example Snippets
68
+
69
+ ### Minimal Example
70
+
71
+ ```python
72
+ from pipecat_respeecher import RespeecherTTSService
73
+
74
+ tts = RespeecherTTSService(
75
+ api_key=os.getenv("RESPEECHER_API_KEY"),
76
+ voice_id="samantha",
77
+ )
78
+ ```
79
+
80
+ ### Overriding Sampling Parameters
81
+
82
+ See the [Sampling Parameters Guide](https://space.respeecher.com/docs/api/tts/sampling-params-guide).
83
+
84
+ ```python
85
+ from pipecat_respeecher import RespeecherTTSService
86
+
87
+ tts = RespeecherTTSService(
88
+ api_key=os.getenv("RESPEECHER_API_KEY"),
89
+ voice_id="samantha",
90
+ params=RespeecherTTSService.InputParams(
91
+ sampling_params={
92
+ "min_p": 0.01,
93
+ },
94
+ ),
95
+ )
96
+ ```
97
+
98
+ ### Ukrainian Language Model
99
+
100
+ See [Models & Languages](https://space.respeecher.com/docs/models-and-languages).
101
+
102
+ ```python
103
+ from pipecat_respeecher import RespeecherTTSService
104
+
105
+ tts = RespeecherTTSService(
106
+ api_key=os.getenv("RESPEECHER_API_KEY"),
107
+ model="public/tts/ua-rt",
108
+ voice_id="olesia-conversation",
109
+ )
110
+ ```
@@ -0,0 +1,85 @@
1
+ # Pipecat Respeecher Real-Time TTS Integration
2
+
3
+ This is an official Respeecher integration for [Pipecat](https://pipecat.ai).
4
+
5
+ [Learn more](https://www.respeecher.com/real-time-tts-api) about our real-time TTS API
6
+ ([Україномовна/Ukrainian TTS](https://www.respeecher.com/uk/real-time-tts-api)).
7
+
8
+ **Maintainer: [Respeecher](https://www.respeecher.com/)**
9
+
10
+ ## Installation
11
+
12
+ To be published.
13
+
14
+ ## Running the Example
15
+
16
+ [`example.py`](./example.py) is a complete Pipecat pipeline with Respeecher TTS.
17
+ (See [`example-ukrainian.py`](./example-ukrainian.py) for a Ukrainian language pipeline.)
18
+ You can use it as a starting point for your agent,
19
+ or you can head over to [Example Snippets](#example-snippets)
20
+ if you already have a pipeline and just want to switch TTS.
21
+
22
+ The complete pipeline example requires a
23
+ [Deepgram](https://docs.pipecat.ai/server/services/stt/deepgram) API key for
24
+ Speech-to-Text, either a [Google Gemini](https://docs.pipecat.ai/server/services/llm/gemini)
25
+ API key or a [Cerebras](https://docs.pipecat.ai/server/services/llm/cerebras) API key for LLM,
26
+ and a [Respeecher Space](https://space.respeecher.com/api-keys) API key.
27
+ The Speech-to-Text and LLM services are just an example and can generally be swapped for any
28
+ other [supported Pipecat service](https://docs.pipecat.ai/server/services/supported-services).
29
+
30
+ 1. Clone this repository.
31
+ 2. Copy `env.example` to `.env` and fill in your API keys.
32
+ 3. Assuming you have the [uv](https://docs.astral.sh/uv/getting-started/installation/)
33
+ Python package manager installed, run `uv run example.py`, head over to
34
+ http://localhost:7860, and click _Connect_.
35
+ (The first run of `uv run example.py` may be slow because uv installs packages
36
+ and Pipecat downloads local models.)
37
+ The agent should greet you (both in text and in speech),
38
+ and you can converse with it through the chat interface or with your microphone.
39
+ (Make sure you have granted microphone access to the web page and that the microphone button
40
+ is not in the muted state.)
41
+
42
+ ## Example Snippets
43
+
44
+ ### Minimal Example
45
+
46
+ ```python
47
+ from pipecat_respeecher import RespeecherTTSService
48
+
49
+ tts = RespeecherTTSService(
50
+ api_key=os.getenv("RESPEECHER_API_KEY"),
51
+ voice_id="samantha",
52
+ )
53
+ ```
54
+
55
+ ### Overriding Sampling Parameters
56
+
57
+ See the [Sampling Parameters Guide](https://space.respeecher.com/docs/api/tts/sampling-params-guide).
58
+
59
+ ```python
60
+ from pipecat_respeecher import RespeecherTTSService
61
+
62
+ tts = RespeecherTTSService(
63
+ api_key=os.getenv("RESPEECHER_API_KEY"),
64
+ voice_id="samantha",
65
+ params=RespeecherTTSService.InputParams(
66
+ sampling_params={
67
+ "min_p": 0.01,
68
+ },
69
+ ),
70
+ )
71
+ ```
72
+
73
+ ### Ukrainian Language Model
74
+
75
+ See [Models & Languages](https://space.respeecher.com/docs/models-and-languages).
76
+
77
+ ```python
78
+ from pipecat_respeecher import RespeecherTTSService
79
+
80
+ tts = RespeecherTTSService(
81
+ api_key=os.getenv("RESPEECHER_API_KEY"),
82
+ model="public/tts/ua-rt",
83
+ voice_id="olesia-conversation",
84
+ )
85
+ ```
@@ -0,0 +1,6 @@
1
+ DEEPGRAM_API_KEY=your-api-key
2
+ RESPEECHER_API_KEY=your-api-key
3
+
4
+ # Provide either one
5
+ GOOGLE_API_KEY=your-api-key
6
+ # CEREBRAS_API_KEY=your-api-key
@@ -0,0 +1,198 @@
1
+ #
2
+ # Copyright (c) 2024–2025, Daily
3
+ # Copyright (c) 2025, Respeecher
4
+ #
5
+ # SPDX-License-Identifier: BSD 2-Clause License
6
+ #
7
+
8
+ """Respeecher Quickstart Example.
9
+
10
+ The example runs a simple voice AI bot that you can connect to using your
11
+ browser and speak with it. You can also deploy this bot to Pipecat Cloud.
12
+
13
+ Required AI services:
14
+ - Deepgram (Speech-to-Text)
15
+ - Google or Cerebras (LLM)
16
+ - Respeecher (Text-to-Speech)
17
+
18
+ Run the bot using::
19
+
20
+ uv run bot.py
21
+ """
22
+
23
+ import os
24
+
25
+ from dotenv import load_dotenv
26
+ from loguru import logger
27
+
28
+ print("🚀 Starting Pipecat bot...")
29
+ print("⏳ Loading models and imports (20 seconds, first run only)\n")
30
+
31
+ logger.info("Loading Local Smart Turn Analyzer V3...")
32
+ from pipecat.audio.turn.smart_turn.local_smart_turn_v3 import LocalSmartTurnAnalyzerV3
33
+
34
+ logger.info("✅ Local Smart Turn Analyzer V3 loaded")
35
+ logger.info("Loading Silero VAD model...")
36
+ from pipecat.audio.vad.silero import SileroVADAnalyzer
37
+
38
+ logger.info("✅ Silero VAD model loaded")
39
+
40
+ from pipecat.audio.vad.vad_analyzer import VADParams
41
+ from pipecat.frames.frames import LLMRunFrame
42
+
43
+ logger.info("Loading pipeline components...")
44
+ from pipecat.pipeline.pipeline import Pipeline
45
+ from pipecat.pipeline.runner import PipelineRunner
46
+ from pipecat.pipeline.task import PipelineParams, PipelineTask
47
+ from pipecat.processors.aggregators.llm_context import LLMContext
48
+ from pipecat.processors.aggregators.llm_response_universal import (
49
+ LLMContextAggregatorPair,
50
+ LLMUserAggregatorParams,
51
+ )
52
+ from pipecat.processors.frameworks.rtvi import RTVIConfig, RTVIObserver, RTVIProcessor
53
+ from pipecat.runner.types import RunnerArguments
54
+ from pipecat.runner.utils import create_transport
55
+ from pipecat.transcriptions.language import Language
56
+ from pipecat.services.deepgram.stt import DeepgramSTTService, LiveOptions
57
+ from pipecat.services.cerebras.llm import CerebrasLLMService
58
+ from pipecat.services.google.llm import GoogleLLMService
59
+ from pipecat.transports.base_transport import BaseTransport, TransportParams
60
+ from pipecat.transports.daily.transport import DailyParams
61
+ from pipecat.turns.user_stop.turn_analyzer_user_turn_stop_strategy import (
62
+ TurnAnalyzerUserTurnStopStrategy,
63
+ )
64
+ from pipecat.turns.user_turn_strategies import UserTurnStrategies
65
+ from pipecat_respeecher import RespeecherTTSService
66
+ from pipecat_whisker import WhiskerObserver
67
+
68
+ logger.info("✅ All components loaded successfully!")
69
+
70
+ load_dotenv(override=True)
71
+
72
+
73
+ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
74
+ logger.info("Starting bot")
75
+
76
+ stt = DeepgramSTTService(
77
+ api_key=os.getenv("DEEPGRAM_API_KEY"),
78
+ live_options=LiveOptions(language=Language.UK),
79
+ )
80
+
81
+ tts = RespeecherTTSService(
82
+ api_key=os.getenv("RESPEECHER_API_KEY"),
83
+ voice_id="olesia-conversation",
84
+ model="public/tts/ua-rt",
85
+ # [Optional] Sampling parameters overrides.
86
+ # Can be changed on the fly with TTSUpdateSettingsFrame,
87
+ # just like the model and the voice.
88
+ params=RespeecherTTSService.InputParams(
89
+ sampling_params={
90
+ "min_p": 0.01,
91
+ },
92
+ ),
93
+ )
94
+
95
+ cerebras_api_key = os.getenv("CEREBRAS_API_KEY")
96
+ google_api_key = os.getenv("GOOGLE_API_KEY")
97
+
98
+ if cerebras_api_key:
99
+ llm = CerebrasLLMService(api_key=cerebras_api_key, model="llama3.1-8b")
100
+ elif google_api_key:
101
+ llm = GoogleLLMService(api_key=google_api_key)
102
+ else:
103
+ raise ValueError("Neither Google nor Cerebras API key is provided")
104
+
105
+ messages = [
106
+ {
107
+ "role": "system",
108
+ "content": "Ти дружній ШІ асистент, що розмовляє українською. Відповідай привітно та підтримуй розмову. Не використовуй емодзі та спеціальні символи у своїх відповідях. Ти жіночого роду.",
109
+ },
110
+ ]
111
+
112
+ context = LLMContext(messages)
113
+ context_aggregator = LLMContextAggregatorPair(
114
+ context,
115
+ user_params=LLMUserAggregatorParams(
116
+ user_turn_strategies=UserTurnStrategies(
117
+ stop=[
118
+ TurnAnalyzerUserTurnStopStrategy(
119
+ turn_analyzer=LocalSmartTurnAnalyzerV3()
120
+ )
121
+ ]
122
+ ),
123
+ ),
124
+ )
125
+
126
+ # [Optional] Without RTVI, the chat interface in the WebRTC demo page won't work.
127
+ rtvi = RTVIProcessor(config=RTVIConfig(config=[]))
128
+
129
+ pipeline = Pipeline(
130
+ [
131
+ transport.input(), # Transport user input
132
+ rtvi,
133
+ stt,
134
+ context_aggregator.user(), # User responses
135
+ llm, # LLM
136
+ tts, # TTS
137
+ transport.output(), # Transport bot output
138
+ context_aggregator.assistant(), # Assistant spoken responses
139
+ ]
140
+ )
141
+
142
+ # [Optional] Whisker is a Pipecat debugger/visualizer.
143
+ # https://github.com/pipecat-ai/whisker
144
+ whisker = WhiskerObserver(pipeline)
145
+
146
+ task = PipelineTask(
147
+ pipeline,
148
+ params=PipelineParams(
149
+ enable_metrics=True,
150
+ enable_usage_metrics=True,
151
+ ),
152
+ idle_timeout_secs=runner_args.pipeline_idle_timeout_secs,
153
+ observers=[RTVIObserver(rtvi), whisker],
154
+ )
155
+
156
+ @transport.event_handler("on_client_connected")
157
+ async def on_client_connected(transport, client):
158
+ logger.info("Client connected")
159
+ messages.append(
160
+ {"role": "system", "content": "Привітайся та коротко розкажи про себе."}
161
+ )
162
+ await task.queue_frames([LLMRunFrame()])
163
+
164
+ @transport.event_handler("on_client_disconnected")
165
+ async def on_client_disconnected(transport, client):
166
+ logger.info("Client disconnected")
167
+ await task.cancel()
168
+
169
+ runner = PipelineRunner(handle_sigint=runner_args.handle_sigint)
170
+
171
+ await runner.run(task)
172
+
173
+
174
+ async def bot(runner_args: RunnerArguments):
175
+ """Main bot entry point for the bot starter."""
176
+
177
+ transport_params = {
178
+ "daily": lambda: DailyParams(
179
+ audio_in_enabled=True,
180
+ audio_out_enabled=True,
181
+ vad_analyzer=SileroVADAnalyzer(params=VADParams(stop_secs=0.2)),
182
+ ),
183
+ "webrtc": lambda: TransportParams(
184
+ audio_in_enabled=True,
185
+ audio_out_enabled=True,
186
+ vad_analyzer=SileroVADAnalyzer(params=VADParams(stop_secs=0.2)),
187
+ ),
188
+ }
189
+
190
+ transport = await create_transport(runner_args, transport_params)
191
+
192
+ await run_bot(transport, runner_args)
193
+
194
+
195
+ if __name__ == "__main__":
196
+ from pipecat.runner.run import main
197
+
198
+ main()