CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-mlflow

MLflow is an open source platform for the complete machine learning lifecycle

Pending
Overview
Eval results
Files

client.mddocs/

Client API

MLflow's Client API provides low-level programmatic access to MLflow's REST API for managing experiments, runs, model registry, and artifacts. The MlflowClient class offers comprehensive methods for tracking, model management, and artifact storage with fine-grained control over MLflow operations.

Capabilities

Client Initialization

Core client class for direct API access to MLflow tracking and model registry servers with support for different backend stores.

class MlflowClient:
    def __init__(self, tracking_uri=None, registry_uri=None):
        """
        Initialize MLflow client.
        
        Parameters:
        - tracking_uri: str, optional - Address of tracking server
        - registry_uri: str, optional - Address of model registry server
        
        Returns:
        MlflowClient instance
        """

Experiment Management

Methods for creating, managing, and searching experiments with comprehensive filtering and organization capabilities.

def create_experiment(self, name, artifact_location=None, tags=None):
    """
    Create a new experiment.
    
    Parameters:
    - name: str - Unique experiment name
    - artifact_location: str, optional - Location to store artifacts
    - tags: dict, optional - Dictionary of experiment tags
    
    Returns:
    str - Experiment ID
    """

def get_experiment(self, experiment_id):
    """
    Retrieve experiment by ID.
    
    Parameters:
    - experiment_id: str - The experiment ID
    
    Returns:
    Experiment object
    """

def get_experiment_by_name(self, name):
    """
    Retrieve experiment by name.
    
    Parameters:
    - name: str - The experiment name (case sensitive)
    
    Returns:
    Experiment object or None if not found
    """

def search_experiments(self, view_type=ViewType.ACTIVE_ONLY, max_results=None, filter_string=None, order_by=None, page_token=None):
    """
    Search experiments matching criteria.
    
    Parameters:
    - view_type: ViewType - Type of experiments to return
    - max_results: int, optional - Maximum number of experiments
    - filter_string: str, optional - Filter expression
    - order_by: list, optional - List of columns to order by
    - page_token: str, optional - Token for pagination
    
    Returns:
    PagedList of Experiment objects
    """

def delete_experiment(self, experiment_id):
    """
    Delete an experiment (soft delete).
    
    Parameters:
    - experiment_id: str - The experiment ID to delete
    """

def restore_experiment(self, experiment_id):
    """
    Restore a deleted experiment.
    
    Parameters:
    - experiment_id: str - The experiment ID to restore
    """

def rename_experiment(self, experiment_id, new_name):
    """
    Update experiment name.
    
    Parameters:
    - experiment_id: str - The experiment ID
    - new_name: str - New unique name for the experiment
    """

Run Management

Methods for creating, updating, and managing individual runs with comprehensive metadata and lifecycle control.

def create_run(self, experiment_id, start_time=None, tags=None, run_name=None):
    """
    Create a new run.
    
    Parameters:
    - experiment_id: str - The experiment ID
    - start_time: int, optional - Unix timestamp of run start
    - tags: dict, optional - Dictionary of run tags
    - run_name: str, optional - Human-readable run name
    
    Returns:
    Run object representing the created run
    """

def get_run(self, run_id):
    """
    Fetch run from backend store.
    
    Parameters:
    - run_id: str - Unique run identifier
    
    Returns:
    Run object with metadata and data
    """

def update_run(self, run_id, status=None, name=None):
    """
    Update run status or name.
    
    Parameters:
    - run_id: str - The run ID to update
    - status: str, optional - New run status
    - name: str, optional - New run name
    """

def delete_run(self, run_id):
    """
    Delete a run (soft delete).
    
    Parameters:
    - run_id: str - The run ID to delete
    """

def restore_run(self, run_id):
    """
    Restore a deleted run.
    
    Parameters:
    - run_id: str - The run ID to restore
    """

def search_runs(self, experiment_ids, filter_string="", run_view_type=ViewType.ACTIVE_ONLY, max_results=SEARCH_MAX_RESULTS_DEFAULT, order_by=None, page_token=None):
    """
    Search for runs matching criteria.
    
    Parameters:
    - experiment_ids: list - List of experiment IDs to search
    - filter_string: str - Filter expression for runs
    - run_view_type: ViewType - Type of runs to return
    - max_results: int - Maximum number of runs
    - order_by: list, optional - Columns to order by
    - page_token: str, optional - Pagination token
    
    Returns:
    PagedList of Run objects
    """

