Skip to main content

LiveKit Agent Plugins for Alibaba Cloud

Project description

livekit-plugins-aliyun

适配阿里云百炼livekit-agent框架插件。目前支持TTS, LLM, STT

安装

pip install livekit-plugins-aliyun

环境变量

  • LLM, STT, TTS: DASHSCOPE_API_KEY

使用示例

以下代码展示了如何在livekit-agent中使用livekit-plugins-aliyun插件。

from livekit.agents import Agent, AgentSession, JobContext, cli, WorkerOptions
from livekit.plugins import aliyun
from dotenv import load_dotenv


async def entry_point(ctx: JobContext):
    
    await ctx.connect()
    
    agent = Agent(instructions="You are a helpful assistant.")

    session = AgentSession(
        stt=aliyun.STT(model="paraformer-realtime-v2"),
        tts=aliyun.TTS(model="cosyvoice-v2", voice="longcheng_v2"),
        llm=aliyun.LLM(model="qwen-plus"),
    )
    
    await session.start(agent=agent, room=ctx.room)
    
    await session.generate_reply()

if __name__ == "__main__":
    load_dotenv()
    cli.run_app(WorkerOptions(entrypoint_fnc=entry_point))

若需要使用STT热词功能,需要在STT插件中配置vocabulary_id参数。

    session = AgentSession(
        stt=aliyun.STT(model="paraformer-realtime-v2", vocabulary_id="your_vocabulary_id"),
        tts=aliyun.TTS(model="cosyvoice-v2", voice="longcheng_v2"),
        llm=aliyun.LLM(model="qwen-plus"),
    )

Project details


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_aliyun-1.2.3.post1.tar.gz (11.9 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_aliyun-1.2.3.post1-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

File details

Details for the file livekit_plugins_aliyun-1.2.3.post1.tar.gz.

File metadata

File hashes

Hashes for livekit_plugins_aliyun-1.2.3.post1.tar.gz
Algorithm Hash digest
SHA256 862d394be1ce57cfaaaa2fbba2c430ff65a7171cb76b46786d51ec8cb7298c0e
MD5 034cf27f55574a11140841b6040bce48
BLAKE2b-256 773d30c98890f6ddf9a2863a5b1e8447f698844d3466a9d95debe3dc28cad0a5

See more details on using hashes here.

File details

Details for the file livekit_plugins_aliyun-1.2.3.post1-py3-none-any.whl.

File metadata

File hashes

Hashes for livekit_plugins_aliyun-1.2.3.post1-py3-none-any.whl
Algorithm Hash digest
SHA256 52a3c8aa5d67074d4483a68027864fc24c6f21f9da405977b5f302dddbae688d
MD5 4066826c3f23f514021503812f807b83
BLAKE2b-256 55be597a3df9da9cc151b8885a3a697059d0ae751ad6bde6a4d667380c0b77c8

See more details on using hashes here.

Supported by

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