livekit-plugins-volcenginee 1.3.3__tar.gz → 1.3.4__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_volcenginee-1.3.4/.gitignore +6 -0
- {livekit_plugins_volcenginee-1.3.3 → livekit_plugins_volcenginee-1.3.4}/PKG-INFO +6 -1
- {livekit_plugins_volcenginee-1.3.3 → livekit_plugins_volcenginee-1.3.4}/livekit/plugins/volcengine/llm.py +31 -14
- {livekit_plugins_volcenginee-1.3.3 → livekit_plugins_volcenginee-1.3.4}/livekit/plugins/volcengine/tts.py +5 -1
- livekit_plugins_volcenginee-1.3.4/livekit/plugins/volcengine/version.py +1 -0
- {livekit_plugins_volcenginee-1.3.3 → livekit_plugins_volcenginee-1.3.4}/pyproject.toml +20 -0
- livekit_plugins_volcenginee-1.3.3/.gitignore +0 -183
- livekit_plugins_volcenginee-1.3.3/livekit/plugins/volcengine/version.py +0 -1
- {livekit_plugins_volcenginee-1.3.3 → livekit_plugins_volcenginee-1.3.4}/README.md +0 -0
- {livekit_plugins_volcenginee-1.3.3 → livekit_plugins_volcenginee-1.3.4}/livekit/plugins/volcengine/__init__.py +0 -0
- {livekit_plugins_volcenginee-1.3.3 → livekit_plugins_volcenginee-1.3.4}/livekit/plugins/volcengine/log.py +0 -0
- {livekit_plugins_volcenginee-1.3.3 → livekit_plugins_volcenginee-1.3.4}/livekit/plugins/volcengine/py.typed +0 -0
- {livekit_plugins_volcenginee-1.3.3 → livekit_plugins_volcenginee-1.3.4}/livekit/plugins/volcengine/realtime.py +0 -0
- {livekit_plugins_volcenginee-1.3.3 → livekit_plugins_volcenginee-1.3.4}/livekit/plugins/volcengine/stt.py +0 -0
- {livekit_plugins_volcenginee-1.3.3 → livekit_plugins_volcenginee-1.3.4}/livekit/plugins/volcengine/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: livekit-plugins-volcenginee
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.4
|
|
4
4
|
Summary: LiveKit Agent Plugins for Volcengine
|
|
5
5
|
Author-email: linsanzhu <2287225730@qq.com>
|
|
6
6
|
Keywords: audio,livekit,realtime,video,webrtc
|
|
@@ -18,6 +18,11 @@ Requires-Dist: numpy
|
|
|
18
18
|
Requires-Dist: openai>=1.80.0
|
|
19
19
|
Requires-Dist: osc-data~=0.3.1
|
|
20
20
|
Requires-Dist: pydantic
|
|
21
|
+
Provides-Extra: test
|
|
22
|
+
Requires-Dist: aiohttp>=3.9; extra == 'test'
|
|
23
|
+
Requires-Dist: pyaudio>=0.2.14; extra == 'test'
|
|
24
|
+
Requires-Dist: pytest-asyncio>=0.21; extra == 'test'
|
|
25
|
+
Requires-Dist: pytest>=7.0; extra == 'test'
|
|
21
26
|
Description-Content-Type: text/markdown
|
|
22
27
|
|
|
23
28
|
# livekit-plugins-volcengine
|
|
@@ -32,7 +32,18 @@ class _LLMOptions:
|
|
|
32
32
|
parallel_tool_calls: NotGivenOr[bool]
|
|
33
33
|
tool_choice: NotGivenOr[ToolChoice]
|
|
34
34
|
metadata: NotGivenOr[dict[str, str]]
|
|
35
|
-
|
|
35
|
+
reasoning_effort: NotGivenOr[Literal["minimal", "low", "medium", "high", "max"]]
|
|
36
|
+
|
|
37
|
+
def __post_init__(self) -> None:
|
|
38
|
+
if is_given(self.reasoning_effort):
|
|
39
|
+
if self.reasoning_effort not in (
|
|
40
|
+
"minimal", "low", "medium", "high", "max",
|
|
41
|
+
):
|
|
42
|
+
raise ValueError(
|
|
43
|
+
f"reasoning_effort must be one of "
|
|
44
|
+
f"'minimal', 'low', 'medium', 'high', 'max'; "
|
|
45
|
+
f"got {self.reasoning_effort!r}"
|
|
46
|
+
)
|
|
36
47
|
|
|
37
48
|
|
|
38
49
|
class LLM(llm.LLM):
|
|
@@ -48,7 +59,9 @@ class LLM(llm.LLM):
|
|
|
48
59
|
parallel_tool_calls: NotGivenOr[bool] = NOT_GIVEN,
|
|
49
60
|
tool_choice: NotGivenOr[ToolChoice] = NOT_GIVEN,
|
|
50
61
|
metadata: NotGivenOr[dict[str, str]] = NOT_GIVEN,
|
|
51
|
-
|
|
62
|
+
reasoning_effort: NotGivenOr[
|
|
63
|
+
Literal["minimal", "low", "medium", "high", "max"]
|
|
64
|
+
] = NOT_GIVEN,
|
|
52
65
|
timeout: httpx.Timeout | None = None,
|
|
53
66
|
) -> None:
|
|
54
67
|
"""
|
|
@@ -58,11 +71,14 @@ class LLM(llm.LLM):
|
|
|
58
71
|
model: The model to use for the LLM, end
|
|
59
72
|
api_key: The API key to use for the LLM.
|
|
60
73
|
base_url: The base URL to use for the LLM.
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
74
|
+
reasoning_effort: Constrains the effort the model spends on
|
|
75
|
+
reasoning before producing a final answer. One of
|
|
76
|
+
``"minimal"``, ``"low"``, ``"medium"``, ``"high"``, ``"max"``.
|
|
77
|
+
Mapped to Volcengine Ark's ``reasoning_effort`` field; also
|
|
78
|
+
accepted by the OpenAI Python SDK as a standard Chat
|
|
79
|
+
Completions kwarg (same name, same semantics) so it is
|
|
80
|
+
forwarded at the top level of the request body. Omit to use
|
|
81
|
+
the API default (``medium``).
|
|
66
82
|
"""
|
|
67
83
|
super().__init__()
|
|
68
84
|
self._opts = _LLMOptions(
|
|
@@ -72,7 +88,7 @@ class LLM(llm.LLM):
|
|
|
72
88
|
parallel_tool_calls=parallel_tool_calls,
|
|
73
89
|
tool_choice=tool_choice,
|
|
74
90
|
metadata=metadata,
|
|
75
|
-
|
|
91
|
+
reasoning_effort=reasoning_effort,
|
|
76
92
|
)
|
|
77
93
|
api_key = api_key if is_given(api_key) else os.getenv("VOLCENGINE_LLM_API_KEY")
|
|
78
94
|
if api_key is None:
|
|
@@ -118,12 +134,13 @@ class LLM(llm.LLM):
|
|
|
118
134
|
if is_given(self._opts.temperature):
|
|
119
135
|
extra["temperature"] = self._opts.temperature
|
|
120
136
|
|
|
121
|
-
if is_given(self._opts.
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
137
|
+
if is_given(self._opts.reasoning_effort):
|
|
138
|
+
# ``reasoning_effort`` is part of the OpenAI Chat Completions
|
|
139
|
+
# signature (added for the o1 series; the OpenAI Python SDK
|
|
140
|
+
# accepts it at the top level). Volcengine Ark also accepts the
|
|
141
|
+
# same field name on its OpenAI-compatible endpoint, so we can
|
|
142
|
+
# forward it as a normal kwarg without ``extra_body``.
|
|
143
|
+
extra["reasoning_effort"] = self._opts.reasoning_effort
|
|
127
144
|
|
|
128
145
|
parallel_tool_calls = (
|
|
129
146
|
parallel_tool_calls
|
|
@@ -10,7 +10,7 @@ from collections.abc import ByteString
|
|
|
10
10
|
from typing import Literal, Tuple
|
|
11
11
|
|
|
12
12
|
import aiohttp
|
|
13
|
-
from pydantic import BaseModel, Field
|
|
13
|
+
from pydantic import BaseModel, ConfigDict, Field
|
|
14
14
|
from osc_data.text_stream import TextStreamSentencizer
|
|
15
15
|
|
|
16
16
|
from livekit.agents import (
|
|
@@ -46,6 +46,10 @@ def _volume_to_loudness_rate(volume: float) -> int:
|
|
|
46
46
|
|
|
47
47
|
|
|
48
48
|
class _TTSOptions(BaseModel):
|
|
49
|
+
# Reject unknown fields so the legacy ``speech_rate`` / ``loudness_rate``
|
|
50
|
+
# kwargs that were removed from the public API surface immediately.
|
|
51
|
+
model_config = ConfigDict(extra="forbid")
|
|
52
|
+
|
|
49
53
|
api_key: str
|
|
50
54
|
resource_id: str | None = None
|
|
51
55
|
voice: str = "zh_female_xiaohe_uranus_bigtts"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.3.4"
|
|
@@ -27,6 +27,13 @@ classifiers = [
|
|
|
27
27
|
"Programming Language :: Python :: 3 :: Only",
|
|
28
28
|
]
|
|
29
29
|
|
|
30
|
+
[project.optional-dependencies]
|
|
31
|
+
test = [
|
|
32
|
+
"pytest>=7.0",
|
|
33
|
+
"pytest-asyncio>=0.21",
|
|
34
|
+
"aiohttp>=3.9",
|
|
35
|
+
"pyaudio>=0.2.14",
|
|
36
|
+
]
|
|
30
37
|
|
|
31
38
|
|
|
32
39
|
[build-system]
|
|
@@ -41,3 +48,16 @@ packages = ["livekit"]
|
|
|
41
48
|
|
|
42
49
|
[tool.hatch.build.targets.sdist]
|
|
43
50
|
include = ["/livekit"]
|
|
51
|
+
|
|
52
|
+
[tool.pytest.ini_options]
|
|
53
|
+
asyncio_mode = "auto"
|
|
54
|
+
testpaths = ["tests"]
|
|
55
|
+
log_cli = true
|
|
56
|
+
log_cli_level = "INFO"
|
|
57
|
+
log_cli_format = "%(asctime)s [%(levelname)s] %(name)s: %(message)s"
|
|
58
|
+
log_cli_date_format = "%H:%M:%S"
|
|
59
|
+
markers = [
|
|
60
|
+
"integration: marks tests that require real Volcengine API credentials (skipped automatically when keys are not set in the environment)",
|
|
61
|
+
"llm: marks LLM integration tests (require VOLCENGINE_LLM_API_KEY)",
|
|
62
|
+
"tts: marks TTS integration tests (require VOLCENGINE_TTS_API_KEY)",
|
|
63
|
+
]
|
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
# Byte-compiled / optimized / DLL files
|
|
2
|
-
__pycache__/
|
|
3
|
-
*.py[cod]
|
|
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
|
-
|
|
110
|
-
# pdm
|
|
111
|
-
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
112
|
-
#pdm.lock
|
|
113
|
-
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
114
|
-
# in version control.
|
|
115
|
-
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
|
|
116
|
-
.pdm.toml
|
|
117
|
-
.pdm-python
|
|
118
|
-
.pdm-build/
|
|
119
|
-
|
|
120
|
-
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
121
|
-
__pypackages__/
|
|
122
|
-
|
|
123
|
-
# Celery stuff
|
|
124
|
-
celerybeat-schedule
|
|
125
|
-
celerybeat.pid
|
|
126
|
-
|
|
127
|
-
# SageMath parsed files
|
|
128
|
-
*.sage.py
|
|
129
|
-
|
|
130
|
-
# Environments
|
|
131
|
-
.env
|
|
132
|
-
.venv
|
|
133
|
-
env/
|
|
134
|
-
venv/
|
|
135
|
-
ENV/
|
|
136
|
-
env.bak/
|
|
137
|
-
venv.bak/
|
|
138
|
-
|
|
139
|
-
# Spyder project settings
|
|
140
|
-
.spyderproject
|
|
141
|
-
.spyproject
|
|
142
|
-
|
|
143
|
-
# Rope project settings
|
|
144
|
-
.ropeproject
|
|
145
|
-
|
|
146
|
-
# mkdocs documentation
|
|
147
|
-
/site
|
|
148
|
-
|
|
149
|
-
# mypy
|
|
150
|
-
.mypy_cache/
|
|
151
|
-
.dmypy.json
|
|
152
|
-
dmypy.json
|
|
153
|
-
|
|
154
|
-
# Pyre type checker
|
|
155
|
-
.pyre/
|
|
156
|
-
|
|
157
|
-
# pytype static type analyzer
|
|
158
|
-
.pytype/
|
|
159
|
-
|
|
160
|
-
# Cython debug symbols
|
|
161
|
-
cython_debug/
|
|
162
|
-
|
|
163
|
-
# PyCharm
|
|
164
|
-
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
165
|
-
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
166
|
-
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
167
|
-
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
168
|
-
#.idea/
|
|
169
|
-
|
|
170
|
-
# Ruff stuff:
|
|
171
|
-
.ruff_cache/
|
|
172
|
-
|
|
173
|
-
# PyPI configuration file
|
|
174
|
-
.pypirc
|
|
175
|
-
|
|
176
|
-
# tests
|
|
177
|
-
test.py
|
|
178
|
-
|
|
179
|
-
.python-version
|
|
180
|
-
|
|
181
|
-
*.ipynb
|
|
182
|
-
config.yaml
|
|
183
|
-
uv.lock
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "1.3.3"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|