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

# Migrate Stream Client

> Migrate real-time prediction logging from the v7 Stream Client to the v8 unified ArizeClient.

The Stream Client is used for real-time logging of model predictions, providing lower latency than batch logging.

<CodeGroup>
  ```python Version 7 theme={null}
  from arize.api import Client
  client = Client(...)
  ```

  ```python Version 8 theme={null}
  from arize import ArizeClient
  client = ArizeClient(...)
  ```
</CodeGroup>

## log()

The `log()` method migrates from `client.log()` to `client.ml.log_stream()`.

### Parameter Reference

This table provides a complete mapping of all parameters between v7 and v8, including which parameters were removed, renamed, or remain unchanged.

| Parameter                 | v7          | v8                    | Changes                           |
| ------------------------- | ----------- | --------------------- | --------------------------------- |
| `space_id`                | Client init | **Required** per call | Must pass explicitly              |
| `model_id`                | Required    | Required              | Renamed to `model_name`           |
| `model_type`              | Required    | Required              | --                                |
| `environment`             | Required    | Required              | --                                |
| `model_version`           | Optional    | Optional              | --                                |
| `prediction_id`           | Optional    | Optional              | --                                |
| `prediction_timestamp`    | Optional    | Optional              | --                                |
| `prediction_label`        | Optional    | Optional              | --                                |
| `actual_label`            | Optional    | Optional              | --                                |
| `features`                | Optional    | Optional              | --                                |
| `embedding_features`      | Optional    | Optional              | --                                |
| `shap_values`             | Optional    | Optional              | --                                |
| `tags`                    | Optional    | Optional              | --                                |
| `batch_id`                | Optional    | Optional              | --                                |
| `prompt`                  | Optional    | Optional              | --                                |
| `response`                | Optional    | Optional              | --                                |
| `prompt_template`         | Optional    | Optional              | --                                |
| `prompt_template_version` | Optional    | Optional              | --                                |
| `llm_model_name`          | Optional    | Optional              | --                                |
| `llm_params`              | Optional    | Optional              | --                                |
| `llm_run_metadata`        | Optional    | Optional              | --                                |
| `timeout`                 | N/A         | ✅ Optional            | New parameter for request timeout |

### Side-by-Side Comparison

See the complete migration in action with this example showing both client initialization and streaming model predictions.

<CodeGroup>
  ```python Version 7 theme={null}
  from arize.api import Client
  from arize.utils.types import Environments, ModelTypes

  # Client initialization
  client = Client(
      api_key="your-api-key",
      space_id="your-space-id"
  )

  # Streaming a prediction
  future = client.log(
      model_id="my-model",
      model_type=ModelTypes.BINARY_CLASSIFICATION,
      environment=Environments.PRODUCTION,
      model_version="v1.0",
      prediction_id="pred-123",
      prediction_timestamp=1609459200,
      prediction_label=1,
      features={"feature1": 0.5, "feature2": "value"},
      tags={"user_id": "user-456"},
      batch_id="batch-789"
  )

  # Get the result (blocks until complete)
  response = future.result()
  ```

  ```python Version 8 theme={null}
  from arize import ArizeClient
  from arize.ml.types import Environments, ModelTypes

  # Client initialization
  client = ArizeClient(api_key="your-api-key")

  # Streaming a prediction
  future = client.ml.log_stream(
      space_id="your-space-id",  # Now required per call
      model_name="my-model",  # Renamed from model_id
      model_type=ModelTypes.BINARY_CLASSIFICATION,
      environment=Environments.PRODUCTION,
      model_version="v1.0",
      prediction_id="pred-123",
      prediction_timestamp=1609459200,
      prediction_label=1,
      features={"feature1": 0.5, "feature2": "value"},
      tags={"user_id": "user-456"},
      batch_id="batch-789",
      timeout=30.0  # Optional, new parameter
  )

  # Get the result (blocks until complete)
  response = future.result()
  ```
</CodeGroup>
