Skip to content

Commit b0a781a

Browse files
author
wangyue.demon
committed
fix: move pyaudio from py core dependency to extension
1 parent 42d980d commit b0a781a

File tree

4 files changed

+25
-12
lines changed

4 files changed

+25
-12
lines changed

pyproject.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ dependencies = [
3636
"pymysql>=1.1.1", # For MySQL database (short term memory)
3737
"opensearch-py==2.8.0",
3838
"filetype>=1.2.0",
39-
"pyaudio>=0.2.14",
4039
]
4140

4241
[project.scripts]
@@ -55,6 +54,9 @@ database = [
5554
"tos>=2.8.4", # For TOS storage and Viking DB
5655
"mem0ai==0.1.118", # For mem0
5756
]
57+
tts = [
58+
"pyaudio>=0.2.14",
59+
]
5860
eval = [
5961
"prometheus-client>=0.22.1", # For exporting data to Prometheus pushgateway
6062
"deepeval>=3.2.6", # For DeepEval-based evaluation

tests/auth/veauth/test_speech_veauth.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,9 @@ def test_get_speech_token_with_env_vars(monkeypatch):
4040
request_body={
4141
"ProjectName": "default",
4242
"OnlyAvailable": True,
43-
"Filter": {},
4443
},
4544
header={"X-Security-Token": ""},
46-
action="ListApiKeys",
45+
action="ListAPIKeys",
4746
ak="test_access_key",
4847
sk="test_secret_key",
4948
service="speech_saas_prod",
@@ -85,10 +84,9 @@ def test_get_speech_token_with_vefaas_iam(monkeypatch):
8584
request_body={
8685
"ProjectName": "default",
8786
"OnlyAvailable": True,
88-
"Filter": {},
8987
},
9088
header={"X-Security-Token": "vefaas_session_token"},
91-
action="ListApiKeys",
89+
action="ListAPIKeys",
9290
ak="vefaas_access_key",
9391
sk="vefaas_secret_key",
9492
service="speech_saas_prod",

veadk/tools/builtin_tools/tts.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import base64
1919
import time
2020
import queue
21-
import pyaudio
2221
import threading
2322
import tempfile
2423
from typing import Dict, Any
@@ -34,15 +33,15 @@
3433
"format": "pcm",
3534
"channels": 1,
3635
"sample_rate": 16000,
37-
"bit_size": pyaudio.paInt16,
36+
"bit_size": 8,
3837
}
3938

4039
output_audio_config = {
4140
"chunk": 3200,
4241
"format": "pcm",
4342
"channels": 1,
4443
"sample_rate": 24000,
45-
"bit_size": pyaudio.paInt16,
44+
"bit_size": 8,
4645
}
4746

4847

veadk/utils/audio_manager.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,27 @@
1+
# Copyright (c) 2025 Beijing Volcano Engine Technology Co., Ltd. and/or its affiliates.
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+
115
from dataclasses import dataclass
2-
from typing import Optional, Dict, Any
16+
from typing import Optional
317

418
import pyaudio
519

620

721
@dataclass
822
class AudioConfig:
923
"""audio config"""
24+
1025
format: str
1126
bit_size: int
1227
channels: int
@@ -31,7 +46,7 @@ def open_input_stream(self) -> pyaudio.Stream:
3146
channels=self.input_config.channels,
3247
rate=self.input_config.sample_rate,
3348
input=True,
34-
frames_per_buffer=self.input_config.chunk
49+
frames_per_buffer=self.input_config.chunk,
3550
)
3651
return self.input_stream
3752

@@ -41,7 +56,7 @@ def open_output_stream(self) -> pyaudio.Stream:
4156
channels=self.output_config.channels,
4257
rate=self.output_config.sample_rate,
4358
output=True,
44-
frames_per_buffer=self.output_config.chunk
59+
frames_per_buffer=self.output_config.chunk,
4560
)
4661
return self.output_stream
4762

@@ -51,4 +66,3 @@ def cleanup(self) -> None:
5166
stream.stop_stream()
5267
stream.close()
5368
self.pyaudio.terminate()
54-

0 commit comments

Comments
 (0)