> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fiddler.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Streaming Live Events

> Learn how to stream your ML model's inference event data using the Fiddler Python client.

You can stream production data to Fiddler as an alternative to batch publishing. Streaming offers lower latency, which is beneficial for high-velocity or near real-time models.

### When to Use Streaming vs. Batch Publishing

* Use `Model.publish_stream()` when low latency is a priority and you're working with individual events or small batches
* Use `Model.publish_batch()` for large datasets or when you need to track longer-running processes with Job objects

#### Stream Individual Inference Events

To stream a single inference event:

```python theme={null}
project = fdl.Project.from_name(name='your_project_name')
model = fdl.Model.from_name(name='your_model_name', project_id=project.id)

# A single event must still be passed as a list.
model.publish_stream(events=[
    {
        'customer_id': 1234,
        'timestamp': 1710428785,
        'CreditScore': 650,
        'Geography': 'France',
        'Gender': 'Female',
        'Age': 45,
        'Tenure': 2,
        'Balance': 10000.0,
        'NumOfProducts': 1,
        'HasCrCard': 'Yes',
        'isActiveMember': 'Yes',
        'EstimatedSalary': 120000,
        'probability_churned': 0.105,
        'churn': 1
    }
])
```

#### Stream Small Batches of Events

For better efficiency, you can stream multiple events at once:

```python theme={null}
# For multiple events, where `my_events` is a list of Python dictionaries
model.publish_stream(events=my_events)
```

> 🚧 Note
>
> Convert a pandas DataFrame to a list of event dictionaries using the to\_dict function.

```python theme={null}
my_events = my_df.to_dict(orient='records')
```

For batches larger than 5,000 events, prefer [`Model.publish_batch()`](/developers/python-client-guides/publishing-production-data/publishing-batches-of-events) over streaming.
