Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dify plugin #992

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Add dify plugin #992

wants to merge 3 commits into from

Conversation

sorphwer
Copy link

@sorphwer sorphwer commented Oct 28, 2024

Add Plugins to let Dify* be your LLM services in your agent.

*Dify is a platform that allows you to design an agentic workflow and publish it as an API services. This plugin implements LLM class and can be tired right now since I've uploaded the package in Pypi:

# pip install livekit-plugins-dify
from livekit.plugins import dify
agent = VoicePipelineAgent(
        vad=ctx.proc.userdata["vad"],
        stt=deepgram.STT(model=dg_model),
        llm=dify.LLM(
            base_url="Your Dify API URL",
            api_key="Your App key",
        ),
        tts=openai.TTS()
        chat_ctx=initial_ctx,
    )

Copy link

changeset-bot bot commented Oct 28, 2024

⚠️ No Changeset found

Latest commit: 898c02a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@CLAassistant
Copy link

CLAassistant commented Oct 28, 2024

CLA assistant check
All committers have signed the CLA.

@sorphwer
Copy link
Author

@davidzhao Sorry for bothering, I wonder if any @livekit members coud be able to review this or just comment this :)

@davidzhao
Copy link
Member

davidzhao commented Nov 11, 2024

Hi @sorphwer, thank you for the PR. While the PR looks fine, it's difficult for us to keep up with maintaining plugins for all sorts of services.

I would suggest putting this plugin in your own repo, release to Pypi, and letting us know so we can link to it in our integrations section.

@sorphwer
Copy link
Author

@davidzhao Thanks for your reply! Actually this has been released to Pypi → https://pypi.org/project/livekit-plugins-dify/

@davidzhao
Copy link
Member

fantastic! though it'd be great if this is not in the livekit. package, to correctly distinguish official plugins from third-party.

@ramishi
Copy link

ramishi commented Dec 16, 2024

@sorphwer can you please also add an example on how to use it? I tired your plugin but run into error.

@sorphwer
Copy link
Author

@sorphwer can you please also add an example on how to use it? I tired your plugin but run into error.

@sorphwer can you please also add an example on how to use it? I tired your plugin but run into error.

You can find the minimal example in it’s pypi page https://pypi.org/project/livekit-plugins-dify/

Or you can share the error log I’d love to help

@ramishi
Copy link

ramishi commented Dec 17, 2024

@sorphwer I got this error when using your plugin the Voice Assistant template.

2024-12-16 22:01:23,081 - ERROR livekit.agents - unhandled exception while running the job task
Traceback (most recent call last):
File "/Users/sample/agent.py", line 64, in entrypoint
assistant.start(ctx.room, participant)
File "/Users/sample/.conda/lib/python3.12/site-packages/livekit/agents/pipeline/pipeline_agent.py", line 373, in start
@self._llm.on("metrics_collected")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/sample/.conda/lib/python3.12/site-packages/livekit/rtc/event_emitter.py", line 172, in decorator
self.on(event, callback)
File "/Users/sample/.conda/lib/python3.12/site-packages/livekit/rtc/event_emitter.py", line 165, in on
if event not in self._events:
^^^^^^^^^^^^
AttributeError: 'LLM' object has no attribute '_events' {"pid": 70342, "job_id": "AJ_BFNuGFj4oXXn"}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants