openspeechapi 0.3.1__tar.gz → 0.4.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.
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/PKG-INFO +7 -1
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/cli.py +63 -3
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/core/base.py +135 -49
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/core/enums.py +3 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/core/model_hub.py +179 -21
- openspeechapi-0.4.1/openspeechapi/core/model_presence.py +56 -0
- openspeechapi-0.4.1/openspeechapi/core/model_profile.py +131 -0
- openspeechapi-0.4.1/openspeechapi/core/voice_presets.py +91 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/dispatch/dispatcher.py +35 -1
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/dispatch/executors/subprocess_exec.py +18 -18
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/engine_catalog.py +2 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/engine_registry.yaml +16 -1
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/factory.py +5 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/local_engines/aim_resolver.py +145 -8
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/local_engines/backends/native_backend.py +16 -17
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/local_engines/cosyvoice_venv.py +4 -18
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/local_engines/engines/sherpa_onnx.py +14 -9
- openspeechapi-0.4.1/openspeechapi/local_engines/engines/whisperlivekit.py +54 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/local_engines/fish_venv.py +3 -12
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/local_engines/indextts_venv.py +3 -12
- openspeechapi-0.4.1/openspeechapi/local_engines/spark_venv.py +267 -0
- openspeechapi-0.4.1/openspeechapi/local_engines/venv_common.py +29 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/stt/canary_qwen_stt.py +6 -9
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/stt/dolphin_stt.py +85 -18
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/stt/faster_whisper.py +8 -11
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/stt/fireredasr_stt.py +9 -16
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/stt/funasr_stt.py +19 -12
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/stt/gemma4.py +22 -2
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/stt/kimi_audio_stt.py +7 -6
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/stt/mlx_whisper_stt.py +10 -7
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/stt/mms_stt.py +6 -9
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/stt/moonshine_stt.py +6 -9
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/stt/paraformer.py +4 -3
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/stt/parakeet_mlx_stt.py +10 -7
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/stt/phi4_multimodal_stt.py +6 -9
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/stt/qwen3_asr.py +8 -8
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/stt/qwen3_omni_stt.py +62 -11
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/stt/sensevoice.py +11 -8
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/stt/sherpa_onnx.py +166 -9
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/stt/vosk_stt.py +28 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/stt/voxtral_stt.py +65 -14
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/stt/wenet_stt.py +60 -26
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/tts/coqui.py +54 -38
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/tts/f5_tts.py +22 -38
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/tts/fish_speech.py +7 -7
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/tts/indextts.py +66 -71
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/tts/kokoro.py +7 -5
- openspeechapi-0.4.1/openspeechapi/providers/tts/spark.py +303 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/server/app.py +40 -9
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/server/model_downloads.py +79 -80
- openspeechapi-0.4.1/openspeechapi/server/routes/chat.py +73 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/server/routes/management.py +281 -118
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/server/routes/stt.py +45 -27
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/server/routes/tts.py +68 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/server/routes/webui.py +17 -3
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/server/system_metrics.py +98 -3
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/server/webui/app.js +460 -50
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/server/webui/index.html +26 -3
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/server/webui/styles.css +38 -2
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/server/ws/tts_stream.py +37 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/utils/audio_converter.py +39 -10
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/pyproject.toml +21 -4
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/scripts/engines/fish-speech/native/install.sh +17 -2
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/scripts/engines/sherpa-onnx/native/install.sh +24 -2
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/scripts/engines/sherpa-onnx/native/run_streaming_server.py +33 -15
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/scripts/engines/whisperlivekit/native/install.sh +22 -2
- openspeechapi-0.3.1/openspeechapi/local_engines/engines/whisperlivekit.py +0 -60
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/.gitignore +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/README.md +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/__init__.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/__main__.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/client/__init__.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/client/client.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/config.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/core/__init__.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/core/models.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/core/registry.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/core/settings.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/demo.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/dispatch/__init__.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/dispatch/aim_provision.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/dispatch/context.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/dispatch/executors/__init__.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/dispatch/executors/base.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/dispatch/executors/in_process.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/dispatch/executors/remote.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/dispatch/fanout.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/dispatch/filters.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/dispatch/lifecycle.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/dispatch/watcher.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/exceptions.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/local_engines/__init__.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/local_engines/backends/__init__.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/local_engines/backends/docker_backend.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/local_engines/base.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/local_engines/engines/__init__.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/local_engines/engines/faster_whisper.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/local_engines/engines/fish_speech.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/local_engines/engines/whisper.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/local_engines/isolated_venv.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/local_engines/manager.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/local_engines/models.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/local_engines/progress.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/local_engines/registry.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/local_engines/task_store.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/local_engines/tasks.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/local_engines/vllm_gb10_patch.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/local_engines/vllm_venv.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/logging_config.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/observe/__init__.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/observe/base.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/observe/debug.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/observe/latency.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/observe/metrics.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/observe/tracing.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/observe/usage.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/__init__.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/_template.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/stt/__init__.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/stt/_local_audio.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/stt/alibaba.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/stt/assemblyai.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/stt/azure_speech.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/stt/baidu.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/stt/deepgram.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/stt/elevenlabs.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/stt/google_cloud.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/stt/iflytek.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/stt/macos_speech.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/stt/mms_languages.json +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/stt/openai.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/stt/tencent.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/stt/volcengine.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/stt/whisper.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/stt/whisperlivekit.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/stt/windows_speech.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/tts/__init__.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/tts/alibaba.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/tts/azure_speech.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/tts/baidu.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/tts/cosyvoice.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/tts/deepgram.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/tts/elevenlabs.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/tts/google_cloud.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/tts/iflytek.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/tts/macos_say.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/tts/minimax.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/tts/openai.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/tts/piper.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/tts/tencent.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/tts/volcengine.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/providers/tts/windows_sapi.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/server/__init__.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/server/auth.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/server/extras_installer.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/server/middleware.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/server/native_installer.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/server/routes/__init__.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/server/ws/__init__.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/server/ws/stt_stream.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/telemetry/__init__.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/telemetry/perf.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/utils/__init__.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/utils/audio_playback.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/openspeechapi/vendor_registry.yaml +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/providers.example.yaml +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/scripts/aim_adopt.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/scripts/aim_consumers.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/scripts/engines/cloud/install.sh +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/scripts/engines/faster-whisper/native/install.sh +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/scripts/engines/macos-stt/_bundle.sh +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/scripts/engines/macos-stt/install.sh +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/scripts/engines/macos-stt/macos_stt.swift +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/scripts/engines/macos-stt/request_auth.swift +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/scripts/engines/whisper/native/install.sh +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/scripts/gen_mms_languages.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/scripts/preload_stt_model.py +0 -0
- {openspeechapi-0.3.1 → openspeechapi-0.4.1}/scripts/release.sh +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: openspeechapi
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.1
|
|
4
4
|
Summary: Unified speech interface for STT/TTS providers
|
|
5
5
|
Requires-Python: >=3.11
|
|
6
6
|
Requires-Dist: httpx>=0.27
|
|
@@ -8,10 +8,13 @@ Requires-Dist: loguru>=0.7
|
|
|
8
8
|
Requires-Dist: msgpack>=1.0
|
|
9
9
|
Requires-Dist: pydantic>=2.0
|
|
10
10
|
Requires-Dist: pyyaml>=6.0
|
|
11
|
+
Provides-Extra: aim
|
|
12
|
+
Requires-Dist: ai-model-manager>=0.2.1; extra == 'aim'
|
|
11
13
|
Provides-Extra: alibaba
|
|
12
14
|
Provides-Extra: alibaba-stt
|
|
13
15
|
Provides-Extra: alibaba-tts
|
|
14
16
|
Provides-Extra: all
|
|
17
|
+
Requires-Dist: ai-model-manager>=0.2.1; extra == 'all'
|
|
15
18
|
Requires-Dist: elevenlabs; extra == 'all'
|
|
16
19
|
Requires-Dist: faster-whisper; extra == 'all'
|
|
17
20
|
Requires-Dist: openai; extra == 'all'
|
|
@@ -79,6 +82,7 @@ Requires-Dist: pillow; (sys_platform != 'darwin') and extra == 'gemma4-stt'
|
|
|
79
82
|
Requires-Dist: torch; (sys_platform != 'darwin') and extra == 'gemma4-stt'
|
|
80
83
|
Requires-Dist: torchvision; (sys_platform != 'darwin') and extra == 'gemma4-stt'
|
|
81
84
|
Requires-Dist: transformers; (sys_platform != 'darwin') and extra == 'gemma4-stt'
|
|
85
|
+
Requires-Dist: transformers<5.13,>=5.5; (sys_platform == 'darwin') and extra == 'gemma4-stt'
|
|
82
86
|
Provides-Extra: google
|
|
83
87
|
Provides-Extra: google-stt
|
|
84
88
|
Provides-Extra: google-tts
|
|
@@ -143,6 +147,7 @@ Requires-Dist: funasr>=1.1.0; extra == 'sensevoice-stt'
|
|
|
143
147
|
Requires-Dist: torch; extra == 'sensevoice-stt'
|
|
144
148
|
Requires-Dist: torchaudio; extra == 'sensevoice-stt'
|
|
145
149
|
Provides-Extra: server
|
|
150
|
+
Requires-Dist: ai-model-manager>=0.2.1; extra == 'server'
|
|
146
151
|
Requires-Dist: fastapi; extra == 'server'
|
|
147
152
|
Requires-Dist: python-multipart; extra == 'server'
|
|
148
153
|
Requires-Dist: uvicorn; extra == 'server'
|
|
@@ -164,6 +169,7 @@ Requires-Dist: vosk; extra == 'vosk-stt'
|
|
|
164
169
|
Provides-Extra: voxtral-stt
|
|
165
170
|
Requires-Dist: accelerate; extra == 'voxtral-stt'
|
|
166
171
|
Requires-Dist: mistral-common[audio]>=1.8.1; extra == 'voxtral-stt'
|
|
172
|
+
Requires-Dist: sentencepiece; extra == 'voxtral-stt'
|
|
167
173
|
Requires-Dist: torch; extra == 'voxtral-stt'
|
|
168
174
|
Requires-Dist: transformers>=4.54.0; extra == 'voxtral-stt'
|
|
169
175
|
Provides-Extra: wenet-stt
|
|
@@ -70,12 +70,18 @@ def _server_base_url(args: argparse.Namespace) -> str:
|
|
|
70
70
|
return f"http://127.0.0.1:{port}"
|
|
71
71
|
|
|
72
72
|
|
|
73
|
-
def _http_json(method: str, url: str, timeout: float = 15.0) -> dict:
|
|
74
|
-
"""Minimal stdlib HTTP JSON call — keeps the client CLI path dependency-free.
|
|
73
|
+
def _http_json(method: str, url: str, timeout: float = 15.0, body: dict | None = None) -> dict:
|
|
74
|
+
"""Minimal stdlib HTTP JSON call — keeps the client CLI path dependency-free.
|
|
75
|
+
``body`` (optional dict) is JSON-encoded for POST/PUT."""
|
|
75
76
|
import json
|
|
76
77
|
import urllib.error
|
|
77
78
|
import urllib.request
|
|
78
|
-
|
|
79
|
+
data = None
|
|
80
|
+
headers = {}
|
|
81
|
+
if body is not None:
|
|
82
|
+
data = json.dumps(body).encode("utf-8")
|
|
83
|
+
headers["Content-Type"] = "application/json"
|
|
84
|
+
req = urllib.request.Request(url, method=method, data=data, headers=headers)
|
|
79
85
|
try:
|
|
80
86
|
with urllib.request.urlopen(req, timeout=timeout) as resp:
|
|
81
87
|
body = resp.read().decode("utf-8")
|
|
@@ -341,6 +347,43 @@ def _load_dotenv() -> None:
|
|
|
341
347
|
pass
|
|
342
348
|
|
|
343
349
|
|
|
350
|
+
def _cmd_aim(args: argparse.Namespace) -> None:
|
|
351
|
+
"""aim (ai-model-manager) integration: status + user-initiated adopt(回纳管). Talks to a
|
|
352
|
+
running server over HTTP (the adopt scan needs the server's engine list)."""
|
|
353
|
+
base = _server_base_url(args)
|
|
354
|
+
try:
|
|
355
|
+
if args.aim_cmd == "status":
|
|
356
|
+
cfg = _http_json("GET", f"{base}/v1/admin/server-config")
|
|
357
|
+
adoptable = _http_json("GET", f"{base}/v1/models/aim/adoptable").get("adoptable", [])
|
|
358
|
+
print(f"aim available : {cfg.get('aim_available')}")
|
|
359
|
+
print(f"aim version : {cfg.get('aim_version')}")
|
|
360
|
+
print(f"store root : {cfg.get('aim_store_root')}")
|
|
361
|
+
print(f"adoptable : {len(adoptable)}")
|
|
362
|
+
for a in adoptable:
|
|
363
|
+
print(f" - {a['engine']}: {a['repo']}")
|
|
364
|
+
return
|
|
365
|
+
# adopt
|
|
366
|
+
adoptable = _http_json("GET", f"{base}/v1/models/aim/adoptable").get("adoptable", [])
|
|
367
|
+
if args.dry_run:
|
|
368
|
+
print("would adopt:" if adoptable else "nothing to adopt")
|
|
369
|
+
for a in adoptable:
|
|
370
|
+
print(f" - {a['engine']}: {a['repo']}")
|
|
371
|
+
return
|
|
372
|
+
if not args.all and not args.repo:
|
|
373
|
+
print("specify --all or --repo <id> (use --dry-run to preview)", file=sys.stderr)
|
|
374
|
+
sys.exit(2)
|
|
375
|
+
body = {"all": True} if args.all else {"repos": args.repo}
|
|
376
|
+
res = _http_json("POST", f"{base}/v1/models/aim/adopt", body=body)
|
|
377
|
+
adopting = res.get("adopting", [])
|
|
378
|
+
for t in adopting:
|
|
379
|
+
print(f"adopting {t['repo']} (task {t['task_id']})")
|
|
380
|
+
if not adopting:
|
|
381
|
+
print("nothing adopted")
|
|
382
|
+
except RuntimeError as e:
|
|
383
|
+
print(str(e), file=sys.stderr)
|
|
384
|
+
sys.exit(1)
|
|
385
|
+
|
|
386
|
+
|
|
344
387
|
def _add_logging_args(parser: argparse.ArgumentParser) -> None:
|
|
345
388
|
"""Register common logging flags on ``parser``.
|
|
346
389
|
|
|
@@ -514,6 +557,22 @@ def main(argv: list[str] | None = None) -> None:
|
|
|
514
557
|
task_cancel_p = task_sub.add_parser("cancel", help="Request cancellation for a task")
|
|
515
558
|
task_cancel_p.add_argument("--task-id", required=True, help="Task ID")
|
|
516
559
|
|
|
560
|
+
# aim (ai-model-manager) integration: status + user-initiated adopt (re-ingest cached models)
|
|
561
|
+
aim_p = sub.add_parser("aim", help="Manage aim (ai-model-manager) integration")
|
|
562
|
+
aim_sub = aim_p.add_subparsers(dest="aim_cmd", required=True)
|
|
563
|
+
# --url/--config live on a shared parent so they follow the subcommand (natural
|
|
564
|
+
# `aim status --url X`), not `aim --url X status`.
|
|
565
|
+
_aim_conn = argparse.ArgumentParser(add_help=False)
|
|
566
|
+
_aim_conn.add_argument("--url", default=None, help="Server base URL (default http://127.0.0.1:<port>)")
|
|
567
|
+
_aim_conn.add_argument("--config", default=None, help="Config path (to resolve default port)")
|
|
568
|
+
aim_sub.add_parser("status", parents=[_aim_conn],
|
|
569
|
+
help="aim detection + store root + adoptable count")
|
|
570
|
+
adopt_p = aim_sub.add_parser("adopt", parents=[_aim_conn],
|
|
571
|
+
help="Re-ingest already-downloaded models into aim")
|
|
572
|
+
adopt_p.add_argument("--all", action="store_true", help="Adopt all adoptable models")
|
|
573
|
+
adopt_p.add_argument("--repo", action="append", default=[], help="Specific repo id (repeatable)")
|
|
574
|
+
adopt_p.add_argument("--dry-run", action="store_true", help="Preview only (no changes)")
|
|
575
|
+
|
|
517
576
|
args = parser.parse_args(argv)
|
|
518
577
|
_apply_logging_args(args)
|
|
519
578
|
if args.command is None:
|
|
@@ -527,6 +586,7 @@ def main(argv: list[str] | None = None) -> None:
|
|
|
527
586
|
"load": _cmd_load,
|
|
528
587
|
"unload": _cmd_unload,
|
|
529
588
|
"engine": _cmd_engine,
|
|
589
|
+
"aim": _cmd_aim,
|
|
530
590
|
}
|
|
531
591
|
commands[args.command](args)
|
|
532
592
|
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
"""Provider abstract base classes."""
|
|
2
2
|
from __future__ import annotations
|
|
3
3
|
|
|
4
|
+
import base64
|
|
5
|
+
import contextlib
|
|
4
6
|
import os
|
|
7
|
+
import tempfile
|
|
5
8
|
from abc import ABC, abstractmethod
|
|
6
9
|
from collections.abc import AsyncIterator
|
|
7
10
|
from dataclasses import dataclass
|
|
@@ -11,6 +14,11 @@ from openspeechapi.core.enums import AudioFormat, Capability, ExecMode, Provider
|
|
|
11
14
|
from openspeechapi.core.models import AudioChunk, AudioData, STTOptions, TTSOptions, Transcription
|
|
12
15
|
from openspeechapi.core.settings import BaseSettings
|
|
13
16
|
|
|
17
|
+
# Sentinel for _resolve_model(aim_spec=…): distinguishes "caller passed no spec →
|
|
18
|
+
# use self.aim_model_spec()" from "caller explicitly passed None → no aim". None is a
|
|
19
|
+
# valid aim_spec value (no aim), so a distinct sentinel is required.
|
|
20
|
+
_USE_SELF_AIM_SPEC = object()
|
|
21
|
+
|
|
14
22
|
|
|
15
23
|
@dataclass
|
|
16
24
|
class AimModelSpec:
|
|
@@ -91,49 +99,66 @@ class SpeechProvider(ABC):
|
|
|
91
99
|
# (long, model-load-appropriate) start timeout. None (default) = no pre-check.
|
|
92
100
|
required_import: str | None = None
|
|
93
101
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
``
|
|
100
|
-
|
|
101
|
-
in must prefer ``settings.model_path`` (when set and present on disk) in
|
|
102
|
-
their model-loading code, falling back to the repo id otherwise.
|
|
103
|
-
"""
|
|
102
|
+
@classmethod
|
|
103
|
+
def model_profile(cls, settings): # noqa: ANN001
|
|
104
|
+
"""声明式模型契约(server 进程内、纯字符串、绝不 import torch/mlx)。返回
|
|
105
|
+
:class:`~openspeechapi.core.model_profile.ModelProfile` 让框架派生所有静态钩子
|
|
106
|
+
(aim_model_spec / expected_local_repo / local_model_present / download_spec /
|
|
107
|
+
pending_aux_models);``None``(默认)= 未迁移 / 无本地下载,各钩子退回旧默认。
|
|
108
|
+
见 docs/superpowers/specs/2026-07-05-unified-model-management-design.md。"""
|
|
104
109
|
return None
|
|
105
110
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
111
|
+
def aim_model_spec(self) -> "AimModelSpec | None":
|
|
112
|
+
"""让 ``aim`` (ai-model-manager) 下载 + 管理本模型。默认从 :meth:`model_profile`
|
|
113
|
+
派生(主源可 aim → AimModelSpec;部分下载 → None);provider 若直接 override 本方法则
|
|
114
|
+
其 override 优先(Python MRO)。未迁移(model_profile=None)→ None,provider 自行 override
|
|
115
|
+
提供。opt-in 的 provider 加载时须优先用 ``settings.model_path``(已解析且在盘上时),否则
|
|
116
|
+
回退 repo id。"""
|
|
117
|
+
return self._aim_spec_for(self.settings)
|
|
118
|
+
|
|
119
|
+
def _aim_spec_for(self, settings) -> "AimModelSpec | None": # noqa: ANN001
|
|
120
|
+
"""从 **任意** settings 派生 aim spec(不限于静态 ``self.settings``)。
|
|
121
|
+
|
|
122
|
+
``aim_model_spec()`` = ``self._aim_spec_for(self.settings)`` 的静态特例。**按请求换
|
|
123
|
+
model 的引擎**(如 dolphin 的 small/base per-request 覆盖)在加载路径拿到有效配置 ``s``
|
|
124
|
+
后,须用 ``self._aim_spec_for(s)`` 取**该请求模型**的 spec —— 否则 ``_resolve_model``
|
|
125
|
+
默认用静态 config 的 spec,会把请求模型的目录错链到 config 模型的 store(踩过:base 被
|
|
126
|
+
链到 small store,base.pt 找不到 → 无结果)。"""
|
|
127
|
+
from openspeechapi.core.model_profile import derive_aim_spec
|
|
128
|
+
profile = type(self).model_profile(settings)
|
|
129
|
+
if profile is None:
|
|
130
|
+
return None
|
|
131
|
+
hub = getattr(settings, "hub", "") or ""
|
|
132
|
+
return derive_aim_spec(profile, hub)
|
|
109
133
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
134
|
+
@classmethod
|
|
135
|
+
def local_model_present(cls, settings) -> bool | None: # noqa: ANN001
|
|
136
|
+
"""该 config 的模型权重是否已在本机(「是否已下载」预检的**非标准**判定,如 piper)。
|
|
137
|
+
|
|
138
|
+
默认从 :meth:`model_profile` 的部分下载源派生(有 ``allow_patterns`` → 校验那几个文件在否);
|
|
139
|
+
未迁移 / 无部分源 → ``None``(交标准 ``expected_local_repo`` + ``model_is_cached`` / aim 判断)。
|
|
140
|
+
provider 若直接 override 本方法则其 override 优先(MRO)。
|
|
114
141
|
|
|
115
142
|
与 ``expected_local_repo`` 同纪律:在 **server 进程** 调用 → 纯字符串/文件存在性逻辑,
|
|
116
143
|
绝不 import torch/transformers/mlx、绝不加载模型、绝不触发下载。``settings`` 可能是
|
|
117
|
-
dataclass 实例或 dict
|
|
118
|
-
|
|
119
|
-
return
|
|
120
|
-
|
|
121
|
-
@staticmethod
|
|
122
|
-
def download_spec(settings) -> dict | None: # noqa: ANN001
|
|
123
|
-
"""该引擎「下载模型」按钮触发的**部分 snapshot 下载**描述,默认 ``None``。
|
|
144
|
+
dataclass 实例或 dict。"""
|
|
145
|
+
from openspeechapi.core.model_profile import derive_partial_present
|
|
146
|
+
return derive_partial_present(cls.model_profile(settings))
|
|
124
147
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
148
|
+
@classmethod
|
|
149
|
+
def download_spec(cls, settings) -> dict | None: # noqa: ANN001
|
|
150
|
+
"""该引擎「下载模型」按钮触发的**部分 snapshot 下载**描述,默认从 :meth:`model_profile`
|
|
151
|
+
的非 aim-able 主源派生(piper 式部分下载),形如::
|
|
128
152
|
|
|
129
153
|
{"repo": "<hf repo>", "allow_patterns": ["<glob>", ...], "label": "<str>"}
|
|
130
154
|
|
|
131
|
-
|
|
132
|
-
|
|
155
|
+
走 aim 纳管的引擎(整仓 hf/ms 或单文件 url)→ ``None``(交 ``aim_model_spec()``)。未迁移 /
|
|
156
|
+
无部分源 → ``None``。provider 若直接 override 本方法则其 override 优先(MRO)。
|
|
133
157
|
|
|
134
158
|
同 ``expected_local_repo`` 纪律:server 进程内调用,纯字符串逻辑、不加载模型、不下载。
|
|
135
|
-
``settings`` 可能是 dataclass 实例或 dict
|
|
136
|
-
|
|
159
|
+
``settings`` 可能是 dataclass 实例或 dict。"""
|
|
160
|
+
from openspeechapi.core.model_profile import derive_download_spec
|
|
161
|
+
return derive_download_spec(cls.model_profile(settings))
|
|
137
162
|
|
|
138
163
|
@staticmethod
|
|
139
164
|
def pending_reference_asr(settings, opts) -> dict | None: # noqa: ANN001
|
|
@@ -148,30 +173,37 @@ class SpeechProvider(ABC):
|
|
|
148
173
|
``settings`` 可能是 dataclass 或 dict;``opts`` 为本次请求的 ``TTSOptions``。"""
|
|
149
174
|
return None
|
|
150
175
|
|
|
151
|
-
@
|
|
152
|
-
def pending_aux_models(settings, opts) -> "list[dict] | None": # noqa: ANN001
|
|
153
|
-
"""该引擎首次加载时要下的**辅助模型**里,尚未缓存的那些(
|
|
176
|
+
@classmethod
|
|
177
|
+
def pending_aux_models(cls, settings, opts) -> "list[dict] | None": # noqa: ANN001, ARG003
|
|
178
|
+
"""该引擎首次加载时要下的**辅助模型**里,尚未缓存的那些(默认从 :meth:`model_profile` 的
|
|
179
|
+
``aux`` 派生:检查各 aux 源缓存缺失项)。
|
|
154
180
|
|
|
155
181
|
某些 SDK(如 IndexTTS2)在加载主模型时,会在 worker 里静默现下若干 GB 的辅助模型
|
|
156
|
-
(w2v-bert / codec / vocoder 等)——违反「前后台状态同步」+「绝不 worker
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
182
|
+
(w2v-bert / codec / vocoder 等)——违反「前后台状态同步」+「绝不 worker 静默现下」。合成
|
|
183
|
+
前置 gate 据本钩子的缺失列表 ``[{repo, allow_patterns, label}, ...]`` 起**追踪下载**(上
|
|
184
|
+
Dashboard)+ 返回 409 ``model_downloading`` + 前端自动重试;待全部就绪后 provider 把它们
|
|
185
|
+
显式喂给 SDK。未迁移 / 无 aux → ``None``。provider 若直接 override 则其 override 优先(MRO)。
|
|
186
|
+
``opts`` 保留签名兼容(aux 恒为静态,不依赖单次请求)。
|
|
161
187
|
|
|
162
188
|
同 ``download_spec`` 纪律:server 进程内调用,纯字符串/缓存存在性逻辑,绝不加载模型/下载。"""
|
|
163
|
-
|
|
189
|
+
from openspeechapi.core.model_profile import derive_missing_aux
|
|
190
|
+
return derive_missing_aux(cls.model_profile(settings))
|
|
164
191
|
|
|
165
192
|
@classmethod
|
|
166
193
|
def expected_local_repo(cls, settings) -> str | None: # noqa: ANN001
|
|
167
194
|
"""该引擎在本机会从本地缓存加载的 HF repo id(用于「是否已下载」预检)。
|
|
168
195
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
196
|
+
已迁移(:meth:`model_profile` 非空)→ 从 profile 派生(``expected_repo or primary.repo``,
|
|
197
|
+
且形如合法 HF id);未迁移 → 旧默认(``settings.model`` 且含 ``/``)。平台会重映射 repo 的
|
|
198
|
+
引擎(如 gemma4)经 ``profile.expected_repo`` 表达。provider 若直接 override 则其 override
|
|
199
|
+
优先(MRO)。
|
|
200
|
+
|
|
201
|
+
在 **server 进程** 里调用 —— 本方法及其所有 override 必须是 **纯字符串逻辑**:绝不 import
|
|
202
|
+
torch / transformers / mlx,绝不加载模型。``settings`` 可能是 dataclass 实例或 dict。"""
|
|
203
|
+
from openspeechapi.core.model_profile import derive_expected_repo
|
|
204
|
+
profile = cls.model_profile(settings)
|
|
205
|
+
if profile is not None:
|
|
206
|
+
return derive_expected_repo(profile)
|
|
175
207
|
model = settings.get("model") if isinstance(settings, dict) else getattr(settings, "model", None)
|
|
176
208
|
model = (model or "").strip()
|
|
177
209
|
return model if "/" in model else None
|
|
@@ -180,17 +212,22 @@ class SpeechProvider(ABC):
|
|
|
180
212
|
self, repo: str, *, hub: str = "", model_path: str = "",
|
|
181
213
|
ms_repo_map: "dict[str, str] | None" = None, custom_url: str = "",
|
|
182
214
|
fixed_path: str = "", category: str = "asr/model",
|
|
183
|
-
snapshot: bool = False,
|
|
215
|
+
snapshot: bool = False, aim_spec: Any = _USE_SELF_AIM_SPEC,
|
|
184
216
|
) -> str:
|
|
185
217
|
"""Resolve this provider's model via the unified chain
|
|
186
218
|
(model_path → aim → global source → custom url → symlink). See model_hub.
|
|
187
219
|
|
|
188
220
|
Pass ``snapshot=True`` for loaders that require a real local directory
|
|
189
221
|
even when the source is HF (e.g. dolphin). The resolver will call
|
|
190
|
-
``huggingface_hub.snapshot_download`` and return the local dir path.
|
|
222
|
+
``huggingface_hub.snapshot_download`` and return the local dir path.
|
|
223
|
+
|
|
224
|
+
``aim_spec``: 默认(sentinel)用 ``self.aim_model_spec()``(静态 config 的 spec)——
|
|
225
|
+
对「加载即 config 模型」的引擎正确。**按请求换 model 的引擎**须显式传 ``self._aim_spec_for(s)``
|
|
226
|
+
(该请求模型的 spec),否则 aim 会把请求模型的 ``fixed_path`` 错链到 config 模型的 store。"""
|
|
191
227
|
from openspeechapi.core.model_hub import resolve_model_source # local: avoid cycle
|
|
228
|
+
spec = self.aim_model_spec() if aim_spec is _USE_SELF_AIM_SPEC else aim_spec
|
|
192
229
|
return resolve_model_source(
|
|
193
|
-
repo, hub=hub, model_path=model_path, aim_spec=
|
|
230
|
+
repo, hub=hub, model_path=model_path, aim_spec=spec,
|
|
194
231
|
ms_repo_map=ms_repo_map, custom_url=custom_url, fixed_path=fixed_path,
|
|
195
232
|
category=category, snapshot=snapshot,
|
|
196
233
|
)
|
|
@@ -335,3 +372,52 @@ class TTSProvider(SpeechProvider):
|
|
|
335
372
|
Override to return a list. Must stay import-light (no torch): it runs in the server process
|
|
336
373
|
off ``provider_cls`` with no instance/model."""
|
|
337
374
|
return None
|
|
375
|
+
|
|
376
|
+
# ── clone-reference temp-file handling (shared by spark / indextts / f5 / coqui) ──────────────
|
|
377
|
+
@staticmethod
|
|
378
|
+
def _reference_to_wav(value: Any) -> tuple[str | None, bool]:
|
|
379
|
+
"""A clone-reference value → ``(local_wav_path, is_temp)``.
|
|
380
|
+
|
|
381
|
+
Accepts an existing file path, a base64 string, or raw ``bytes``. base64/bytes are decoded
|
|
382
|
+
and written to a NEW temp WAV, returned with ``is_temp=True`` (the caller must delete it —
|
|
383
|
+
use :meth:`_reference_wav`). A falsy value, an existing path, or a non-base64 string is
|
|
384
|
+
returned as-is with ``is_temp=False`` — it is the user's own file (or no file), so it must
|
|
385
|
+
NEVER be deleted.
|
|
386
|
+
"""
|
|
387
|
+
if not value:
|
|
388
|
+
return None, False
|
|
389
|
+
if isinstance(value, str):
|
|
390
|
+
if os.path.exists(value):
|
|
391
|
+
return value, False
|
|
392
|
+
try:
|
|
393
|
+
raw = base64.b64decode(value, validate=True)
|
|
394
|
+
except Exception: # noqa: BLE001 - not base64 → treat as a path/URL string
|
|
395
|
+
return value, False
|
|
396
|
+
else:
|
|
397
|
+
raw = value
|
|
398
|
+
f = tempfile.NamedTemporaryFile(suffix=".wav", delete=False)
|
|
399
|
+
f.write(raw)
|
|
400
|
+
f.close()
|
|
401
|
+
return f.name, True
|
|
402
|
+
|
|
403
|
+
@contextlib.contextmanager
|
|
404
|
+
def _reference_wav(self, resolved: tuple[str | None, bool]):
|
|
405
|
+
"""Context manager over a resolved reference ``(path, is_temp)`` — yields ``path`` and deletes
|
|
406
|
+
the temp file *we* created (``is_temp=True``) when the block exits, whether it completes or
|
|
407
|
+
raises. A user-supplied path (``is_temp=False``) or ``None`` is yielded untouched.
|
|
408
|
+
|
|
409
|
+
Wrap the ``_synth`` call in ``synthesize`` so a base64/bytes reference clip doesn't leak a
|
|
410
|
+
``.wav`` in the temp dir on every clone request::
|
|
411
|
+
|
|
412
|
+
with self._reference_wav(self._resolve_reference(opts, s)) as ref:
|
|
413
|
+
wav_bytes, sr = await asyncio.to_thread(self._synth, text, ref, ...)
|
|
414
|
+
"""
|
|
415
|
+
path, is_temp = resolved
|
|
416
|
+
try:
|
|
417
|
+
yield path
|
|
418
|
+
finally:
|
|
419
|
+
if is_temp and path:
|
|
420
|
+
try:
|
|
421
|
+
os.unlink(path)
|
|
422
|
+
except OSError:
|
|
423
|
+
pass
|
|
@@ -40,3 +40,6 @@ class Capability(str, Enum):
|
|
|
40
40
|
WORD_TIMESTAMPS = "word_timestamps"
|
|
41
41
|
# STT: detects audio emotion + acoustic events (e.g. SenseVoice rich tags).
|
|
42
42
|
AUDIO_EVENTS = "audio_events"
|
|
43
|
+
# Omni-modal engines (e.g. qwen3-omni) that expose an OpenAI-compatible /v1/chat/completions
|
|
44
|
+
# backend for text/image/audio/video understanding. Gates the OSA chat-completions proxy route.
|
|
45
|
+
CHAT = "chat"
|