def set_terminated(self, run_id, status=None, end_time=None):
    """
    Set run status to terminated.
    
    Parameters:
    - run_id: str - The run ID to terminate
    - status: str, optional - Final status (defaults to FINISHED)
    - end_time: int, optional - Unix timestamp of completion
    """

def get_parent_run(self, run_id):
    """
    Get parent run for nested run.
    
    Parameters:
    - run_id: str - Child run ID
    
    Returns:
    Run object of parent or None if not nested
    """

Logging Operations

Methods for logging parameters, metrics, artifacts, and other run data with support for batch operations and async logging.

def log_param(self, run_id, key, value, synchronous=None):
    """
    Log a parameter for a run.
    
    Parameters:
    - run_id: str - The run ID
    - key: str - Parameter name
    - value: Any - Parameter value (converted to string)
    - synchronous: bool, optional - Whether to log synchronously
    
    Returns:
    Parameter value when synchronous, RunOperations when async
    """

def log_metric(self, run_id, key, value, timestamp=None, step=None, synchronous=None, dataset_name=None, dataset_digest=None, model_id=None):
    """
    Log a metric for a run.
    
    Parameters:
    - run_id: str - The run ID
    - key: str - Metric name
    - value: float - Metric value
    - timestamp: int, optional - Unix timestamp in milliseconds
    - step: int, optional - Training step number
    - synchronous: bool, optional - Whether to log synchronously
    - dataset_name: str, optional - Associated dataset name
    - dataset_digest: str, optional - Associated dataset digest
    - model_id: str, optional - Associated model ID
    
    Returns:
    None when synchronous, RunOperations when async
    """

def log_batch(self, run_id, metrics=(), params=(), tags=(), synchronous=None):
    """
    Log multiple metrics, params, and tags.
    
    Parameters:
    - run_id: str - The run ID
    - metrics: Sequence[Metric] - List of Metric objects
    - params: Sequence[Param] - List of Param objects
    - tags: Sequence[RunTag] - List of RunTag objects
    - synchronous: bool, optional - Whether to log synchronously
    
    Returns:
    None when synchronous, RunOperations when async
    """

def get_metric_history(self, run_id, key):
    """
    Get history of a metric across steps.
    
    Parameters:
    - run_id: str - The run ID
    - key: str - Metric name
    
    Returns:
    List of Metric objects with historical values
    """

Artifact Management

Methods for uploading, downloading, and managing artifacts with support for various storage backends.

def log_artifact(self, run_id, local_path, artifact_path=None):
    """
    Log a file as an artifact.
    
    Parameters:
    - run_id: str - The run ID
    - local_path: str - Local file path
    - artifact_path: str, optional - Relative path in artifact store
    """

def log_artifacts(self, run_id, local_dir, artifact_path=None):
    """
    Log directory of files as artifacts.
    
    Parameters:
    - run_id: str - The run ID
    - local_dir: str - Local directory path
    - artifact_path: str, optional - Relative path in artifact store
    """

def log_text(self, run_id, text, artifact_file):
    """
    Log text content as an artifact.
    
    Parameters:
    - run_id: str - The run ID
    - text: str - Text content to log
    - artifact_file: str - Artifact file path
    """

def log_dict(self, run_id, dictionary, artifact_file):
    """
    Log dictionary as JSON/YAML artifact.
    
    Parameters:
    - run_id: str - The run ID
    - dictionary: dict - Dictionary to log
    - artifact_file: str - Artifact file path (determines format)
    """

def log_figure(self, run_id, figure, artifact_file, save_kwargs=None):
    """
    Log matplotlib or plotly figure as artifact.
    
    Parameters:
    - run_id: str - The run ID
    - figure: Figure - Matplotlib or plotly figure object
    - artifact_file: str - Artifact file path
    - save_kwargs: dict, optional - Additional save arguments
    """

