I'm getting a warning using the noise_cancellation...
# ask-ai
g
I'm getting a warning using the noise_cancellation.BVCTelephony() plugin. Here is my setup, but I'm getting this error: Expected type 'NoiseCancellationOptions | None', got 'BVCTelephony' instead
Copy code
if is_text_only:
        # Text-only participant: enable text, disable audio
        room_input_options = RoomInputOptions(text_enabled=True)
        room_output_options = RoomOutputOptions(audio_enabled=False)
    else:
        # Voice participant: enable audio, enable text
        room_input_options = RoomInputOptions(
            noise_cancellation=noise_cancellation.BVCTelephony(),
            pre_connect_audio=True,
            text_enabled=True,
            audio_enabled=True,
        )
        room_output_options = RoomOutputOptions(audio_enabled=True)
t
Thanks for reaching out, Brandon. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
r
Did you import
from livekit.plugins import noise_cancellation
? The
BVCTelephony()
instance you're creating should be compatible with
rtc.NoiseCancellationOptions
. This type mismatch warning might be due to: 1. Import issues: Ensure you're importing the noise cancellation module correctly 2. Type checker configuration: Your IDE or type checker might not be recognizing the inheritance relationship 3. Version mismatch: There might be a version incompatibility between your type definitions and runtime To resolve this, verify your imports and ensure you're using compatible versions of the LiveKit agents library. The pattern you're using matches the established examples in the codebase, so this appears to be a type annotation issue rather than a functional problem.
g
Yes. Everything is imported correctly. I am using PyCharm and I've encountered type warnings like this before with this IDE. I'll write off my issue as being just that. Thanks for the help!
r
oh, I see. I thought you were talking about a runtime warning.
Yea, I've seen some other have PyCharm reported warnings. I've not tried pycharm for a couple of years so I am not sure.
👍 1
Just tried in pycharm and I do not see that warning. I am running
Copy code
pip freeze |grep livekit

livekit==1.0.12
livekit-agents==1.2.4
livekit-api==1.0.5
livekit-blingfire==1.0.0
livekit-plugins-bey==1.2.4
livekit-plugins-bithuman==1.2.4
livekit-plugins-cartesia==1.2.4
livekit-plugins-deepgram==1.2.4
livekit-plugins-elevenlabs==1.2.4
livekit-plugins-google==1.2.4
livekit-plugins-groq==1.2.4
livekit-plugins-noise-cancellation==0.2.5
livekit-plugins-openai==1.2.4
livekit-plugins-rime==1.2.4
livekit-plugins-silero==1.2.4
livekit-plugins-speechmatics==1.2.4
livekit-plugins-tavus==1.2.4
livekit-plugins-turn-detector==1.2.4
livekit-protocol==1.0.5
g
I just ran:
Copy code
pip freeze > requirements.txt
Turns out my packages were a bit outdated. I'm on the newest versions for everything now. Just updated and the warning went away and noise cancellation improved. I apologize for the miscommunication and I appreciate the help.
👍 1