Skip to main content

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


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_difyai-1.0.23.tar.gz (6.0 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_difyai-1.0.23-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file livekit_plugins_difyai-1.0.23.tar.gz.

File metadata

File hashes

Hashes for livekit_plugins_difyai-1.0.23.tar.gz
Algorithm Hash digest
SHA256 4128cbfa21a8157ff0e89f1a9d9ee1684db3504b154200e049a8db21e83e93e6
MD5 4c8e682ac8439c23d05a5845bc3609a0
BLAKE2b-256 3743f9189b23595b85064a5fe7cd37e668c77ca659c29380aedd3ece4e7c9288

See more details on using hashes here.

File details

Details for the file livekit_plugins_difyai-1.0.23-py3-none-any.whl.

File metadata

File hashes

Hashes for livekit_plugins_difyai-1.0.23-py3-none-any.whl
Algorithm Hash digest
SHA256 d16a981710f223e33cfbd237194c74cbc9cadf80cfa955d2f88525ef30821163
MD5 8727fc150bb7285d91eeaa5f2f9ed3a0
BLAKE2b-256 6ce607b7bfb55c514b7373ca41baf28bee08c05cd269b9d7791f2899747cbbae

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