def log_image(self, run_id, image, artifact_file=None, key=None, step=None, timestamp=None, synchronous=None):
    """
    Log image as artifact or time-series data.
    
    Parameters:
    - run_id: str - The run ID
    - image: Image - PIL Image, numpy array, or mlflow.Image
    - artifact_file: str, optional - For static artifact logging
    - key: str, optional - For time-series image logging
    - step: int, optional - Training step number
    - timestamp: int, optional - Unix timestamp in milliseconds
    - synchronous: bool, optional - Whether to log synchronously
    """

def log_table(self, run_id, data, artifact_file):
    """
    Log tabular data as artifact.
    
    Parameters:
    - run_id: str - The run ID
    - data: DataFrame or dict - Tabular data to log
    - artifact_file: str - Artifact file path (.json or .parquet)
    """

def list_artifacts(self, run_id, path=None):
    """
    List artifacts for a run.
    
    Parameters:
    - run_id: str - The run ID
    - path: str, optional - Relative path within artifacts
    
    Returns:
    List of FileInfo objects
    """

def download_artifacts(self, run_id, path, dst_path=None):
    """
    Download artifacts from a run.
    
    Parameters:
    - run_id: str - The run ID
    - path: str - Relative source path to artifact
    - dst_path: str, optional - Local destination directory
    
    Returns:
    str - Local path to downloaded artifacts
    """

def load_table(self, experiment_id, artifact_file, run_ids=None, extra_columns=None):
    """
    Load table artifact from multiple runs.
    
    Parameters:
    - experiment_id: str - Experiment ID to search
    - artifact_file: str - Artifact file path
    - run_ids: list, optional - Specific run IDs to load from
    - extra_columns: list, optional - Additional columns to append
    
    Returns:
    pandas.DataFrame - Combined table data
    """

Tagging Operations

Methods for managing tags on runs and experiments for organization and metadata purposes.

def set_tag(self, run_id, key, value, synchronous=None):
    """
    Set tag on a run.
    
    Parameters:
    - run_id: str - The run ID
    - key: str - Tag key (max 250 chars)
    - value: Any - Tag value (converted to string, max 5000 chars)
    - synchronous: bool, optional - Whether to set synchronously
    
    Returns:
    None when synchronous, RunOperations when async
    """

def delete_tag(self, run_id, key):
    """
    Delete tag from a run.
    
    Parameters:
    - run_id: str - The run ID
    - key: str - Tag key to delete
    """

def set_experiment_tag(self, experiment_id, key, value):
    """
    Set tag on an experiment.
    
    Parameters:
    - experiment_id: str - The experiment ID
    - key: str - Tag key
    - value: Any - Tag value (converted to string)
    """

def delete_experiment_tag(self, experiment_id, key):
    """
    Delete tag from an experiment.
    
    Parameters:
    - experiment_id: str - The experiment ID
    - key: str - Tag key to delete
    """

Model Registry Operations

Methods for managing registered models and model versions in the MLflow Model Registry.

def create_registered_model(self, name, tags=None, description=None, deployment_job_id=None):
    """
    Create a new registered model.
    
    Parameters:
    - name: str - Unique model name
    - tags: dict, optional - Model tags
    - description: str, optional - Model description
    - deployment_job_id: str, optional - Deployment job ID
    
    Returns:
    RegisteredModel object
    """

def get_registered_model(self, name):
    """
    Get registered model by name.
    
    Parameters:
    - name: str - Registered model name
    
    Returns:
    RegisteredModel object
    """

def update_registered_model(self, name, description=None, deployment_job_id=None):
    """
    Update registered model metadata.
    
    Parameters:
    - name: str - Registered model name
    - description: str, optional - New description
    - deployment_job_id: str, optional - New deployment job ID
    
    Returns:
    RegisteredModel object
    """

def rename_registered_model(self, name, new_name):
    """
    Rename a registered model.
    
    Parameters:
    - name: str - Current model name
    - new_name: str - New unique model name
    
    Returns:
    RegisteredModel object
    """

def delete_registered_model(self, name):
    """
    Delete a registered model.
    
    Parameters:
    - name: str - Registered model name to delete
    """

