livekit-plugins-volcenginee 1.3.0__tar.gz → 1.3.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.
- {livekit_plugins_volcenginee-1.3.0 → livekit_plugins_volcenginee-1.3.1}/PKG-INFO +16 -14
- {livekit_plugins_volcenginee-1.3.0 → livekit_plugins_volcenginee-1.3.1}/README.md +15 -13
- {livekit_plugins_volcenginee-1.3.0 → livekit_plugins_volcenginee-1.3.1}/livekit/plugins/volcengine/stt.py +8 -16
- {livekit_plugins_volcenginee-1.3.0 → livekit_plugins_volcenginee-1.3.1}/livekit/plugins/volcengine/tts.py +5 -15
- livekit_plugins_volcenginee-1.3.1/livekit/plugins/volcengine/version.py +1 -0
- livekit_plugins_volcenginee-1.3.0/livekit/plugins/volcengine/version.py +0 -1
- {livekit_plugins_volcenginee-1.3.0 → livekit_plugins_volcenginee-1.3.1}/.gitignore +0 -0
- {livekit_plugins_volcenginee-1.3.0 → livekit_plugins_volcenginee-1.3.1}/livekit/plugins/volcengine/__init__.py +0 -0
- {livekit_plugins_volcenginee-1.3.0 → livekit_plugins_volcenginee-1.3.1}/livekit/plugins/volcengine/llm.py +0 -0
- {livekit_plugins_volcenginee-1.3.0 → livekit_plugins_volcenginee-1.3.1}/livekit/plugins/volcengine/log.py +0 -0
- {livekit_plugins_volcenginee-1.3.0 → livekit_plugins_volcenginee-1.3.1}/livekit/plugins/volcengine/py.typed +0 -0
- {livekit_plugins_volcenginee-1.3.0 → livekit_plugins_volcenginee-1.3.1}/livekit/plugins/volcengine/realtime.py +0 -0
- {livekit_plugins_volcenginee-1.3.0 → livekit_plugins_volcenginee-1.3.1}/livekit/plugins/volcengine/utils.py +0 -0
- {livekit_plugins_volcenginee-1.3.0 → livekit_plugins_volcenginee-1.3.1}/pyproject.toml +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.1
|
|
4
4
|
Summary: LiveKit Agent Plugins for Volcengine
|
|
5
5
|
Author-email: linsanzhu <2287225730@qq.com>
|
|
6
6
|
Keywords: audio,livekit,realtime,video,webrtc
|
|
@@ -38,6 +38,8 @@ Description-Content-Type: text/markdown
|
|
|
38
38
|
- `volcengine.TTS` 默认音色为 `zh_female_xiaohe_uranus_bigtts`
|
|
39
39
|
- `volcengine.STT` 现已直接使用豆包大模型流式语音识别接口
|
|
40
40
|
- `volcengine.STT` 已补齐新版握手头 `X-Api-Connect-Id`
|
|
41
|
+
- `volcengine.STT` 切换到新版控制台鉴权,仅使用 `X-Api-Key` 头
|
|
42
|
+
- `volcengine.TTS` 同步切换到新版控制台鉴权,仅使用 `X-Api-Key` 头
|
|
41
43
|
|
|
42
44
|
## ✨ 特性
|
|
43
45
|
|
|
@@ -95,8 +97,8 @@ pip install -e .
|
|
|
95
97
|
|
|
96
98
|
| 环境变量 | 描述 | 获取方式 |
|
|
97
99
|
|----------|------|----------|
|
|
98
|
-
| `
|
|
99
|
-
| `
|
|
100
|
+
| `VOLCENGINE_TTS_API_KEY` | TTS 服务的 API Key(新版控制台) | [语音合成控制台](https://console.volcengine.com/speech/service/16) |
|
|
101
|
+
| `VOLCENGINE_STT_API_KEY` | STT 服务的 API Key(新版控制台) | [语音识别控制台](https://console.volcengine.com/speech/service/16) |
|
|
100
102
|
| `VOLCENGINE_LLM_API_KEY` | LLM 服务的 API 密钥 | [大模型控制台](https://console.volcengine.com/ark/) |
|
|
101
103
|
| `VOLCENGINE_REALTIME_ACCESS_TOKEN` | 实时服务的访问令牌 | [实时语音控制台](https://console.volcengine.com/speech/service/10011) |
|
|
102
104
|
| `VOLCENGINE_TTS_RESOURCE_ID` | TTS 资源 ID,默认 `seed-tts-2.0` | [豆包语音合成接口文档](https://www.volcengine.com/docs/6561/1257584) |
|
|
@@ -105,8 +107,8 @@ pip install -e .
|
|
|
105
107
|
|
|
106
108
|
```bash
|
|
107
109
|
# .env
|
|
108
|
-
|
|
109
|
-
|
|
110
|
+
VOLCENGINE_TTS_API_KEY=your_tts_api_key_here
|
|
111
|
+
VOLCENGINE_STT_API_KEY=your_stt_api_key_here
|
|
110
112
|
VOLCENGINE_LLM_API_KEY=your_llm_api_key_here
|
|
111
113
|
VOLCENGINE_REALTIME_ACCESS_TOKEN=your_realtime_token_here
|
|
112
114
|
```
|
|
@@ -152,11 +154,11 @@ async def entry_point(ctx: JobContext):
|
|
|
152
154
|
agent = Agent(instructions="You are a helpful assistant.")
|
|
153
155
|
|
|
154
156
|
# 使用豆包大模型流式语音识别
|
|
155
|
-
stt = volcengine.STT(
|
|
157
|
+
stt = volcengine.STT(api_key="your_api_key")
|
|
156
158
|
|
|
157
159
|
session = AgentSession(
|
|
158
160
|
stt=stt,
|
|
159
|
-
tts=volcengine.TTS(
|
|
161
|
+
tts=volcengine.TTS(api_key="your_tts_api_key"),
|
|
160
162
|
llm=volcengine.LLM(model="doubao-1-5-pro-32k-250115")
|
|
161
163
|
)
|
|
162
164
|
|
|
@@ -366,12 +368,12 @@ async def entry_point(ctx: JobContext):
|
|
|
366
368
|
session = AgentSession(
|
|
367
369
|
# 语音识别
|
|
368
370
|
stt=volcengine.STT(
|
|
369
|
-
|
|
371
|
+
api_key="your_stt_api_key",
|
|
370
372
|
resource_id="volc.seedasr.sauc.duration"
|
|
371
373
|
),
|
|
372
374
|
# 语音合成
|
|
373
375
|
tts=volcengine.TTS(
|
|
374
|
-
|
|
376
|
+
api_key="your_tts_api_key",
|
|
375
377
|
resource_id="seed-tts-2.0",
|
|
376
378
|
voice="zh_female_xiaohe_uranus_bigtts"
|
|
377
379
|
),
|
|
@@ -395,9 +397,8 @@ if __name__ == "__main__":
|
|
|
395
397
|
|
|
396
398
|
```python
|
|
397
399
|
volcengine.TTS(
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
resource_id: str | None = None, # 默认 seed-tts-2.0
|
|
400
|
+
api_key: str, # API Key(新版控制台)
|
|
401
|
+
resource_id: str | None = None, # 默认 seed-tts-2.0
|
|
401
402
|
voice: str = "zh_female_xiaohe_uranus_bigtts",
|
|
402
403
|
speed: float = 1.0,
|
|
403
404
|
volume: float = 1.0,
|
|
@@ -421,8 +422,7 @@ volcengine.TTS(
|
|
|
421
422
|
|
|
422
423
|
```python
|
|
423
424
|
volcengine.STT(
|
|
424
|
-
|
|
425
|
-
access_token: str | None = None,
|
|
425
|
+
api_key: str | None = None, # API Key(新版控制台),可用环境变量 VOLCENGINE_STT_API_KEY
|
|
426
426
|
resource_id: str | None = None, # 例如 volc.bigasr.sauc.duration / volc.seedasr.sauc.duration
|
|
427
427
|
model_name: str = "bigmodel",
|
|
428
428
|
enable_itn: bool = False,
|
|
@@ -588,6 +588,8 @@ A: 根据您的应用需求选择合适的版本:
|
|
|
588
588
|
- 修复无音频返回时静默失败的问题
|
|
589
589
|
- 删除旧版普通 STT,实现统一为豆包大模型流式语音识别
|
|
590
590
|
- `volcengine.STT` 补齐 `X-Api-Connect-Id` 握手头
|
|
591
|
+
- `volcengine.STT` 切换到新版控制台鉴权,移除 `app_id` / `access_token`,改用单一 `api_key` 并发送 `X-Api-Key` 头
|
|
592
|
+
- `volcengine.TTS` 同步切换到新版控制台鉴权,移除 `app_id` / `access_token`,改用单一 `api_key` 并发送 `X-Api-Key` 头
|
|
591
593
|
|
|
592
594
|
## 🤝 贡献
|
|
593
595
|
|
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
- `volcengine.TTS` 默认音色为 `zh_female_xiaohe_uranus_bigtts`
|
|
17
17
|
- `volcengine.STT` 现已直接使用豆包大模型流式语音识别接口
|
|
18
18
|
- `volcengine.STT` 已补齐新版握手头 `X-Api-Connect-Id`
|
|
19
|
+
- `volcengine.STT` 切换到新版控制台鉴权,仅使用 `X-Api-Key` 头
|
|
20
|
+
- `volcengine.TTS` 同步切换到新版控制台鉴权,仅使用 `X-Api-Key` 头
|
|
19
21
|
|
|
20
22
|
## ✨ 特性
|
|
21
23
|
|
|
@@ -73,8 +75,8 @@ pip install -e .
|
|
|
73
75
|
|
|
74
76
|
| 环境变量 | 描述 | 获取方式 |
|
|
75
77
|
|----------|------|----------|
|
|
76
|
-
| `
|
|
77
|
-
| `
|
|
78
|
+
| `VOLCENGINE_TTS_API_KEY` | TTS 服务的 API Key(新版控制台) | [语音合成控制台](https://console.volcengine.com/speech/service/16) |
|
|
79
|
+
| `VOLCENGINE_STT_API_KEY` | STT 服务的 API Key(新版控制台) | [语音识别控制台](https://console.volcengine.com/speech/service/16) |
|
|
78
80
|
| `VOLCENGINE_LLM_API_KEY` | LLM 服务的 API 密钥 | [大模型控制台](https://console.volcengine.com/ark/) |
|
|
79
81
|
| `VOLCENGINE_REALTIME_ACCESS_TOKEN` | 实时服务的访问令牌 | [实时语音控制台](https://console.volcengine.com/speech/service/10011) |
|
|
80
82
|
| `VOLCENGINE_TTS_RESOURCE_ID` | TTS 资源 ID,默认 `seed-tts-2.0` | [豆包语音合成接口文档](https://www.volcengine.com/docs/6561/1257584) |
|
|
@@ -83,8 +85,8 @@ pip install -e .
|
|
|
83
85
|
|
|
84
86
|
```bash
|
|
85
87
|
# .env
|
|
86
|
-
|
|
87
|
-
|
|
88
|
+
VOLCENGINE_TTS_API_KEY=your_tts_api_key_here
|
|
89
|
+
VOLCENGINE_STT_API_KEY=your_stt_api_key_here
|
|
88
90
|
VOLCENGINE_LLM_API_KEY=your_llm_api_key_here
|
|
89
91
|
VOLCENGINE_REALTIME_ACCESS_TOKEN=your_realtime_token_here
|
|
90
92
|
```
|
|
@@ -130,11 +132,11 @@ async def entry_point(ctx: JobContext):
|
|
|
130
132
|
agent = Agent(instructions="You are a helpful assistant.")
|
|
131
133
|
|
|
132
134
|
# 使用豆包大模型流式语音识别
|
|
133
|
-
stt = volcengine.STT(
|
|
135
|
+
stt = volcengine.STT(api_key="your_api_key")
|
|
134
136
|
|
|
135
137
|
session = AgentSession(
|
|
136
138
|
stt=stt,
|
|
137
|
-
tts=volcengine.TTS(
|
|
139
|
+
tts=volcengine.TTS(api_key="your_tts_api_key"),
|
|
138
140
|
llm=volcengine.LLM(model="doubao-1-5-pro-32k-250115")
|
|
139
141
|
)
|
|
140
142
|
|
|
@@ -344,12 +346,12 @@ async def entry_point(ctx: JobContext):
|
|
|
344
346
|
session = AgentSession(
|
|
345
347
|
# 语音识别
|
|
346
348
|
stt=volcengine.STT(
|
|
347
|
-
|
|
349
|
+
api_key="your_stt_api_key",
|
|
348
350
|
resource_id="volc.seedasr.sauc.duration"
|
|
349
351
|
),
|
|
350
352
|
# 语音合成
|
|
351
353
|
tts=volcengine.TTS(
|
|
352
|
-
|
|
354
|
+
api_key="your_tts_api_key",
|
|
353
355
|
resource_id="seed-tts-2.0",
|
|
354
356
|
voice="zh_female_xiaohe_uranus_bigtts"
|
|
355
357
|
),
|
|
@@ -373,9 +375,8 @@ if __name__ == "__main__":
|
|
|
373
375
|
|
|
374
376
|
```python
|
|
375
377
|
volcengine.TTS(
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
resource_id: str | None = None, # 默认 seed-tts-2.0
|
|
378
|
+
api_key: str, # API Key(新版控制台)
|
|
379
|
+
resource_id: str | None = None, # 默认 seed-tts-2.0
|
|
379
380
|
voice: str = "zh_female_xiaohe_uranus_bigtts",
|
|
380
381
|
speed: float = 1.0,
|
|
381
382
|
volume: float = 1.0,
|
|
@@ -399,8 +400,7 @@ volcengine.TTS(
|
|
|
399
400
|
|
|
400
401
|
```python
|
|
401
402
|
volcengine.STT(
|
|
402
|
-
|
|
403
|
-
access_token: str | None = None,
|
|
403
|
+
api_key: str | None = None, # API Key(新版控制台),可用环境变量 VOLCENGINE_STT_API_KEY
|
|
404
404
|
resource_id: str | None = None, # 例如 volc.bigasr.sauc.duration / volc.seedasr.sauc.duration
|
|
405
405
|
model_name: str = "bigmodel",
|
|
406
406
|
enable_itn: bool = False,
|
|
@@ -566,6 +566,8 @@ A: 根据您的应用需求选择合适的版本:
|
|
|
566
566
|
- 修复无音频返回时静默失败的问题
|
|
567
567
|
- 删除旧版普通 STT,实现统一为豆包大模型流式语音识别
|
|
568
568
|
- `volcengine.STT` 补齐 `X-Api-Connect-Id` 握手头
|
|
569
|
+
- `volcengine.STT` 切换到新版控制台鉴权,移除 `app_id` / `access_token`,改用单一 `api_key` 并发送 `X-Api-Key` 头
|
|
570
|
+
- `volcengine.TTS` 同步切换到新版控制台鉴权,移除 `app_id` / `access_token`,改用单一 `api_key` 并发送 `X-Api-Key` 头
|
|
569
571
|
|
|
570
572
|
## 🤝 贡献
|
|
571
573
|
|
|
@@ -76,8 +76,7 @@ def generate_before_payload(sequence: int):
|
|
|
76
76
|
|
|
77
77
|
@dataclass
|
|
78
78
|
class STTOptions:
|
|
79
|
-
|
|
80
|
-
access_token: str | None = None
|
|
79
|
+
api_key: str | None = None
|
|
81
80
|
source_type: Literal["duration", "concurrent"] = "duration"
|
|
82
81
|
resource_id: str | None = None
|
|
83
82
|
|
|
@@ -167,16 +166,11 @@ class STTOptions:
|
|
|
167
166
|
header["X-Api-Resource-Id"] = "volc.bigasr.sauc.duration"
|
|
168
167
|
else:
|
|
169
168
|
header["X-Api-Resource-Id"] = "volc.bigasr.sauc.concurrent"
|
|
170
|
-
if self.
|
|
171
|
-
self.
|
|
172
|
-
if self.
|
|
173
|
-
raise ValueError("
|
|
174
|
-
|
|
175
|
-
self.access_token = os.environ.get("VOLCENGINE_STT_ACCESS_TOKEN", None)
|
|
176
|
-
if self.access_token is None:
|
|
177
|
-
raise ValueError("VOLCENGINE_STT_ACCESS_TOKEN is not set")
|
|
178
|
-
header["X-Api-Access-Key"] = self.access_token
|
|
179
|
-
header["X-Api-App-Key"] = self.app_id
|
|
169
|
+
if self.api_key is None:
|
|
170
|
+
self.api_key = os.environ.get("VOLCENGINE_STT_API_KEY", None)
|
|
171
|
+
if self.api_key is None:
|
|
172
|
+
raise ValueError("VOLCENGINE_STT_API_KEY is not set")
|
|
173
|
+
header["X-Api-Key"] = self.api_key
|
|
180
174
|
header["X-Api-Connect-Id"] = reqid
|
|
181
175
|
header["X-Api-Request-Id"] = reqid
|
|
182
176
|
return header
|
|
@@ -186,9 +180,8 @@ class STT(stt.STT):
|
|
|
186
180
|
def __init__(
|
|
187
181
|
self,
|
|
188
182
|
*,
|
|
189
|
-
|
|
183
|
+
api_key: str | None = None,
|
|
190
184
|
base_url: str = "wss://openspeech.bytedance.com/api/v3/sauc/bigmodel",
|
|
191
|
-
access_token: str | None = None,
|
|
192
185
|
resource_id: str | None = None,
|
|
193
186
|
model_name: str = "bigmodel",
|
|
194
187
|
enable_itn: bool = False,
|
|
@@ -208,8 +201,7 @@ class STT(stt.STT):
|
|
|
208
201
|
|
|
209
202
|
self._opts = STTOptions(
|
|
210
203
|
base_url=base_url,
|
|
211
|
-
|
|
212
|
-
app_id=app_id,
|
|
204
|
+
api_key=api_key,
|
|
213
205
|
resource_id=resource_id,
|
|
214
206
|
model_name=model_name,
|
|
215
207
|
enable_itn=enable_itn,
|
|
@@ -25,8 +25,7 @@ from .log import logger
|
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
class _TTSOptions(BaseModel):
|
|
28
|
-
|
|
29
|
-
access_token: str | None = None
|
|
28
|
+
api_key: str
|
|
30
29
|
resource_id: str | None = None
|
|
31
30
|
voice: str = "zh_female_xiaohe_uranus_bigtts"
|
|
32
31
|
base_url: str = "https://openspeech.bytedance.com"
|
|
@@ -60,18 +59,12 @@ class _TTSOptions(BaseModel):
|
|
|
60
59
|
}
|
|
61
60
|
|
|
62
61
|
def get_http_header(self, reqid: str | None = None) -> dict[str, str]:
|
|
63
|
-
if self.access_token is None:
|
|
64
|
-
self.access_token = os.getenv("VOLCENGINE_TTS_ACCESS_TOKEN")
|
|
65
|
-
if self.access_token is None:
|
|
66
|
-
raise ValueError("VOLCENGINE_TTS_ACCESS_TOKEN is not set")
|
|
67
62
|
resource_id = self.resource_id or os.getenv(
|
|
68
63
|
"VOLCENGINE_TTS_RESOURCE_ID", "seed-tts-2.0"
|
|
69
64
|
)
|
|
70
65
|
headers = {
|
|
71
66
|
"Content-Type": "application/json",
|
|
72
|
-
"X-Api-
|
|
73
|
-
"X-Api-App-Key": self.app_id,
|
|
74
|
-
"X-Api-Access-Key": self.access_token,
|
|
67
|
+
"X-Api-Key": self.api_key,
|
|
75
68
|
"X-Api-Resource-Id": resource_id,
|
|
76
69
|
}
|
|
77
70
|
if reqid is not None:
|
|
@@ -82,8 +75,7 @@ class _TTSOptions(BaseModel):
|
|
|
82
75
|
class TTS(tts.TTS):
|
|
83
76
|
def __init__(
|
|
84
77
|
self,
|
|
85
|
-
|
|
86
|
-
access_token: str | None = None,
|
|
78
|
+
api_key: str,
|
|
87
79
|
resource_id: str | None = None,
|
|
88
80
|
voice: str = "zh_female_xiaohe_uranus_bigtts",
|
|
89
81
|
speed: float = 1.0,
|
|
@@ -95,8 +87,7 @@ class TTS(tts.TTS):
|
|
|
95
87
|
"""VolcEngine TTS
|
|
96
88
|
|
|
97
89
|
Args:
|
|
98
|
-
|
|
99
|
-
access_token (str | None, optional): the access token of the tts, if not provided, the value of the environment variable VOLCENGINE_TTS_ACCESS_TOKEN will be used. Defaults to None.
|
|
90
|
+
api_key (str): the API key of the tts, you can get it from the new console.
|
|
100
91
|
resource_id (str | None, optional): VolcEngine TTS resource id. Use `seed-tts-2.0` for Doubao TTS 2.0 voices, `seed-tts-1.0` / `seed-tts-1.0-concurr` for Doubao TTS 1.0 voices, `seed-icl-2.0` for voice cloning 2.0, and `seed-icl-1.0` / `seed-icl-1.0-concurr` for voice cloning 1.0. Defaults to None.
|
|
101
92
|
voice (str, optional): the voice id used by the tts request. Defaults to `zh_female_xiaohe_uranus_bigtts`.
|
|
102
93
|
sample_rate (Literal[24000, 16000, 8000], optional): the sample rate of the tts. Defaults to 24000.
|
|
@@ -109,8 +100,7 @@ class TTS(tts.TTS):
|
|
|
109
100
|
num_channels=1,
|
|
110
101
|
)
|
|
111
102
|
self._opts = _TTSOptions(
|
|
112
|
-
|
|
113
|
-
access_token=access_token,
|
|
103
|
+
api_key=api_key,
|
|
114
104
|
resource_id=resource_id,
|
|
115
105
|
voice=voice,
|
|
116
106
|
sample_rate=sample_rate,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.3.1"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "1.3.0"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|