livekit-plugins-tencent
腾讯云服务专用的 LiveKit Agents 插件,提供语音识别集成解决方案。
✨ 特性
- 🎤 语音识别 (STT) - 支持腾讯云语音识别服务
- 🔒 安全认证 - 支持腾讯云标准的密钥认证方式
- 📦 开箱即用 - 完整的 Python 包支持
📋 支持的服务
| 服务 | 描述 | 文档链接 |
|---|---|---|
| STT | 语音识别 | 腾讯云语音识别 |
🛠️ 安装
使用 pip 安装
pip install livekit-plugins-tencent
从源码安装
git clone https://github.com/your-repo/livekit-plugins-volcengine.git
cd livekit-plugins-volcengine
pip install -e ./livekit-plugins/livekit-plugins-tencent
系统要求
- Python >= 3.9
- LiveKit Agents >= 1.2.9
⚙️ 配置
环境变量
在使用插件前,请配置以下环境变量:
| 环境变量 | 描述 | 获取方式 |
|---|---|---|
TENCENT_STT_APP_ID |
腾讯云应用ID | 腾讯云控制台 |
TENCENT_STT_SECRET_KEY |
腾讯云密钥 | 腾讯云控制台 |
TENCENT_STT_ID |
腾讯云Secret ID | 腾讯云控制台 |
.env 文件示例
# .env
TENCENT_STT_APP_ID=your_app_id
TENCENT_STT_SECRET_KEY=your_secret_key
TENCENT_STT_ID=your_secret_id
📖 使用指南
基础使用
from livekit.agents import Agent, AgentSession, JobContext, cli, WorkerOptions
from livekit.plugins import tencent
from dotenv import load_dotenv
async def entry_point(ctx: JobContext):
agent = Agent(instructions="You are a helpful assistant.")
session = AgentSession(
# 语音识别 - 参数可从腾讯云控制台获取
stt=tencent.STT(
app_id="your_app_id",
secret_key="your_secret_key",
secret_id="your_secret_id"
)
)
await session.start(agent=agent, room=ctx.room)
await ctx.connect()
if __name__ == "__main__":
load_dotenv()
cli.run_app(WorkerOptions(entrypoint_fnc=entry_point))
高级配置
from livekit.plugins import tencent
# 自定义STT配置
stt = tencent.STT(
app_id="your_app_id", # 应用ID
secret_key="your_secret_key", # 密钥
secret_id="your_secret_id", # Secret ID
region="ap-beijing", # 地域 (默认: ap-beijing)
engine_model_type="16k_zh", # 引擎模型类型
voice_format="wav", # 音频格式
filter_dirty=1, # 是否过滤脏话 (0: 不过滤, 1: 过滤)
filter_modal=1, # 是否过滤语气词 (0: 不过滤, 1: 过滤)
convert_num_mode=1 # 数字转换模式 (0: 不转换, 1: 转换为阿拉伯数字)
)
🔧 API 参考
STT (语音识别)
tencent.STT(
app_id: str, # 应用ID
secret_key: str, # 密钥
secret_id: str, # Secret ID
region: str = "ap-beijing", # 地域
engine_model_type: str = "16k_zh", # 引擎模型类型
voice_format: str = "wav", # 音频格式
filter_dirty: int = 1, # 是否过滤脏话
filter_modal: int = 1, # 是否过滤语气词
convert_num_mode: int = 1 # 数字转换模式
)
❓ 常见问题
Q: 如何获取腾讯云的认证信息?
A: 请访问腾讯云控制台,创建语音识别应用并获取以下信息:
- App ID: 应用ID
- Secret Key: 密钥
- Secret ID: Secret ID
Q: 支持哪些音频格式?
A: 支持多种音频格式,包括:
wav- WAV格式mp3- MP3格式m4a- M4A格式- 其他腾讯云支持的音频格式
Q: 如何配置语音识别参数?
A: 可以通过以下参数优化识别效果:
engine_model_type: 选择合适的引擎模型 (16k_zh, 8k_zh等)filter_dirty: 过滤敏感词汇filter_modal: 过滤语气词convert_num_mode: 数字转换设置
Q: 支持哪些地域?
A: 支持腾讯云的各个地域,包括:
ap-beijing- 北京ap-shanghai- 上海ap-guangzhou- 广州- 其他腾讯云支持的地域
📝 更新日志
v1.2.9
- 支持腾讯云语音识别服务
- 支持多种音频格式和地域
- 完善的API文档和使用示例
🤝 贡献
欢迎提交 Issue 和 Pull Request!
- Fork 本项目
- 创建特性分支 (
git checkout -b feature/AmazingFeature) - 提交更改 (
git commit -m 'Add some AmazingFeature') - 推送到分支 (
git push origin feature/AmazingFeature) - 打开 Pull Request
📄 许可证
本项目采用 Apache 2.0 许可证 - 查看 LICENSE 文件了解详情。
📞 联系我们
- 项目主页: GitHub
- 问题反馈: Issues
- 邮箱: 790990241@qq.com
🙏 致谢
Metadata
Release files for livekit-plugins-tencent 1.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| livekit_plugins_tencent-1.3.0.tar.gz | 9.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| livekit_plugins_tencent-1.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.8 kB
Release files / livekit_plugins_tencent-1.3.0.tar.gz
| Download URL | livekit_plugins_tencent-1.3.0.tar.gz |
|---|---|
| Size | 9.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e536243249cc894d24a338773b8a1fcacc1119105000a1e8912f2fdcd965601d
|
|
BLAKE2b-256 checksum How to use checksums |
a2975608a2a575fc53d86ee9e4b8cfc5d23ff8d4ddc8c1ef6c5fccc842ed18d9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / livekit_plugins_tencent-1.3.0-py3-none-any.whl
| Download URL | livekit_plugins_tencent-1.3.0-py3-none-any.whl |
|---|---|
| Size | 8.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4f91a23c0df9cdb6c414f25320a312963f0679b96bf1b3cc997b7ed990dd3386
|
|
BLAKE2b-256 checksum How to use checksums |
4e39874d13ea37ea9374bb875253ff59b56f19f5c481043324a21af8e0d32397
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|