Skip to main content

livekit-plugins-zhipu

PyPI version Python 3.9+ License

智谱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 许可证。

🙏 致谢

  • LiveKit - 优秀的实时通信框架
  • 智谱AI - 强大的AI服务提供商

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

livekit_plugins_zhipu-1.3.0.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

livekit_plugins_zhipu-1.3.0-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file livekit_plugins_zhipu-1.3.0.tar.gz.

File metadata

  • Download URL: livekit_plugins_zhipu-1.3.0.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for livekit_plugins_zhipu-1.3.0.tar.gz
Algorithm Hash digest
SHA256 3540eea52da2c9996531d5d8c06a2b399839c56076d532055f15f3ead0483a6e
MD5 6b91e899f8c0cd78295fb19cea18e69c
BLAKE2b-256 30c1093a73b5c410f0f7227f7d1815c2bdba10f7598aedaf2e35080e4b303d1c

See more details on using hashes here.

File details

Details for the file livekit_plugins_zhipu-1.3.0-py3-none-any.whl.

File metadata

  • Download URL: livekit_plugins_zhipu-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for livekit_plugins_zhipu-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8e49e1a75204743ab960d81ecf69b73d29a9812a4e56a064053ba51656918210
MD5 108696a269085179722811b5c8ec36d4
BLAKE2b-256 e897d101b4930f72b5f8534c0ad3ba63ea92ad833d2e7a1e9383b116e5e38c2f

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.3.0 This release

2 files

1.2.9.post0

2 files

1.2.9

2 files

1.2.8

2 files

1.2.6

2 files

1.2.3.post1

2 files

1.2.3.post0

2 files

1.2.3

2 files

1.2.2

2 files

1.2.0

2 files

1.1.5.post0

2 files

1.1.5

2 files

1.1.2.post7

2 files

1.1.2.post6

2 files

1.1.2.post5

2 files

1.1.2.post4

2 files

1.1.2.post3

2 files

1.1.2.post2

2 files

1.1.2.post1

2 files

1.1.2.post0

2 files

1.1.2

2 files

1.1.0.post4

2 files

1.1.0.post2

2 files

1.1.0.post1

2 files

1.1.0.post0

2 files

1.1.0

2 files

1.0.23

2 files

1.0.17.post0

2 files

1.0.17

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page