LiveKit Agent Plugins for Dify
Project description
LiveKit Plugins Dify
Agent Framework plugin for Dify.
Installation
pip install livekit-plugins-difyai
Pre-requisites
- Dify API Key environment variables:
DIFY_API_KEY - Dify API Base URL environment variables:
DIFY_API_BASE. defaults to https://api.dify.ai/v1.
Usage
This example shows how to use the Dify plugin.
from livekit.agents import Agent, AgentSession, JobContext, cli, WorkerOptions
from livekit.plugins import dify
from dotenv import load_dotenv
async def entry_point(ctx: JobContext):
await ctx.connect()
agent = Agent(instructions="You are a helpful assistant.")
llm = dify.LLM(user="xxx")
session = AgentSession(
stt = xxx,
llm = llm
tts = xxx,
)
await session.start(agent=agent, room=ctx.room)
## 支持dify开场词
opening_words = await llm.get_opening_words()
if opening_words:
await session.say(opening_words)
if __name__ == "__main__":
load_dotenv()
cli.run_app(WorkerOptions(entrypoint_fnc=entry_point))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file livekit_plugins_difyai-1.2.3.tar.gz.
File metadata
- Download URL: livekit_plugins_difyai-1.2.3.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b3631d1e941329c78d8fb928bb37db9555d79836ea9d44d70656b1cdacade2dd
|
|
| MD5 |
690610fba7f50ee46eac6fcf8f1895a5
|
|
| BLAKE2b-256 |
8e6deb7a47c45a81f9d550a84d1e0bea08552aca212c27968ebb74c59ab850cc
|
File details
Details for the file livekit_plugins_difyai-1.2.3-py3-none-any.whl.
File metadata
- Download URL: livekit_plugins_difyai-1.2.3-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
599152ce0d39f6fe130e1caeadd4258f005e354272c59ffd9c0c9874621f9bc5
|
|
| MD5 |
ff21f68b091136e198b0f26ec5fa5ccd
|
|
| BLAKE2b-256 |
a366a89ff563ae9a30b43625b20998bb7640b98384a7e5e1eec879e9e6de3682
|