You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

livekit-plugins-difyai

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

livekit-plugins-difyai

LiveKit Agent Plugins for Dify

1.2.0
pipPyPI
Maintainers
1

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))

Keywords

audio

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts