Metadata-Version: 2.4
Name: livekit-plugins-volcengine
Version: 1.2.9
Summary: LiveKit Agent Plugins for Volcengine
Author-email: wangmengdi <790990241@qq.com>
Keywords: audio,livekit,realtime,video,webrtc
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Topic :: Multimedia :: Sound/Audio
Classifier: Topic :: Multimedia :: Video
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.9
Requires-Dist: livekit-agents>=1.2.9
Requires-Dist: numpy
Requires-Dist: openai>=1.75.0
Requires-Dist: osc-data==0.2.2
Requires-Dist: pydantic
Description-Content-Type: text/markdown

# livekit-plugins-volcengine

适配火山引擎服务的[livekit-agent](https://github.com/livekit/agents)框架插件。目前支持[TTS](https://www.volcengine.com/docs/6561/79817), [LLM](https://www.volcengine.com/docs/82379/1298454#%E6%B5%81%E5%BC%8F%E8%B0%83%E7%94%A8), [STT](https://www.volcengine.com/docs/6561/80818#python)，[BigModelSTT](https://www.volcengine.com/docs/6561/1354869)，[Realtime](https://www.volcengine.com/docs/6561/1594356)

## 安装
```python
pip install livekit-plugins-volcengine
```

## 环境变量

- Volcengine TTS: `VOLCENGINE_TTS_ACCESS_TOKEN`
- Volcengine STT: `VOLCENGINE_STT_ACCESS_TOKEN`
- Volcengine LLM: `VOLCENGINE_LLM_API_KEY`
- Volcengine Realtime: `VOLCENGINE_REALTIME_ACCESS_TOKEN`

## 使用示例

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

```python
from livekit.agents import Agent, AgentSession, JobContext, cli, WorkerOptions
from livekit.plugins import volcengine, deepgram, silero
from dotenv import load_dotenv


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

    session = AgentSession(
        # 语音识别：https://console.volcengine.com/speech/service/16
        stt=volcengine.STT(app_id="xxx", cluster="xxx"),
        # 大模型语音识别：https://console.volcengine.com/speech/service/10011
        stt = volcengine.BigModelSTT(app_id="xxx"),
        # 语音识别：https://www.volcengine.com/docs/6561/97465
        tts=volcengine.TTS(app_id="xxx", cluster="xxx", vioce_type="BV001_V2_streaming"),
        # 大语言模型：https://www.volcengine.com/docs/82379/1513689
        llm=volcengine.LLM(model="doubao-1-5-lite-32k-250115"),
        # 端到端实时语音大模型：https://www.volcengine.com/docs/6561/1594356
        llm=volcengine.RealtimeModel(app_id="xxxx",
                                     speaking_style="xxxx", # 回复语音风格
                                     system_role="xxx", # 系统提示词
                                     opening="xxx") # 开场词
    )
    
    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))
```

