{"id":8773,"library":"webrtc-models","title":"Python WebRTC Models","description":"A Python library providing lightweight models designed for analyzing WebRTC statistics. It helps estimate quality of experience, predict network congestion, and perform other related tasks using simple prediction models. Currently at version 0.3.0, it follows a feature-driven release cadence, with updates for new models or API refinements.","status":"active","version":"0.3.0","language":"en","source_language":"en","source_url":"https://github.com/daily-co/webrtc-models","tags":["webrtc","machine-learning","prediction","audio","video","network-monitoring"],"install":[{"cmd":"pip install webrtc-models","lang":"bash","label":"Install latest version"}],"dependencies":[],"imports":[{"symbol":"PacketLossPredictor","correct":"from webrtc_models import PacketLossPredictor"},{"symbol":"BandwidthPredictor","correct":"from webrtc_models import BandwidthPredictor"},{"symbol":"QoEPredictor","correct":"from webrtc_models import QoEPredictor"}],"quickstart":{"code":"from webrtc_models import PacketLossPredictor\n\n# Initialize the predictor model\npredictor = PacketLossPredictor()\n\n# Prepare features as a dictionary\n# (Note: Specific keys are required by each model)\nfeatures = {\n    'inbound_rtp_packets_lost': 0,\n    'inbound_rtp_packets_received': 100\n}\n\n# Make a prediction\nprediction = predictor.predict(features)\n\nprint(f\"Predicted packet loss: {prediction}\")","lang":"python","description":"Demonstrates how to import a model, initialize it, provide input features as a dictionary, and get a prediction."},"warnings":[{"fix":"Update calls to `predict` to pass a single dictionary of features instead of individual keyword arguments. For example, change `predictor.predict(arg1=val1, arg2=val2)` to `predictor.predict({'arg1': val1, 'arg2': val2})`.","message":"The `predict` method for all models (e.g., `PacketLossPredictor`, `BandwidthPredictor`, `QoEPredictor`) changed its signature in version 0.3.0.","severity":"breaking","affected_versions":"0.3.0 and later"},{"fix":"Refer to the model's documentation or the library's source code for the exact feature keys required (e.g., `inbound_rtp_packets_lost`, `inbound_rtp_packets_received` for `PacketLossPredictor`).","message":"Models expect specific feature keys in the input dictionary passed to the `predict` method. Missing or misspelled keys will raise a `KeyError`.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure your environment is running Python 3.12.0 or higher. Use `python --version` to check and upgrade if necessary, or activate a suitable virtual environment.","message":"The `webrtc-models` library explicitly requires Python 3.12 or newer.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Pass a dictionary of features instead: `predictor.predict({'inbound_rtp_packets_lost': 0, 'inbound_rtp_packets_received': 100})`.","cause":"The `predict` method signature changed in version 0.3.0 from accepting keyword arguments to a single dictionary.","error":"TypeError: PacketLossPredictor.predict() got an unexpected keyword argument 'inbound_rtp_packets_lost'"},{"fix":"Provide all necessary feature keys as defined by the model. Check the model's documentation or the library's source for required keys (e.g., in the `__init__` or `predict` method definitions).","cause":"The input dictionary to `predict` is missing a required feature key or has a misspelled key for the specific model being used.","error":"KeyError: 'some_missing_feature'"},{"fix":"Install the library using `pip install webrtc-models`. Ensure your Python environment is correctly activated.","cause":"The `webrtc-models` library is not installed in the current Python environment.","error":"ModuleNotFoundError: No module named 'webrtc_models'"},{"fix":"Import specific model classes directly from the `webrtc_models` package (e.g., `from webrtc_models import PacketLossPredictor`). Do not try to import submodules like `webrtc_models.models`.","cause":"Attempting to import an internal module or a non-existent symbol directly from the top-level `webrtc_models` package.","error":"ImportError: cannot import name 'models' from 'webrtc_models'"}]}