def search_registered_models(self, filter_string=None, max_results=SEARCH_REGISTERED_MODEL_MAX_RESULTS_DEFAULT, order_by=None, page_token=None):
    """
    Search registered models.
    
    Parameters:
    - filter_string: str, optional - Filter expression
    - max_results: int - Maximum number of models
    - order_by: list, optional - Columns to order by
    - page_token: str, optional - Pagination token
    
    Returns:
    PagedList of RegisteredModel objects
    """

def create_model_version(self, name, source, run_id=None, tags=None, run_link=None, description=None, await_creation_for=DEFAULT_AWAIT_MAX_SLEEP_SECONDS, model_id=None):
    """
    Create new model version from source.
    
    Parameters:
    - name: str - Registered model name
    - source: str - Model artifact URI
    - run_id: str, optional - Source run ID
    - tags: dict, optional - Model version tags
    - run_link: str, optional - Link to source run
    - description: str, optional - Version description
    - await_creation_for: int - Seconds to wait for creation
    - model_id: str, optional - Source model ID
    
    Returns:
    ModelVersion object
    """

def get_model_version(self, name, version):
    """
    Get model version by name and version.
    
    Parameters:
    - name: str - Registered model name
    - version: str - Model version number
    
    Returns:
    ModelVersion object
    """

def update_model_version(self, name, version, description=None):
    """
    Update model version metadata.
    
    Parameters:
    - name: str - Registered model name
    - version: str - Model version number
    - description: str, optional - New description
    
    Returns:
    ModelVersion object
    """

def delete_model_version(self, name, version):
    """
    Delete a model version.
    
    Parameters:
    - name: str - Registered model name
    - version: str - Model version to delete
    """

def get_model_version_download_uri(self, name, version):
    """
    Get download URI for model version.
    
    Parameters:
    - name: str - Registered model name
    - version: str - Model version number
    
    Returns:
    str - Download URI for model artifacts
    """

def search_model_versions(self, filter_string=None, max_results=SEARCH_MODEL_VERSION_MAX_RESULTS_DEFAULT, order_by=None, page_token=None):
    """
    Search model versions.
    
    Parameters:
    - filter_string: str, optional - Filter expression
    - max_results: int - Maximum number of versions
    - order_by: list, optional - Columns to order by
    - page_token: str, optional - Pagination token
    
    Returns:
    PagedList of ModelVersion objects
    """

def copy_model_version(self, src_model_uri, dst_name):
    """
    Copy model version to new registered model.
    
    Parameters:
    - src_model_uri: str - Source model URI (models:/ scheme)
    - dst_name: str - Destination registered model name
    
    Returns:
    ModelVersion object representing copied version
    """

Model Aliasing

Methods for managing model aliases for flexible model referencing and deployment workflows.

def set_registered_model_alias(self, name, alias, version):
    """
    Set alias for registered model version.
    
    Parameters:
    - name: str - Registered model name
    - alias: str - Alias name (cannot be v<number> format)
    - version: str - Model version number
    """

def delete_registered_model_alias(self, name, alias):
    """
    Delete registered model alias.
    
    Parameters:
    - name: str - Registered model name
    - alias: str - Alias name to delete
    """

def get_model_version_by_alias(self, name, alias):
    """
    Get model version by alias.
    
    Parameters:
    - name: str - Registered model name
    - alias: str - Alias name
    
    Returns:
    ModelVersion object
    """

Tracing Operations

Methods for managing distributed traces and spans for LLM/GenAI application observability.

def start_trace(self, name, span_type=SpanType.UNKNOWN, inputs=None, attributes=None, tags=None, experiment_id=None, start_time_ns=None):
    """
    Create new trace and start root span.
    
    Parameters:
    - name: str - Trace and root span name
    - span_type: str - Type of span
    - inputs: Any, optional - Inputs to set on root span
    - attributes: dict, optional - Span attributes
    - tags: dict, optional - Trace tags
    - experiment_id: str, optional - Experiment ID for trace
    - start_time_ns: int, optional - Start time in nanoseconds
    
    Returns:
    Span object representing root span
    """

