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

AttributeError: 'Room' object has no attribute 'local_participant' #538

Closed
willsmanley opened this issue Jul 27, 2024 · 3 comments
Closed

Comments

@willsmanley
Copy link

Suddenly getting this error when using livekit agents playground. Checked KITT and it too is not connecting, though I can't see the logs there. Maybe it's a problem with the playground side since it previously worked ok with my installed package versions and suddenly stopped working.

2024-07-26 23:19:51,505 - ERROR livekit.agents.voice_assistant - Error in _main_task
Traceback (most recent call last):
  File "/Users/user/livekit-issue-repro/venv/lib/python3.12/site-packages/livekit/agents/utils/log.py", line 16, in async_fn_logs
    return await fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/livekit-issue-repro/venv/lib/python3.12/site-packages/livekit/agents/voice_assistant/voice_assistant.py", line 366, in _main_task
    self._agent_publication = await self._room.local_participant.publish_track(
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Room' object has no attribute 'local_participant' {"pid": 12345, "job_id": "jobid"}

requirements.txt:

livekit==0.12.0.dev1
livekit-agents==0.8.0.dev8
livekit-plugins-openai==0.7.0.dev7
livekit-plugins-silero==0.6.0.dev7
asyncio
python-dotenv

main.py:

from dotenv import load_dotenv
load_dotenv('.env')
import asyncio
from livekit.agents import JobContext, WorkerOptions, cli
from livekit.agents.llm import ChatContext
from livekit.agents.voice_assistant import VoiceAssistant
from livekit.plugins import openai, silero

async def entrypoint(ctx: JobContext):
    initial_ctx = ChatContext().append(
        role="system",
        text="You are a voice assistant created by LiveKit. Use short and concise responses."
    )

    vad = silero.VAD.load(
        min_speech_duration=0.05,
        min_silence_duration=0.1,
        padding_duration=0.1,
        max_buffered_speech=60.0,
        activation_threshold=0.25,
        sample_rate=16000,
        force_cpu=True
    )

    assistant = VoiceAssistant(
        vad=vad,
        stt=openai.STT(),
        llm=openai.LLM(),
        tts=openai.TTS(),
        chat_ctx=initial_ctx,
    )

    assistant.start(ctx.room)

    await asyncio.sleep(1)
    await assistant.say("Hey, how can I help you today?", allow_interruptions=True)

if __name__ == "__main__":
    cli.run_app(WorkerOptions(entrypoint_fnc=entrypoint))
@willsmanley
Copy link
Author

more context: can't be a playground issue afaik. I also set up local playground and it looks like last commit was >1 week ago.

must be something on the livekit cloud side

@davidzhao
Copy link
Member

@willsmanley I think you are missing the explicit connect that's required in the latest version. see the example here for details.

the kitt demo is due to another issue. we are in the process of updating the examples and looks like there was a problem in that deployment.

@willsmanley
Copy link
Author

yep that fixed it! must have missed that with the new release. thanks again!

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

No branches or pull requests

2 participants