livekit-plugins-ultravox 1.2.9__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.
- livekit_plugins_ultravox-1.2.9/.gitignore +175 -0
- livekit_plugins_ultravox-1.2.9/PKG-INFO +160 -0
- livekit_plugins_ultravox-1.2.9/README.md +137 -0
- livekit_plugins_ultravox-1.2.9/livekit/plugins/ultravox/__init__.py +56 -0
- livekit_plugins_ultravox-1.2.9/livekit/plugins/ultravox/log.py +3 -0
- livekit_plugins_ultravox-1.2.9/livekit/plugins/ultravox/models.py +12 -0
- livekit_plugins_ultravox-1.2.9/livekit/plugins/ultravox/py.typed +0 -0
- livekit_plugins_ultravox-1.2.9/livekit/plugins/ultravox/realtime/__init__.py +24 -0
- livekit_plugins_ultravox-1.2.9/livekit/plugins/ultravox/realtime/events.py +195 -0
- livekit_plugins_ultravox-1.2.9/livekit/plugins/ultravox/realtime/realtime_model.py +1164 -0
- livekit_plugins_ultravox-1.2.9/livekit/plugins/ultravox/utils.py +79 -0
- livekit_plugins_ultravox-1.2.9/livekit/plugins/ultravox/version.py +15 -0
- livekit_plugins_ultravox-1.2.9/pyproject.toml +43 -0
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
**/.vscode
|
|
2
|
+
**/.DS_Store
|
|
3
|
+
|
|
4
|
+
# Byte-compiled / optimized / DLL files
|
|
5
|
+
__pycache__/
|
|
6
|
+
*.py[cod]
|
|
7
|
+
*$py.class
|
|
8
|
+
|
|
9
|
+
# C extensions
|
|
10
|
+
*.so
|
|
11
|
+
|
|
12
|
+
# Distribution / packaging
|
|
13
|
+
.Python
|
|
14
|
+
build/
|
|
15
|
+
develop-eggs/
|
|
16
|
+
dist/
|
|
17
|
+
downloads/
|
|
18
|
+
eggs/
|
|
19
|
+
.eggs/
|
|
20
|
+
lib/
|
|
21
|
+
lib64/
|
|
22
|
+
parts/
|
|
23
|
+
sdist/
|
|
24
|
+
var/
|
|
25
|
+
wheels/
|
|
26
|
+
share/python-wheels/
|
|
27
|
+
*.egg-info/
|
|
28
|
+
.installed.cfg
|
|
29
|
+
*.egg
|
|
30
|
+
MANIFEST
|
|
31
|
+
|
|
32
|
+
# PyInstaller
|
|
33
|
+
# Usually these files are written by a python script from a template
|
|
34
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
35
|
+
*.manifest
|
|
36
|
+
*.spec
|
|
37
|
+
|
|
38
|
+
# Installer logs
|
|
39
|
+
pip-log.txt
|
|
40
|
+
pip-delete-this-directory.txt
|
|
41
|
+
|
|
42
|
+
# Unit test / coverage reports
|
|
43
|
+
htmlcov/
|
|
44
|
+
.tox/
|
|
45
|
+
.nox/
|
|
46
|
+
.coverage
|
|
47
|
+
.coverage.*
|
|
48
|
+
.cache
|
|
49
|
+
nosetests.xml
|
|
50
|
+
coverage.xml
|
|
51
|
+
*.cover
|
|
52
|
+
*.py,cover
|
|
53
|
+
.hypothesis/
|
|
54
|
+
.pytest_cache/
|
|
55
|
+
cover/
|
|
56
|
+
|
|
57
|
+
# Translations
|
|
58
|
+
*.mo
|
|
59
|
+
*.pot
|
|
60
|
+
|
|
61
|
+
# Django stuff:
|
|
62
|
+
*.log
|
|
63
|
+
local_settings.py
|
|
64
|
+
db.sqlite3
|
|
65
|
+
db.sqlite3-journal
|
|
66
|
+
|
|
67
|
+
# Flask stuff:
|
|
68
|
+
instance/
|
|
69
|
+
.webassets-cache
|
|
70
|
+
|
|
71
|
+
# Scrapy stuff:
|
|
72
|
+
.scrapy
|
|
73
|
+
|
|
74
|
+
# Sphinx documentation
|
|
75
|
+
docs/_build/
|
|
76
|
+
|
|
77
|
+
# PyBuilder
|
|
78
|
+
.pybuilder/
|
|
79
|
+
target/
|
|
80
|
+
|
|
81
|
+
# Jupyter Notebook
|
|
82
|
+
.ipynb_checkpoints
|
|
83
|
+
|
|
84
|
+
# IPython
|
|
85
|
+
profile_default/
|
|
86
|
+
ipython_config.py
|
|
87
|
+
|
|
88
|
+
# pyenv
|
|
89
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
90
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
91
|
+
# .python-version
|
|
92
|
+
|
|
93
|
+
# pipenv
|
|
94
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
95
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
96
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
97
|
+
# install all needed dependencies.
|
|
98
|
+
#Pipfile.lock
|
|
99
|
+
|
|
100
|
+
# poetry
|
|
101
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
102
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
103
|
+
# commonly ignored for libraries.
|
|
104
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
105
|
+
#poetry.lock
|
|
106
|
+
|
|
107
|
+
# pdm
|
|
108
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
109
|
+
#pdm.lock
|
|
110
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
111
|
+
# in version control.
|
|
112
|
+
# https://pdm.fming.dev/#use-with-ide
|
|
113
|
+
.pdm.toml
|
|
114
|
+
|
|
115
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
116
|
+
__pypackages__/
|
|
117
|
+
|
|
118
|
+
# Celery stuff
|
|
119
|
+
celerybeat-schedule
|
|
120
|
+
celerybeat.pid
|
|
121
|
+
|
|
122
|
+
# SageMath parsed files
|
|
123
|
+
*.sage.py
|
|
124
|
+
|
|
125
|
+
# Environments
|
|
126
|
+
.env
|
|
127
|
+
.venv
|
|
128
|
+
env/
|
|
129
|
+
venv/
|
|
130
|
+
ENV/
|
|
131
|
+
env.bak/
|
|
132
|
+
venv.bak/
|
|
133
|
+
|
|
134
|
+
# Spyder project settings
|
|
135
|
+
.spyderproject
|
|
136
|
+
.spyproject
|
|
137
|
+
|
|
138
|
+
# Rope project settings
|
|
139
|
+
.ropeproject
|
|
140
|
+
|
|
141
|
+
# mkdocs documentation
|
|
142
|
+
/site
|
|
143
|
+
|
|
144
|
+
# mypy
|
|
145
|
+
.mypy_cache/
|
|
146
|
+
.dmypy.json
|
|
147
|
+
dmypy.json
|
|
148
|
+
|
|
149
|
+
# trunk
|
|
150
|
+
.trunk/
|
|
151
|
+
|
|
152
|
+
# Pyre type checker
|
|
153
|
+
.pyre/
|
|
154
|
+
|
|
155
|
+
# pytype static type analyzer
|
|
156
|
+
.pytype/
|
|
157
|
+
|
|
158
|
+
# Cython debug symbols
|
|
159
|
+
cython_debug/
|
|
160
|
+
|
|
161
|
+
# PyCharm
|
|
162
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
163
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
164
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
165
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
166
|
+
.idea/
|
|
167
|
+
|
|
168
|
+
node_modules
|
|
169
|
+
|
|
170
|
+
credentials.json
|
|
171
|
+
pyrightconfig.json
|
|
172
|
+
docs/
|
|
173
|
+
|
|
174
|
+
# Database files
|
|
175
|
+
*.db
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: livekit-plugins-ultravox
|
|
3
|
+
Version: 1.2.9
|
|
4
|
+
Summary: Agent Framework plugin for services from Ultravox
|
|
5
|
+
Project-URL: Documentation, https://docs.livekit.io
|
|
6
|
+
Project-URL: Website, https://livekit.io/
|
|
7
|
+
Project-URL: Source, https://github.com/livekit/agents
|
|
8
|
+
Author-email: LiveKit <hello@livekit.io>
|
|
9
|
+
License-Expression: Apache-2.0
|
|
10
|
+
Keywords: audio,livekit,realtime,video,webrtc
|
|
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.9
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Topic :: Multimedia :: Sound/Audio
|
|
18
|
+
Classifier: Topic :: Multimedia :: Video
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
20
|
+
Requires-Python: >=3.9.0
|
|
21
|
+
Requires-Dist: livekit-agents[codecs]>=1.2.9
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
|
|
24
|
+
# LiveKit Ultravox Plugin
|
|
25
|
+
|
|
26
|
+
LiveKit plugin for Ultravox's real-time speech-to-speech AI models, providing seamless integration with the LiveKit Agents framework.
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## Installation
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
pip install livekit-plugins-ultravox
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Prerequisites
|
|
37
|
+
|
|
38
|
+
You'll need an API key from Ultravox. Set it as an environment variable:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
export ULTRAVOX_API_KEY="your_api_key_here"
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Optional: enable debug logs for the plugin (disabled by default):
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
export LK_ULTRAVOX_DEBUG=true
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Basic Usage
|
|
51
|
+
|
|
52
|
+
### Simple Voice Assistant
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
import asyncio
|
|
56
|
+
from livekit.agents import Agent, AgentSession, JobContext, JobProcess, WorkerOptions, cli
|
|
57
|
+
from livekit.plugins import silero
|
|
58
|
+
from livekit.plugins.ultravox.realtime import RealtimeModel
|
|
59
|
+
|
|
60
|
+
async def entrypoint(ctx: JobContext):
|
|
61
|
+
await ctx.connect()
|
|
62
|
+
|
|
63
|
+
session: AgentSession[None] = AgentSession(
|
|
64
|
+
allow_interruptions=True,
|
|
65
|
+
vad=ctx.proc.userdata["vad"],
|
|
66
|
+
llm=RealtimeModel(
|
|
67
|
+
model_id="fixie-ai/ultravox",
|
|
68
|
+
voice="Mark",
|
|
69
|
+
),
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
await session.start(
|
|
73
|
+
agent=Agent(
|
|
74
|
+
instructions="You are a helpful voice assistant.",
|
|
75
|
+
),
|
|
76
|
+
room=ctx.room,
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
def prewarm(proc: JobProcess) -> None:
|
|
80
|
+
proc.userdata["vad"] = silero.VAD.load()
|
|
81
|
+
|
|
82
|
+
if __name__ == "__main__":
|
|
83
|
+
cli.run_app(WorkerOptions(entrypoint_fnc=entrypoint, prewarm_fnc=prewarm))
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Voice Assistant with Tools
|
|
87
|
+
|
|
88
|
+
```python
|
|
89
|
+
from livekit.agents import function_tool, Agent, AgentSession, JobContext, JobProcess, WorkerOptions, cli
|
|
90
|
+
from livekit.plugins import silero
|
|
91
|
+
from livekit.plugins.ultravox.realtime import RealtimeModel
|
|
92
|
+
|
|
93
|
+
@function_tool
|
|
94
|
+
async def get_weather(location: str) -> str:
|
|
95
|
+
"""Get weather information for a location."""
|
|
96
|
+
return f"The weather in {location} is sunny and 72°F"
|
|
97
|
+
|
|
98
|
+
@function_tool
|
|
99
|
+
async def book_appointment(date: str, time: str) -> str:
|
|
100
|
+
"""Book an appointment."""
|
|
101
|
+
return f"Appointment booked for {date} at {time}"
|
|
102
|
+
|
|
103
|
+
async def entrypoint(ctx: JobContext):
|
|
104
|
+
await ctx.connect()
|
|
105
|
+
|
|
106
|
+
session: AgentSession[None] = AgentSession(
|
|
107
|
+
allow_interruptions=True,
|
|
108
|
+
vad=ctx.proc.userdata["vad"],
|
|
109
|
+
llm=RealtimeModel(model_id="fixie-ai/ultravox"),
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
await session.start(
|
|
113
|
+
agent=Agent(
|
|
114
|
+
instructions="You are a helpful assistant with access to weather and scheduling tools.",
|
|
115
|
+
tools=[get_weather, book_appointment],
|
|
116
|
+
),
|
|
117
|
+
room=ctx.room,
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
def prewarm(proc: JobProcess) -> None:
|
|
121
|
+
proc.userdata["vad"] = silero.VAD.load()
|
|
122
|
+
|
|
123
|
+
if __name__ == "__main__":
|
|
124
|
+
cli.run_app(WorkerOptions(entrypoint_fnc=entrypoint, prewarm_fnc=prewarm))
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
## Configuration Options
|
|
129
|
+
|
|
130
|
+
### Ultravox API (/api/calls) Parameters
|
|
131
|
+
|
|
132
|
+
```python
|
|
133
|
+
RealtimeModel(
|
|
134
|
+
model_id="fixie-ai/ultravox", # Model to use (warn + pass-through if unknown)
|
|
135
|
+
voice="Mark", # Voice to use (warn + pass-through if unknown)
|
|
136
|
+
api_key=None, # API key (defaults to env var)
|
|
137
|
+
base_url=None, # API base URL (defaults to Ultravox API)
|
|
138
|
+
system_prompt="You are helpful.", # System prompt
|
|
139
|
+
input_sample_rate=16000, # Input audio sample rate
|
|
140
|
+
output_sample_rate=24000, # Output audio sample rate
|
|
141
|
+
client_buffer_size_ms=60, # Audio buffer size (min 200ms used on WS)
|
|
142
|
+
http_session=None, # Custom HTTP session
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
Notes:
|
|
146
|
+
- Unknown models/voices: the plugin logs a warning and sends them as-is; the server validates.
|
|
147
|
+
- Metrics: the plugin emits a single `metrics_collected` event per generation. To log them,
|
|
148
|
+
add a listener in your app and call the helper:
|
|
149
|
+
|
|
150
|
+
```python
|
|
151
|
+
from livekit.agents import metrics
|
|
152
|
+
|
|
153
|
+
@session.on("metrics_collected")
|
|
154
|
+
def on_metrics_collected(ev):
|
|
155
|
+
metrics.log_metrics(ev.metrics)
|
|
156
|
+
```
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# LiveKit Ultravox Plugin
|
|
2
|
+
|
|
3
|
+
LiveKit plugin for Ultravox's real-time speech-to-speech AI models, providing seamless integration with the LiveKit Agents framework.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pip install livekit-plugins-ultravox
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Prerequisites
|
|
14
|
+
|
|
15
|
+
You'll need an API key from Ultravox. Set it as an environment variable:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
export ULTRAVOX_API_KEY="your_api_key_here"
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Optional: enable debug logs for the plugin (disabled by default):
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
export LK_ULTRAVOX_DEBUG=true
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Basic Usage
|
|
28
|
+
|
|
29
|
+
### Simple Voice Assistant
|
|
30
|
+
|
|
31
|
+
```python
|
|
32
|
+
import asyncio
|
|
33
|
+
from livekit.agents import Agent, AgentSession, JobContext, JobProcess, WorkerOptions, cli
|
|
34
|
+
from livekit.plugins import silero
|
|
35
|
+
from livekit.plugins.ultravox.realtime import RealtimeModel
|
|
36
|
+
|
|
37
|
+
async def entrypoint(ctx: JobContext):
|
|
38
|
+
await ctx.connect()
|
|
39
|
+
|
|
40
|
+
session: AgentSession[None] = AgentSession(
|
|
41
|
+
allow_interruptions=True,
|
|
42
|
+
vad=ctx.proc.userdata["vad"],
|
|
43
|
+
llm=RealtimeModel(
|
|
44
|
+
model_id="fixie-ai/ultravox",
|
|
45
|
+
voice="Mark",
|
|
46
|
+
),
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
await session.start(
|
|
50
|
+
agent=Agent(
|
|
51
|
+
instructions="You are a helpful voice assistant.",
|
|
52
|
+
),
|
|
53
|
+
room=ctx.room,
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
def prewarm(proc: JobProcess) -> None:
|
|
57
|
+
proc.userdata["vad"] = silero.VAD.load()
|
|
58
|
+
|
|
59
|
+
if __name__ == "__main__":
|
|
60
|
+
cli.run_app(WorkerOptions(entrypoint_fnc=entrypoint, prewarm_fnc=prewarm))
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Voice Assistant with Tools
|
|
64
|
+
|
|
65
|
+
```python
|
|
66
|
+
from livekit.agents import function_tool, Agent, AgentSession, JobContext, JobProcess, WorkerOptions, cli
|
|
67
|
+
from livekit.plugins import silero
|
|
68
|
+
from livekit.plugins.ultravox.realtime import RealtimeModel
|
|
69
|
+
|
|
70
|
+
@function_tool
|
|
71
|
+
async def get_weather(location: str) -> str:
|
|
72
|
+
"""Get weather information for a location."""
|
|
73
|
+
return f"The weather in {location} is sunny and 72°F"
|
|
74
|
+
|
|
75
|
+
@function_tool
|
|
76
|
+
async def book_appointment(date: str, time: str) -> str:
|
|
77
|
+
"""Book an appointment."""
|
|
78
|
+
return f"Appointment booked for {date} at {time}"
|
|
79
|
+
|
|
80
|
+
async def entrypoint(ctx: JobContext):
|
|
81
|
+
await ctx.connect()
|
|
82
|
+
|
|
83
|
+
session: AgentSession[None] = AgentSession(
|
|
84
|
+
allow_interruptions=True,
|
|
85
|
+
vad=ctx.proc.userdata["vad"],
|
|
86
|
+
llm=RealtimeModel(model_id="fixie-ai/ultravox"),
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
await session.start(
|
|
90
|
+
agent=Agent(
|
|
91
|
+
instructions="You are a helpful assistant with access to weather and scheduling tools.",
|
|
92
|
+
tools=[get_weather, book_appointment],
|
|
93
|
+
),
|
|
94
|
+
room=ctx.room,
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
def prewarm(proc: JobProcess) -> None:
|
|
98
|
+
proc.userdata["vad"] = silero.VAD.load()
|
|
99
|
+
|
|
100
|
+
if __name__ == "__main__":
|
|
101
|
+
cli.run_app(WorkerOptions(entrypoint_fnc=entrypoint, prewarm_fnc=prewarm))
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
## Configuration Options
|
|
106
|
+
|
|
107
|
+
### Ultravox API (/api/calls) Parameters
|
|
108
|
+
|
|
109
|
+
```python
|
|
110
|
+
RealtimeModel(
|
|
111
|
+
model_id="fixie-ai/ultravox", # Model to use (warn + pass-through if unknown)
|
|
112
|
+
voice="Mark", # Voice to use (warn + pass-through if unknown)
|
|
113
|
+
api_key=None, # API key (defaults to env var)
|
|
114
|
+
base_url=None, # API base URL (defaults to Ultravox API)
|
|
115
|
+
system_prompt="You are helpful.", # System prompt
|
|
116
|
+
input_sample_rate=16000, # Input audio sample rate
|
|
117
|
+
output_sample_rate=24000, # Output audio sample rate
|
|
118
|
+
client_buffer_size_ms=60, # Audio buffer size (min 200ms used on WS)
|
|
119
|
+
http_session=None, # Custom HTTP session
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
Notes:
|
|
123
|
+
- Unknown models/voices: the plugin logs a warning and sends them as-is; the server validates.
|
|
124
|
+
- Metrics: the plugin emits a single `metrics_collected` event per generation. To log them,
|
|
125
|
+
add a listener in your app and call the helper:
|
|
126
|
+
|
|
127
|
+
```python
|
|
128
|
+
from livekit.agents import metrics
|
|
129
|
+
|
|
130
|
+
@session.on("metrics_collected")
|
|
131
|
+
def on_metrics_collected(ev):
|
|
132
|
+
metrics.log_metrics(ev.metrics)
|
|
133
|
+
```
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# This file makes the 'ultravox' directory a Python package.
|
|
2
|
+
# Copyright 2023 LiveKit, Inc.
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
|
|
16
|
+
"""Ultravox plugin for LiveKit Agents
|
|
17
|
+
|
|
18
|
+
Support for Ultravox Realtime API
|
|
19
|
+
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
from . import realtime, utils
|
|
23
|
+
from .models import UltravoxModel, UltravoxVoice
|
|
24
|
+
from .realtime.realtime_model import RealtimeModel, RealtimeSession
|
|
25
|
+
from .version import __version__
|
|
26
|
+
|
|
27
|
+
__all__ = [
|
|
28
|
+
"UltravoxVoice",
|
|
29
|
+
"UltravoxModel",
|
|
30
|
+
"realtime",
|
|
31
|
+
"RealtimeModel",
|
|
32
|
+
"RealtimeSession",
|
|
33
|
+
"utils",
|
|
34
|
+
"__version__",
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
from livekit.agents import Plugin
|
|
38
|
+
|
|
39
|
+
from .log import logger
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class UltravoxPlugin(Plugin):
|
|
43
|
+
def __init__(self) -> None:
|
|
44
|
+
super().__init__(__name__, __version__, __package__, logger)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
Plugin.register_plugin(UltravoxPlugin())
|
|
48
|
+
|
|
49
|
+
# Cleanup docs of unexported modules
|
|
50
|
+
_module = dir()
|
|
51
|
+
NOT_IN_ALL = [m for m in _module if m not in __all__]
|
|
52
|
+
|
|
53
|
+
__pdoc__ = {}
|
|
54
|
+
|
|
55
|
+
for n in NOT_IN_ALL:
|
|
56
|
+
__pdoc__[n] = False
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from typing import Literal
|
|
2
|
+
|
|
3
|
+
UltravoxModel = Literal[
|
|
4
|
+
"fixie-ai/ultravox",
|
|
5
|
+
"fixie-ai/ultravox-gemma3-27b-preview",
|
|
6
|
+
"fixie-ai/ultravox-llama3.3-70b",
|
|
7
|
+
"fixie-ai/ultravox-qwen3-32b-preview",
|
|
8
|
+
]
|
|
9
|
+
UltravoxVoice = Literal[
|
|
10
|
+
"Mark",
|
|
11
|
+
"Jessica",
|
|
12
|
+
]
|
|
File without changes
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
from .events import (
|
|
2
|
+
ClientToolInvocationEvent,
|
|
3
|
+
ClientToolResultEvent,
|
|
4
|
+
DebugEvent,
|
|
5
|
+
PingEvent,
|
|
6
|
+
PlaybackClearBufferEvent,
|
|
7
|
+
PongEvent,
|
|
8
|
+
SetOutputMediumEvent,
|
|
9
|
+
UserTextMessageEvent,
|
|
10
|
+
)
|
|
11
|
+
from .realtime_model import RealtimeModel, RealtimeSession
|
|
12
|
+
|
|
13
|
+
__all__ = [
|
|
14
|
+
"RealtimeModel",
|
|
15
|
+
"RealtimeSession",
|
|
16
|
+
"ClientToolInvocationEvent",
|
|
17
|
+
"ClientToolResultEvent",
|
|
18
|
+
"DebugEvent",
|
|
19
|
+
"UserTextMessageEvent",
|
|
20
|
+
"PingEvent",
|
|
21
|
+
"PlaybackClearBufferEvent",
|
|
22
|
+
"PongEvent",
|
|
23
|
+
"SetOutputMediumEvent",
|
|
24
|
+
]
|