def end_trace(self, trace_id, outputs=None, attributes=None, status="OK", end_time_ns=None):
    """
    End trace and log to backend.
    
    Parameters:
    - trace_id: str - Trace ID to end
    - outputs: Any, optional - Trace outputs
    - attributes: dict, optional - Additional attributes
    - status: SpanStatus or str - Final status
    - end_time_ns: int, optional - End time in nanoseconds
    """

def start_span(self, name, trace_id, parent_id, span_type=SpanType.UNKNOWN, inputs=None, attributes=None, start_time_ns=None):
    """
    Create and start new span under trace.
    
    Parameters:
    - name: str - Span name
    - trace_id: str - Trace ID to attach span to
    - parent_id: str - Parent span ID
    - span_type: str - Type of span
    - inputs: Any, optional - Span inputs
    - attributes: dict, optional - Span attributes
    - start_time_ns: int, optional - Start time in nanoseconds
    
    Returns:
    Span object
    """

def end_span(self, trace_id, span_id, outputs=None, attributes=None, status="OK", end_time_ns=None):
    """
    End span with given IDs.
    
    Parameters:
    - trace_id: str - Trace ID
    - span_id: str - Span ID to end
    - outputs: Any, optional - Span outputs
    - attributes: dict, optional - Additional attributes
    - status: SpanStatus or str - Final status
    - end_time_ns: int, optional - End time in nanoseconds
    """

def get_trace(self, trace_id, display=True):
    """
    Get trace by ID.
    
    Parameters:
    - trace_id: str - Trace ID to fetch
    - display: bool - Whether to display in notebook
    
    Returns:
    Trace object
    """

def search_traces(self, experiment_ids, filter_string=None, max_results=SEARCH_TRACES_DEFAULT_MAX_RESULTS, order_by=None, page_token=None, run_id=None, include_spans=True, model_id=None, sql_warehouse_id=None):
    """
    Search traces matching criteria.
    
    Parameters:
    - experiment_ids: list - List of experiment IDs to search
    - filter_string: str, optional - Filter expression
    - max_results: int - Maximum number of traces
    - order_by: list, optional - Columns to order by
    - page_token: str, optional - Pagination token
    - run_id: str, optional - Associated run ID
    - include_spans: bool - Whether to include span data
    - model_id: str, optional - Associated model ID
    - sql_warehouse_id: str, optional - SQL warehouse for search
    
    Returns:
    PagedList of Trace objects
    """

def delete_traces(self, experiment_id, max_timestamp_millis=None, max_traces=None, trace_ids=None):
    """
    Delete traces based on criteria.
    
    Parameters:
    - experiment_id: str - Experiment ID for traces
    - max_timestamp_millis: int, optional - Maximum timestamp for deletion
    - max_traces: int, optional - Maximum number to delete
    - trace_ids: list, optional - Specific trace IDs to delete
    
    Returns:
    int - Number of traces deleted
    """

def set_trace_tag(self, trace_id, key, value):
    """
    Set tag on trace.
    
    Parameters:
    - trace_id: str - Trace ID
    - key: str - Tag key (max 250 chars)
    - value: str - Tag value (max 250 chars)
    """

def delete_trace_tag(self, trace_id, key):
    """
    Delete tag from trace.
    
    Parameters:
    - trace_id: str - Trace ID
    - key: str - Tag key to delete
    """

Usage Examples

Basic Client Operations

from mlflow import MlflowClient

# Initialize client with custom URIs
client = MlflowClient(
    tracking_uri="http://localhost:5000",
    registry_uri="sqlite:///mlflow_registry.db"
)

# Create experiment and run
experiment_id = client.create_experiment(
    name="client-api-experiment",
    tags={"project": "client-demo"}
)

run = client.create_run(
    experiment_id=experiment_id,
    run_name="client-demo-run"
)

# Log data to run
client.log_param(run.info.run_id, "learning_rate", 0.01)
client.log_metric(run.info.run_id, "accuracy", 0.95, step=10)

# Terminate run
client.set_terminated(run.info.run_id, status="FINISHED")

Model Registry Operations

from mlflow import MlflowClient

client = MlflowClient()

# Create registered model
model_name = "my-classification-model"
client.create_registered_model(
    name=model_name,
    description="Production classification model",
    tags={"team": "ml-platform"}
)

