how can I init VadStream class when using: proc.us...
# ask-ai
b
how can I init VadStream class when using: proc.userdata["vad"] = silero.VAD.load()? it says I need the opts and model
t
Thanks for reaching out, Jacob. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I see you’re trying to initialize a VadStream but are getting a message that
opts
and
model
are required. You don’t need to construct
VadStream
yourself when using the Silero VAD integration. What to do instead • Use
silero.VAD.load()
— it loads the pre-trained model and configures the required options for you. • Pass the loaded VAD instance directly where it’s expected (for example into
AgentSession
or your processor userdata). Example patterns 1) Pass VAD into your session/processor:
Copy code
proc.userdata["vad"] = silero.VAD.load()  # loads model + opts automatically

session = AgentSession(
    vad=proc.userdata["vad"],
    # ... other parameters
)
2) If you need a stream object, get it from the VAD instance rather than instantiating
VadStream
manually:
Copy code
vad = silero.VAD.load()
vad_stream = vad.stream()  # creates the VadStream with the correct opts and model
Why this is preferred • Manual construction like
VadStream(opts=..., model=...)
is not the recommended pattern and isn’t documented for normal use. •
silero.VAD.load()
and
vad.stream()
handle the internal wiring so you don’t have to supply
opts
and
model
yourself. If you’re still seeing an error after doing this, could you share the exact error text and the small code snippet where you call
silero.VAD.load()
and where you try to use the stream? That will help me pinpoint what’s going wrong. Sources: Silero VAD plugin | LiveKit Documentation | Speech-to-text (STT) models overview | LiveKit Documentation
b
how does it know to use the loaded model?
t
Great question — you’re asking how the code “knows” to use the loaded model when you call
silero.VAD.load()
and then use a stream or pass the VAD instance elsewhere. Short answer •
silero.VAD.load()
builds and returns a VAD instance that contains the pre-loaded model and its configuration (
opts
). VadStream does not need those parameters passed explicitly because it is created from that VAD instance, and it reads the
model
and
opts
from the instance itself. How that works (conceptually) •
silero.VAD.load()
performs the model-loading steps and stores the resulting objects inside the returned VAD object (for example as attributes like
model
and
opts
). • When you call
vad.stream()
(or when the plugin internally constructs a VadStream using the VAD instance), the stream initializer pulls
model
and
opts
from the VAD instance instead of expecting them as separate arguments. • Passing the VAD instance around (for example
vad=proc.userdata["vad"]
or into
AgentSession
) ensures any downstream code can access the same
model
and
opts
via that VAD object. Why you don’t need to pass
opts
and
model
manually • The VAD instance is the single source of truth for VAD configuration and the loaded model. Creating a stream or using the VAD functionality always uses that instance’s attributes, so manual wiring isn’t required and avoids mismatches between model/config and stream. If you want to verify this in your environment • After
vad = silero.VAD.load()
, you can inspect the
vad
object to see stored attributes (for example
print(dir(vad))
or
print(vad.model)
/
print(vad.opts)
) to confirm the model and options are present. • Or create a stream with
vad_stream = vad.stream()
and check that the stream references the same model (e.g.,
vad_stream.model is vad.model
), which proves it’s reusing the loaded model. If you’d like, share the small snippet where you load the VAD and create the stream/session and I’ll point out exactly where the model and opts are stored and used.
b
TypeError: VADStream.__init__() missing 3 required positional arguments: 'vad', 'opts', and 'model' {"pid": 143971, "job_id": "AJ_MQbBmWz8snTW"}
t
Thanks — I can see you’re hitting a TypeError telling you VADStream.init is missing
vad
,
opts
, and
model
. That happens when something in your code is trying to instantiate VADStream directly instead of using the loaded VAD instance. What to do • Do not call
VADStream(...)
yourself. Use
silero.VAD.load()
to get the VAD instance, then get a stream from that instance with
vad.stream()
(or pass the VAD instance where required). Those methods automatically provide the
vad
,
opts
, and
model
values the stream needs. Correct usage examples 1) Store/load and pass the VAD instance:
Copy code
proc.userdata["vad"] = silero.VAD.load()

session = AgentSession(
    vad=proc.userdata["vad"],
    # ...
)
2) Create a VadStream from the VAD instance:
Copy code
vad = silero.VAD.load()
vad_stream = vad.stream()   # creates VADStream with correct vad, opts, model
Why the error appears • The error means some code path is directly calling
VADStream(...)
without supplying the required positional arguments. The intended pattern is that
vad.stream()
(or the plugin internals) construct the VADStream while pulling
model
and
opts
from the VAD object you loaded. If you still see the error • Please paste the small snippet where you load the VAD and where the error is raised (include the few lines around the call that triggers the TypeError and the stack trace). I’ll point out exactly which call is creating the VADStream incorrectly and show the minimal fix.