livekit-plugins-zhipu
智谱AI服务专用的 LiveKit Agents 插件,提供大语言模型集成解决方案。
✨ 特性
- 🤖 大语言模型 (LLM) - 支持智谱GLM系列大模型
- 🧠 对话生成 - 支持多轮对话和上下文理解
- 📦 开箱即用 - 完整的 Python 包支持
📋 支持的服务
| 服务 | 描述 | 文档链接 |
|---|---|---|
| LLM | 大语言模型 | 智谱GLM模型 |
🛠️ 安装
使用 pip 安装
pip install livekit-plugins-zhipu
从源码安装
git clone https://github.com/your-repo/livekit-plugins-volcengine.git
cd livekit-plugins-volcengine
pip install -e ./livekit-plugins/livekit-plugins-zhipu
系统要求
- Python >= 3.9
- LiveKit Agents >= 1.2.9
⚙️ 配置
环境变量
在使用插件前,请配置以下环境变量:
| 环境变量 | 描述 | 获取方式 |
|---|---|---|
ZHIPU_LLM_API_KEY |
智谱API密钥 | 智谱AI开放平台 |
.env 文件示例
# .env
ZHIPU_LLM_API_KEY=your_api_key_here
📖 使用指南
基础使用
from livekit.agents import Agent, AgentSession, JobContext, cli, WorkerOptions
from livekit.plugins import zhipu
from dotenv import load_dotenv
async def entry_point(ctx: JobContext):
agent = Agent(instructions="You are a helpful assistant.")
session = AgentSession(
# 大语言模型
llm=zhipu.LLM(model="glm-4")
)
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 zhipu
# 自定义LLM配置
llm = zhipu.LLM(
model="glm-4-plus", # 模型名称 (glm-4, glm-4-plus, glm-3-turbo等)
temperature=0.7, # 温度 (0.0-1.0)
max_tokens=2000, # 最大token数
top_p=0.9, # 核采样参数
api_key="your_api_key" # API密钥 (可选,从环境变量获取)
)
🔧 API 参考
LLM (大语言模型)
zhipu.LLM(
model: str = "glm-4", # 模型名称
temperature: float = 0.7, # 温度
max_tokens: int = 2000, # 最大token数
top_p: float = 0.9, # 核采样参数
api_key: str = None # API密钥 (从环境变量获取)
)
❓ 常见问题
Q: 如何获取智谱API密钥?
A: 请访问智谱AI开放平台,注册账号并获取API密钥。
Q: 支持哪些GLM模型?
A: 支持智谱GLM系列模型:
glm-4- GLM-4 基础版glm-4-plus- GLM-4 增强版glm-3-turbo- GLM-3 Turbo版- 其他GLM系列模型
Q: 如何调整模型参数?
A: 可以通过以下参数调整生成效果:
temperature: 控制生成文本的随机性 (0.0-1.0)max_tokens: 限制生成文本的最大长度top_p: 控制生成文本的多样性
📝 更新日志
v1.2.9
- 支持智谱GLM系列大语言模型
- 支持多种模型参数配置
- 完善的API文档和使用示例
🤝 贡献
欢迎提交 Issue 和 Pull Request!
📄 许可证
本项目采用 Apache 2.0 许可证。
🙏 致谢
Metadata
Release files for livekit-plugins-zhipu 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 | Provenance | Actions |
|---|---|---|---|---|
| livekit_plugins_zhipu-1.3.0.tar.gz | 8.4 kB | Without provenance | Details for livekit_plugins_zhipu-1.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| livekit_plugins_zhipu-1.3.0-py3-none-any.whl | Python 3 | none | any | Details for livekit_plugins_zhipu-1.3.0-py3-none-any.whl |
Total release size: 16.9 kB
Release files / livekit_plugins_zhipu-1.3.0.tar.gz
| Download URL | livekit_plugins_zhipu-1.3.0.tar.gz |
|---|---|
| Size | 8.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3540eea52da2c9996531d5d8c06a2b399839c56076d532055f15f3ead0483a6e
|
|
BLAKE2b-256 checksum How to use checksums |
30c1093a73b5c410f0f7227f7d1815c2bdba10f7598aedaf2e35080e4b303d1c
|
| 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_zhipu-1.3.0-py3-none-any.whl
| Download URL | livekit_plugins_zhipu-1.3.0-py3-none-any.whl |
|---|---|
| Size | 8.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8e49e1a75204743ab960d81ecf69b73d29a9812a4e56a064053ba51656918210
|
|
BLAKE2b-256 checksum How to use checksums |
e897d101b4930f72b5f8534c0ad3ba63ea92ad833d2e7a1e9383b116e5e38c2f
|
| 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}
|
Security for livekit-plugins-zhipu 1.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.