# Create model version from run
model_version = client.create_model_version(
    name=model_name,
    source=f"runs:/{run_id}/model",
    run_id=run_id,
    description="Initial model version"
)

# Set model alias
client.set_registered_model_alias(
    name=model_name,
    alias="champion",
    version=model_version.version
)

# Get model by alias
champion_model = client.get_model_version_by_alias(
    name=model_name,
    alias="champion"
)

Batch Logging Operations

from mlflow import MlflowClient
from mlflow.entities import Metric, Param, RunTag
import time

client = MlflowClient()

# Create run
run = client.create_run(experiment_id="0")

# Prepare batch data
timestamp = int(time.time() * 1000)
metrics = [
    Metric("accuracy", 0.95, timestamp, 1),
    Metric("precision", 0.92, timestamp, 1),
    Metric("recall", 0.88, timestamp, 1)
]
params = [
    Param("model_type", "random_forest"),
    Param("n_estimators", "100"),
    Param("max_depth", "10")
]
tags = [
    RunTag("experiment_type", "hyperparameter_tuning"),
    RunTag("framework", "scikit-learn")
]

# Log batch
client.log_batch(
    run_id=run.info.run_id,
    metrics=metrics,
    params=params,
    tags=tags
)

client.set_terminated(run.info.run_id)

Prompt Management

Client methods for managing prompts in the MLflow prompt registry with versioning, aliasing, and search capabilities.

def create_prompt(self, name, prompt, tags=None, description=None, metadata=None):
    """
    Create new prompt in registry.
    
    Parameters:
    - name: str - Unique prompt name
    - prompt: str - Prompt content or template
    - tags: dict, optional - Prompt tags
    - description: str, optional - Prompt description
    - metadata: dict, optional - Additional metadata
    
    Returns:
    Prompt object
    """

def get_prompt(self, name, version=None):
    """
    Get prompt by name and version.
    
    Parameters:
    - name: str - Prompt name
    - version: str or int, optional - Prompt version
    
    Returns:
    Prompt object
    """

def search_prompts(self, filter_string=None, max_results=None, order_by=None, page_token=None):
    """
    Search prompts with filtering.
    
    Parameters:
    - filter_string: str, optional - Filter expression
    - max_results: int, optional - Maximum results
    - order_by: list, optional - Sort order
    - page_token: str, optional - Pagination token
    
    Returns:
    PagedList of Prompt objects
    """

def register_prompt(self, prompt, name, version=None, tags=None, description=None, metadata=None):
    """
    Register prompt in registry.
    
    Parameters:
    - prompt: str - Prompt content
    - name: str - Prompt name  
    - version: str or int, optional - Version number
    - tags: dict, optional - Prompt tags
    - description: str, optional - Description
    - metadata: dict, optional - Additional metadata
    
    Returns:
    Prompt object
    """

Assessment and Feedback Management

Client methods for managing assessments and feedback on runs and traces.

def log_assessment(self, assessment, request_id=None, run_id=None, timestamp_ms=None):
    """
    Log assessment for run or trace.
    
    Parameters:
    - assessment: Assessment - Assessment object to log
    - request_id: str, optional - Trace request ID
    - run_id: str, optional - MLflow run ID  
    - timestamp_ms: int, optional - Assessment timestamp
    
    Returns:
    Assessment object
    """

def get_assessment(self, assessment_id):
    """
    Get assessment by ID.
    
    Parameters:
    - assessment_id: str - Assessment identifier
    
    Returns:
    Assessment object
    """

def update_assessment(self, assessment_id, **kwargs):
    """
    Update existing assessment.
    
    Parameters:
    - assessment_id: str - Assessment ID to update
    - **kwargs: Updated assessment attributes
    
    Returns:
    Updated Assessment object
    """

def delete_assessment(self, assessment_id):
    """
    Delete assessment by ID.
    
    Parameters:
    - assessment_id: str - Assessment ID to delete
    """

Webhook Management

Client methods for managing webhooks for MLflow events and notifications.

def create_webhook(self, events, http_url_spec, description=None, status="ACTIVE", model_name=None):
    """
    Create webhook for MLflow events.
    
    Parameters:
    - events: list - List of event types to trigger webhook
    - http_url_spec: dict - HTTP endpoint specification
    - description: str, optional - Webhook description
    - status: str - Webhook status ("ACTIVE", "INACTIVE")
    - model_name: str, optional - Model name filter
    
    Returns:
    Webhook object
    """

def get_webhook(self, webhook_id):
    """
    Get webhook by ID.
    
    Parameters:
    - webhook_id: str - Webhook identifier
    
    Returns:
    Webhook object
    """

def list_webhooks(self, events=None, model_name=None, page_token=None):
    """
    List webhooks with optional filtering.
    
    Parameters:
    - events: list, optional - Filter by event types
    - model_name: str, optional - Filter by model name
    - page_token: str, optional - Pagination token
    
    Returns:
    PagedList of Webhook objects
    """

def update_webhook(self, webhook_id, **kwargs):
    """
    Update existing webhook.
    
    Parameters:
    - webhook_id: str - Webhook ID to update
    - **kwargs: Updated webhook attributes
    
    Returns:
    Updated Webhook object
    """

def delete_webhook(self, webhook_id):
    """
    Delete webhook by ID.
    
    Parameters:
    - webhook_id: str - Webhook ID to delete
    """

Logged Model Management

Client methods for managing logged models with enhanced metadata and search capabilities.

def create_logged_model(self, name, run_id, model_path, flavor=None, metadata=None):
    """
    Create logged model entry.
    
    Parameters:
    - name: str - Model name
    - run_id: str - Associated run ID
    - model_path: str - Path to model artifacts
    - flavor: str, optional - Model flavor
    - metadata: dict, optional - Model metadata
    
    Returns:
    LoggedModel object
    """

def search_logged_models(self, filter_string=None, max_results=None, order_by=None, page_token=None):
    """
    Search logged models with filtering.
    
    Parameters:
    - filter_string: str, optional - Filter expression
    - max_results: int, optional - Maximum results  
    - order_by: list, optional - Sort order
    - page_token: str, optional - Pagination token
    
    Returns:
    PagedList of LoggedModel objects
    """

def log_model_params(self, run_id, model_params):
    """
    Log model parameters for run.
    
    Parameters:
    - run_id: str - Run ID
    - model_params: dict - Model parameters to log
    """

Types

from mlflow.entities import Experiment, Run, RunInfo, RunData, Metric, Param, RunTag
from mlflow.entities.model_registry import RegisteredModel, ModelVersion
from mlflow.entities import Trace, Span, FileInfo
from mlflow.store.entities.paged_list import PagedList
from mlflow.client import MlflowClient

class MlflowClient:
    tracking_uri: str
    _registry_uri: str

class Experiment:
    experiment_id: str
    name: str
    artifact_location: str
    lifecycle_stage: str
    tags: Dict[str, str]
    creation_time: int
    last_update_time: int

class Run:
    info: RunInfo
    data: RunData

class RunInfo:
    run_id: str
    run_name: str
    experiment_id: str
    user_id: str
    status: str
    start_time: int
    end_time: int
    artifact_uri: str
    lifecycle_stage: str

class RunData:
    metrics: List[Metric]
    params: List[Param]
    tags: List[RunTag]

class RegisteredModel:
    name: str
    creation_timestamp: int
    last_updated_timestamp: int
    description: str
    latest_versions: List[ModelVersion]
    tags: Dict[str, str]
    aliases: Dict[str, str]

class ModelVersion:
    name: str
    version: str
    creation_timestamp: int
    last_updated_timestamp: int
    description: str
    user_id: str
    current_stage: str
    source: str
    run_id: str
    status: str
    status_message: str
    tags: Dict[str, str]
    run_link: str
    aliases: List[str]

class FileInfo:
    path: str
    is_dir: bool
    file_size: int

class PagedList[T]:
    items: List[T]
    token: Optional[str]

class ViewType:
    ACTIVE_ONLY: str = "1"
    DELETED_ONLY: str = "2"
    ALL: str = "3"

Install with Tessl CLI

npx tessl i tessl/pypi-mlflow

docs

client.md

configuration.md

data.md

frameworks.md

genai.md

index.md

models.md

projects.md

tracing.md

tracking.md

tile.json