repo
stringclasses
454 values
file_path
stringlengths
5
201
extension
stringclasses
1 value
content
stringlengths
8
509k
num_lines
int64
3
16.9k
size_bytes
int64
8
511k
mlflow
mlflow/telemetry/installation_id.py
.py
import json import os import threading import uuid from datetime import datetime, timezone from pathlib import Path from mlflow.utils.os import is_windows from mlflow.version import VERSION _KEY_INSTALLATION_ID = "installation_id" _CACHE_LOCK = threading.RLock() _INSTALLATION_ID_CACHE: str | None = None def get_or_...
89
2,966
mlflow
mlflow/telemetry/client.py
.py
import atexit import importlib import os import random import sys import threading import time import urllib.parse import uuid import warnings from dataclasses import asdict from functools import lru_cache from queue import Empty, Full, Queue from typing import Any, Callable, Literal import requests from mlflow.envir...
578
20,575
mlflow
mlflow/telemetry/schemas.py
.py
import json import platform import sys from dataclasses import dataclass from enum import Enum from typing import Any from mlflow.version import IS_MLFLOW_SKINNY, IS_TRACING_SDK_ONLY, VERSION class Status(str, Enum): UNKNOWN = "unknown" SUCCESS = "success" FAILURE = "failure" @dataclass class Record: ...
114
3,551
mlflow
mlflow/telemetry/constant.py
.py
from mlflow.ml_package_versions import GENAI_FLAVOR_TO_MODULE_NAME, NON_GENAI_FLAVOR_TO_MODULE_NAME # NB: Kinesis PutRecords API has a limit of 500 records per request BATCH_SIZE = 500 BATCH_TIME_INTERVAL_SECONDS = 10 MAX_QUEUE_SIZE = 1000 MAX_WORKERS = 1 CONFIG_STAGING_URL = "https://config-staging.mlflow-telemetry.i...
98
2,075
mlflow
mlflow/telemetry/events.py
.py
import inspect import os import sys from collections import Counter from enum import Enum from typing import TYPE_CHECKING, Any from urllib.parse import urlparse from mlflow.entities import Feedback from mlflow.entities.issue import IssueSeverity, IssueStatus from mlflow.entities.mcp_server import MCPStatus from mlflo...
940
29,762
mlflow
mlflow/telemetry/track.py
.py
import functools import inspect import logging import time from typing import Any, Callable, ParamSpec, TypeVar from mlflow.environment_variables import MLFLOW_EXPERIMENT_ID from mlflow.telemetry.client import get_telemetry_client from mlflow.telemetry.events import Event from mlflow.telemetry.schemas import Record, S...
124
4,277
mlflow
mlflow/artifacts/__init__.py
.py
""" APIs for interacting with artifacts in MLflow """ import json import pathlib import posixpath import tempfile from typing import Any from mlflow.entities.file_info import FileInfo from mlflow.exceptions import MlflowException from mlflow.protos.databricks_pb2 import BAD_REQUEST, INVALID_PARAMETER_VALUE from mlflo...
273
9,974
mlflow
mlflow/deployments/utils.py
.py
import urllib from urllib.parse import urlparse from mlflow.environment_variables import MLFLOW_DEPLOYMENTS_TARGET from mlflow.exceptions import MlflowException from mlflow.utils.uri import append_to_uri_path _deployments_target: str | None = None def parse_target_uri(target_uri): """Parse out the deployment ta...
97
3,240
mlflow
mlflow/deployments/plugin_manager.py
.py
import abc import importlib.metadata import inspect import importlib_metadata from mlflow.deployments.base import BaseDeploymentClient from mlflow.deployments.utils import parse_target_uri from mlflow.exceptions import MlflowException from mlflow.protos.databricks_pb2 import INTERNAL_ERROR, RESOURCE_DOES_NOT_EXIST fr...
144
5,604
mlflow
mlflow/deployments/__init__.py
.py
""" Exposes functionality for deploying MLflow models to custom serving tools. Note: model deployment to AWS Sagemaker can currently be performed via the :py:mod:`mlflow.sagemaker` module. Model deployment to Azure can be performed by using the `azureml library <https://pypi.org/project/azureml-mlflow/>`_. MLflow doe...
120
4,763
mlflow
mlflow/deployments/constants.py
.py
# Abridged retryable error codes for deployments clients. # These are modified from the standard MLflow Tracking server retry codes for the MLflowClient to # remove timeouts from the list of the retryable conditions. A long-running timeout with # retries for the proxied providers generally indicates an issue with the u...
12
607
mlflow
mlflow/deployments/cli.py
.py
import json import sys from inspect import signature import click from mlflow.deployments import interface from mlflow.mcp.decorator import mlflow_mcp from mlflow.utils import cli_args from mlflow.utils.proto_json_utils import NumpyEncoder, _get_jsonable_obj def _user_args_to_dict(user_list): # Similar function...
483
16,131
mlflow
mlflow/deployments/interface.py
.py
import inspect from logging import Logger from mlflow.deployments.base import BaseDeploymentClient from mlflow.deployments.plugin_manager import DeploymentPlugins from mlflow.deployments.utils import get_deployments_target, parse_target_uri from mlflow.exceptions import MlflowException plugin_store = DeploymentPlugin...
103
4,624
mlflow
mlflow/deployments/base.py
.py
""" This module contains the base interface implemented by MLflow model deployment plugins. In particular, a valid deployment plugin module must implement: 1. Exactly one client class subclassed from :py:class:`BaseDeploymentClient`, exposing the primary user-facing APIs used to manage deployments. 2. :py:func:`run...
359
16,159
mlflow
mlflow/deployments/mlflow/__init__.py
.py
from typing import TYPE_CHECKING, Any import requests from mlflow import MlflowException from mlflow.deployments import BaseDeploymentClient from mlflow.deployments.constants import ( MLFLOW_DEPLOYMENT_CLIENT_REQUEST_RETRY_CODES, ) from mlflow.deployments.server.constants import ( MLFLOW_DEPLOYMENTS_CRUD_ENDP...
328
10,822
mlflow
mlflow/deployments/server/constants.py
.py
MLFLOW_DEPLOYMENTS_HEALTH_ENDPOINT = "/health" MLFLOW_DEPLOYMENTS_CRUD_ENDPOINT_BASE = "/api/2.0/endpoints/" MLFLOW_DEPLOYMENTS_LIMITS_BASE = "/api/2.0/endpoints/limits/" MLFLOW_DEPLOYMENTS_ENDPOINTS_BASE = "/endpoints/" MLFLOW_DEPLOYMENTS_QUERY_SUFFIX = "/invocations" MLFLOW_DEPLOYMENTS_LIST_ENDPOINTS_PAGE_SIZE = 3000...
7
321
mlflow
mlflow/deployments/server/config.py
.py
from pydantic import ConfigDict from mlflow.gateway.base_models import ResponseModel from mlflow.gateway.config import EndpointModelInfo, Limit class Endpoint(ResponseModel): name: str endpoint_type: str model: EndpointModelInfo endpoint_url: str limit: Limit | None model_config = ConfigDict...
28
787
mlflow
mlflow/deployments/databricks/__init__.py
.py
import json import posixpath import warnings from typing import Any, Iterator from mlflow.deployments import BaseDeploymentClient from mlflow.deployments.constants import ( MLFLOW_DEPLOYMENT_CLIENT_REQUEST_RETRY_CODES, ) from mlflow.environment_variables import ( MLFLOW_DEPLOYMENT_PREDICT_TIMEOUT, MLFLOW_D...
850
30,292
mlflow
mlflow/deployments/openai/__init__.py
.py
import os from mlflow.deployments import BaseDeploymentClient from mlflow.exceptions import MlflowException from mlflow.protos.databricks_pb2 import INVALID_PARAMETER_VALUE from mlflow.utils.openai_utils import ( _OAITokenHolder, _OpenAIApiConfig, _OpenAIEnvVar, ) from mlflow.utils.rest_utils import augmen...
253
7,400
mlflow
mlflow/tracking/_uc_upsell.py
.py
from mlflow.utils.logging_utils import eprint _BOLD_ORANGE = "\033[1;38;5;208m" _LIGHT_BLUE = "\033[94m" _RESET = "\033[0m" def show_existing_experiment_upsell(): doc_url = "https://docs.databricks.com/aws/en/mlflow3/genai/tracing/migrate-traces-to-uc" eprint( f"{_BOLD_ORANGE}If you are using MLflow ...
26
1,029
mlflow
mlflow/tracking/__init__.py
.py
""" The ``mlflow.tracking`` module provides a Python CRUD interface to MLflow experiments and runs. This is a lower level API that directly translates to MLflow `REST API <../rest-api.html>`_ calls. For a higher level API for managing an "active run", use the :py:mod:`mlflow` module. """ # Minimum APIs required for co...
40
1,169
mlflow
mlflow/tracking/metric_value_conversion_utils.py
.py
import sys from mlflow.exceptions import INVALID_PARAMETER_VALUE, MlflowException def _is_module_imported(module_name: str) -> bool: return module_name in sys.modules def _try_get_item(x): try: return x.item() except Exception as e: raise MlflowException( f"Failed to convert...
94
2,249
mlflow
mlflow/tracking/multimedia.py
.py
""" Internal module implementing multi-media objects and utilities in MLflow. Multi-media objects are exposed to users at the top-level :py:mod:`mlflow` module. """ import warnings from typing import TYPE_CHECKING, Any, Union if TYPE_CHECKING: import numpy import PIL COMPRESSED_IMAGE_SIZE = 256 def compre...
207
6,266
mlflow
mlflow/tracking/artifact_utils.py
.py
""" Utilities for dealing with artifacts in the context of a Run. """ import os import pathlib import posixpath import tempfile import urllib.parse import uuid from typing import Any from mlflow.exceptions import MlflowException from mlflow.protos.databricks_pb2 import INVALID_PARAMETER_VALUE from mlflow.store.artifa...
184
8,632
mlflow
mlflow/tracking/registry.py
.py
import warnings from abc import ABCMeta from mlflow.exceptions import MlflowException from mlflow.protos.databricks_pb2 import INVALID_PARAMETER_VALUE from mlflow.utils.plugins import get_entry_points from mlflow.utils.uri import get_uri_scheme class UnsupportedModelRegistryStoreURIException(MlflowException): ""...
87
3,524
mlflow
mlflow/tracking/client.py
.py
""" Internal package providing a Python CRUD interface to MLflow experiments, runs, registered models, and model versions. This is a lower level API than the :py:mod:`mlflow.tracking.fluent` module, and is exposed in the :py:mod:`mlflow.tracking` module. """ import contextlib import functools import io import json imp...
6,994
275,909
mlflow
mlflow/tracking/fluent.py
.py
""" Internal module implementing the fluent API, allowing management of an active MLflow run. This module is exposed to users at the top-level :py:mod:`mlflow` module. """ import atexit import contextlib import importlib import inspect import io import logging import os import threading from copy import deepcopy from ...
4,057
155,523
mlflow
mlflow/tracking/context/databricks_notebook_context.py
.py
from mlflow.entities import SourceType from mlflow.tracking.context.abstract_context import RunContextProvider from mlflow.utils import databricks_utils from mlflow.utils.mlflow_tags import ( MLFLOW_DATABRICKS_NOTEBOOK_ID, MLFLOW_DATABRICKS_NOTEBOOK_PATH, MLFLOW_DATABRICKS_WEBAPP_URL, MLFLOW_DATABRICKS_...
44
1,785
mlflow
mlflow/tracking/context/system_environment_context.py
.py
import json from mlflow.environment_variables import MLFLOW_RUN_CONTEXT from mlflow.tracking.context.abstract_context import RunContextProvider # The constant MLFLOW_RUN_CONTEXT_ENV_VAR is marked as @developer_stable MLFLOW_RUN_CONTEXT_ENV_VAR = MLFLOW_RUN_CONTEXT.name class SystemEnvironmentContext(RunContextProvi...
16
467
mlflow
mlflow/tracking/context/databricks_job_context.py
.py
from mlflow.entities import SourceType from mlflow.tracking.context.abstract_context import RunContextProvider from mlflow.utils import databricks_utils from mlflow.utils.mlflow_tags import ( MLFLOW_DATABRICKS_JOB_ID, MLFLOW_DATABRICKS_JOB_RUN_ID, MLFLOW_DATABRICKS_JOB_TYPE, MLFLOW_DATABRICKS_WEBAPP_URL...
52
2,037
mlflow
mlflow/tracking/context/git_context.py
.py
import logging from mlflow.tracking.context.abstract_context import RunContextProvider from mlflow.tracking.context.default_context import _get_main_file from mlflow.utils.git_utils import get_git_branch, get_git_commit, get_git_repo_url from mlflow.utils.mlflow_tags import ( MLFLOW_GIT_BRANCH, MLFLOW_GIT_COMM...
41
1,137
mlflow
mlflow/tracking/context/registry.py
.py
import logging import warnings from mlflow.tracking.context.abstract_context import RunContextProvider from mlflow.tracking.context.databricks_cluster_context import DatabricksClusterRunContext from mlflow.tracking.context.databricks_command_context import DatabricksCommandRunContext from mlflow.tracking.context.datab...
100
4,235
mlflow
mlflow/tracking/context/abstract_context.py
.py
from abc import ABCMeta, abstractmethod from mlflow.utils.annotations import developer_stable @developer_stable class RunContextProvider: """ Abstract base class for context provider objects specifying custom tags at run-creation time (e.g. tags specifying the git repo with which the run is associated). ...
36
1,060
mlflow
mlflow/tracking/context/jupyter_notebook_context.py
.py
import json import os from collections.abc import Generator from functools import lru_cache from pathlib import Path from typing import Any from urllib.request import urlopen from mlflow.entities import SourceType from mlflow.tracking.context.abstract_context import RunContextProvider from mlflow.utils.databricks_util...
224
6,324
mlflow
mlflow/tracking/context/databricks_cluster_context.py
.py
from mlflow.tracking.context.abstract_context import RunContextProvider from mlflow.utils import databricks_utils from mlflow.utils.mlflow_tags import MLFLOW_DATABRICKS_CLUSTER_ID class DatabricksClusterRunContext(RunContextProvider): def in_context(self): return databricks_utils.is_in_cluster() def ...
16
520
mlflow
mlflow/tracking/context/databricks_command_context.py
.py
from mlflow.tracking.context.abstract_context import RunContextProvider from mlflow.utils import databricks_utils from mlflow.utils.mlflow_tags import MLFLOW_DATABRICKS_NOTEBOOK_COMMAND_ID class DatabricksCommandRunContext(RunContextProvider): def in_context(self): return databricks_utils.get_job_group_id...
16
561
mlflow
mlflow/tracking/context/databricks_repo_context.py
.py
from mlflow.tracking.context.abstract_context import RunContextProvider from mlflow.utils import databricks_utils from mlflow.utils.mlflow_tags import ( MLFLOW_DATABRICKS_GIT_REPO_COMMIT, MLFLOW_DATABRICKS_GIT_REPO_PROVIDER, MLFLOW_DATABRICKS_GIT_REPO_REFERENCE, MLFLOW_DATABRICKS_GIT_REPO_REFERENCE_TYPE...
44
1,952
mlflow
mlflow/tracking/context/default_context.py
.py
import getpass import sys from mlflow.entities import SourceType from mlflow.tracking.context.abstract_context import RunContextProvider from mlflow.utils.credentials import read_mlflow_creds from mlflow.utils.mlflow_tags import ( MLFLOW_SOURCE_NAME, MLFLOW_SOURCE_TYPE, MLFLOW_USER, ) _DEFAULT_USER = "unk...
52
1,135
mlflow
mlflow/tracking/request_auth/abstract_request_auth_provider.py
.py
from abc import ABC, abstractmethod from mlflow.utils.annotations import developer_stable @developer_stable class RequestAuthProvider(ABC): """ Abstract base class for specifying custom request auth to add to outgoing requests When a request is sent, MLflow will iterate through all registered RequestAut...
35
1,041
mlflow
mlflow/tracking/request_auth/registry.py
.py
import warnings from mlflow.tracking.request_auth.kubernetes_request_auth_provider import ( KubernetesNamespacedRequestAuthProvider, KubernetesRequestAuthProvider, ) from mlflow.utils.plugins import get_entry_points REQUEST_AUTH_PROVIDER_ENTRYPOINT = "mlflow.request_auth_provider" class RequestAuthProviderR...
67
2,281
mlflow
mlflow/tracking/request_auth/kubernetes_request_auth_provider.py
.py
"""Request auth provider for Kubernetes environments. This module provides two auth plugins activated via ``MLFLOW_TRACKING_AUTH``: - ``kubernetes`` — adds only the ``Authorization`` header (bearer token). - ``kubernetes-namespaced`` — adds both ``Authorization`` and ``X-MLFLOW-WORKSPACE`` (derived from the Kuberne...
343
12,103
mlflow
mlflow/tracking/default_experiment/registry.py
.py
import logging import warnings from mlflow.tracking import get_tracking_uri from mlflow.tracking.default_experiment import DEFAULT_EXPERIMENT_ID from mlflow.tracking.default_experiment.databricks_notebook_experiment_provider import ( DatabricksNotebookExperimentProvider, ) from mlflow.utils.plugins import get_entr...
75
3,024
mlflow
mlflow/tracking/default_experiment/abstract_context.py
.py
from abc import ABCMeta, abstractmethod from mlflow.utils.annotations import developer_stable @developer_stable class DefaultExperimentProvider: """ Abstract base class for objects that provide the ID of an MLflow Experiment based on the current client context. For example, when the MLflow client is runn...
44
1,675
mlflow
mlflow/tracking/default_experiment/databricks_notebook_experiment_provider.py
.py
from functools import lru_cache from mlflow.exceptions import MlflowException from mlflow.protos import databricks_pb2 from mlflow.tracking.client import MlflowClient from mlflow.tracking.default_experiment.abstract_context import DefaultExperimentProvider from mlflow.utils import databricks_utils from mlflow.utils.ml...
45
1,851
mlflow
mlflow/tracking/_workspace/__init__.py
.py
from mlflow.tracking._workspace.client import WorkspaceProviderClient from mlflow.tracking._workspace.registry import ( WorkspaceStoreRegistry, get_workspace_store, ) __all__ = [ "WorkspaceProviderClient", "WorkspaceStoreRegistry", "get_workspace_store", ]
12
278
mlflow
mlflow/tracking/_workspace/registry.py
.py
from __future__ import annotations import threading import warnings from functools import lru_cache, partial from mlflow.exceptions import MlflowException from mlflow.protos.databricks_pb2 import INVALID_PARAMETER_VALUE from mlflow.store.db.db_types import DATABASE_ENGINES from mlflow.tracking.registry import StoreRe...
113
4,270
mlflow
mlflow/tracking/_workspace/client.py
.py
from __future__ import annotations from mlflow.entities.workspace import ( TraceArchivalConfig, Workspace, WorkspaceDeletionMode, ) from mlflow.tracking._workspace.registry import get_workspace_store def _resolve_trace_archival_settings( trace_archival_config: TraceArchivalConfig | None, ) -> tuple[s...
115
3,953
mlflow
mlflow/tracking/_workspace/fluent.py
.py
from __future__ import annotations import threading from typing import Callable, TypeVar from mlflow.entities.workspace import ( TraceArchivalConfig, Workspace, WorkspaceDeletionMode, ) from mlflow.exceptions import MlflowException, RestException from mlflow.protos import databricks_pb2 from mlflow.protos...
162
5,224
mlflow
mlflow/tracking/_model_registry/utils.py
.py
import importlib from functools import partial from mlflow.environment_variables import MLFLOW_ENABLE_WORKSPACES, MLFLOW_REGISTRY_URI from mlflow.store.db.db_types import DATABASE_ENGINES from mlflow.store.model_registry.databricks_workspace_model_registry_rest_store import ( DatabricksWorkspaceModelRegistryRestSt...
261
9,845
mlflow
mlflow/tracking/_model_registry/registry.py
.py
import inspect import threading from functools import lru_cache from mlflow.tracking.registry import StoreRegistry _building_store_lock = threading.Lock() class ModelRegistryStoreRegistry(StoreRegistry): """Scheme-based registry for model registry store implementations This class allows the registration of...
68
3,251
mlflow
mlflow/tracking/_model_registry/client.py
.py
""" Internal package providing a Python CRUD interface to MLflow models and versions. This is a lower level API than the :py:mod:`mlflow.tracking.fluent` module, and is exposed in the :py:mod:`mlflow.tracking` module. """ import logging from typing import Any from pydantic import BaseModel from mlflow.entities.model...
926
32,992
mlflow
mlflow/tracking/_model_registry/fluent.py
.py
import json import logging import os import threading import uuid import warnings from typing import Any from pydantic import BaseModel import mlflow from mlflow.entities.logged_model import LoggedModel from mlflow.entities.model_registry import ModelVersion, Prompt, PromptVersion, RegisteredModel from mlflow.entitie...
947
37,660
mlflow
mlflow/tracking/_tracking_service/utils.py
.py
import importlib import logging import os from collections import OrderedDict from contextlib import contextmanager from functools import lru_cache, partial from pathlib import Path from typing import Generator from urllib.parse import unquote from mlflow.environment_variables import MLFLOW_ENABLE_WORKSPACES, MLFLOW_T...
350
12,309
mlflow
mlflow/tracking/_tracking_service/registry.py
.py
import threading from functools import lru_cache from mlflow.tracking.registry import StoreRegistry _building_store_lock = threading.Lock() class TrackingStoreRegistry(StoreRegistry): """Scheme-based registry for tracking store implementations This class allows the registration of a function or class to pr...
57
2,419
mlflow
mlflow/tracking/_tracking_service/client.py
.py
""" Internal package providing a Python CRUD interface to MLflow experiments and runs. This is a lower level API than the :py:mod:`mlflow.tracking.fluent` module, and is exposed in the :py:mod:`mlflow.tracking` module. """ import logging import os import sys from itertools import zip_longest from typing import TYPE_CH...
1,137
44,537
mlflow
mlflow/tracking/request_header/default_request_header_provider.py
.py
from mlflow import __version__ from mlflow.tracking.request_header.abstract_request_header_provider import RequestHeaderProvider _USER_AGENT = "User-Agent" _CLIENT_VERSION = "X-MLflow-Client-Version" _MLFLOW_PYTHON_CLIENT_USER_AGENT_PREFIX = "mlflow-python-client/" # We need to specify client version in separate heade...
24
761
mlflow
mlflow/tracking/request_header/abstract_request_header_provider.py
.py
from abc import ABCMeta, abstractmethod from mlflow.utils.annotations import developer_stable @developer_stable class RequestHeaderProvider: """ Abstract base class for specifying custom request headers to add to outgoing requests (e.g. request headers specifying the environment from which mlflow is runn...
37
1,061
mlflow
mlflow/tracking/request_header/registry.py
.py
import logging import warnings from mlflow.tracking.request_header.databricks_request_header_provider import ( DatabricksRequestHeaderProvider, ) from mlflow.tracking.request_header.default_request_header_provider import ( DefaultRequestHeaderProvider, ) from mlflow.utils.plugins import get_entry_points _logg...
80
2,910
mlflow
mlflow/tracking/request_header/databricks_request_header_provider.py
.py
from mlflow.tracking.request_header.abstract_request_header_provider import RequestHeaderProvider from mlflow.utils import databricks_utils class DatabricksRequestHeaderProvider(RequestHeaderProvider): """ Provides request headers indicating the type of Databricks environment from which a request was made...
36
1,486
mlflow
mlflow/pytest/decorator.py
.py
"""``@mlflow.test`` marker. Marks a test for the (opt-in) MLflow pytest plugin, which sets up the test run and enables tracing for the marked test. Enable the plugin by adding ``pytest_plugins = ["mlflow.pytest.plugin"]`` to your root ``conftest.py``, or by running pytest with ``-p mlflow.pytest.plugin``. @mlflow...
72
2,363
mlflow
mlflow/pytest/__init__.py
.py
from mlflow.pytest.decorator import test __all__ = ["test"]
4
61
mlflow
mlflow/pytest/session.py
.py
"""Session state for the ``@mlflow.test`` pytest plugin. Tracks the single test run per pytest session and which test is currently executing (for trace tagging). """ from __future__ import annotations import datetime import logging import threading import uuid import mlflow _logger = logging.getLogger(__name__) T...
146
4,730
mlflow
mlflow/pytest/plugin.py
.py
"""Pytest plugin for ``@mlflow.test`` + ``mlflow.genai.evaluate``. Opt-in: the plugin is intentionally not auto-registered (loading it would make every pytest run on the machine import mlflow at startup). Enable it by adding the following to your root ``conftest.py``:: pytest_plugins = ["mlflow.pytest.plugin"] o...
79
2,654
mlflow
mlflow/evaluation/utils.py
.py
""" THE 'mlflow.evaluation` MODULE IS LEGACY AND WILL BE REMOVED SOON. PLEASE DO NOT USE THESE CLASSES IN NEW CODE. INSTEAD, USE `mlflow/entities/assessment.py` FOR ASSESSMENT CLASSES. """ import pandas as pd from mlflow.evaluation.evaluation import EvaluationEntity as EvaluationEntity from mlflow.utils.annotations i...
202
6,375
mlflow
mlflow/evaluation/evaluation.py
.py
""" THE 'mlflow.evaluation` MODULE IS LEGACY AND WILL BE REMOVED IN MLFLOW 3.0. For assessment functionality, use `mlflow.entities.assessment` for assessment classes and `mlflow.tracing.assessments` for assessment APIs. There are no alternatives for Evaluation and EvaluationEntity objects and related APIs. """ import ...
412
14,499
mlflow
mlflow/evaluation/__init__.py
.py
""" THE 'mlflow.evaluation` MODULE IS LEGACY AND WILL BE REMOVED SOON. PLEASE DO NOT USE THESE CLASSES IN NEW CODE. INSTEAD, USE `mlflow/entities/assessment.py` FOR ASSESSMENT CLASSES. """ from mlflow.evaluation.assessment import Assessment, AssessmentSource, AssessmentSourceType from mlflow.evaluation.evaluation impo...
17
513
mlflow
mlflow/evaluation/assessment.py
.py
""" THE 'mlflow.evaluation` MODULE IS LEGACY AND WILL BE REMOVED SOON. PLEASE DO NOT USE THESE CLASSES IN NEW CODE. INSTEAD, USE `mlflow/entities/assessment.py` FOR ASSESSMENT CLASSES. """ import numbers import time from typing import Any from mlflow.entities._mlflow_object import _MlflowObject from mlflow.entities.a...
370
13,374
mlflow
mlflow/evaluation/fluent.py
.py
""" THE 'mlflow.evaluation` MODULE IS LEGACY AND WILL BE REMOVED SOON. PLEASE DO NOT USE THESE CLASSES IN NEW CODE. INSTEAD, USE `mlflow/entities/assessment.py` FOR ASSESSMENT CLASSES. """ import uuid from mlflow.evaluation.evaluation import Evaluation, EvaluationEntity from mlflow.evaluation.utils import evaluations...
48
1,818
mlflow
mlflow/evaluation/evaluation_tag.py
.py
""" THE 'mlflow.evaluation` MODULE IS LEGACY AND WILL BE REMOVED SOON. PLEASE DO NOT USE THESE CLASSES IN NEW CODE. INSTEAD, USE `mlflow/entities/assessment.py` FOR ASSESSMENT CLASSES. """ from mlflow.entities._mlflow_object import _MlflowObject from mlflow.utils.annotations import deprecated @deprecated(since="3.0....
62
1,682
mlflow
mlflow/prompt/constants.py
.py
# A special tag in RegisteredModel to indicate that it is a prompt import re IS_PROMPT_TAG_KEY = "mlflow.prompt.is_prompt" # A special tag in ModelVersion to store the prompt text PROMPT_TEXT_TAG_KEY = "mlflow.prompt.text" # Unity Catalog tags cannot contain dots PROMPT_TYPE_TAG_KEY = "_mlflow_prompt_type" RESPONSE_F...
32
1,136
mlflow
mlflow/prompt/registry_utils.py
.py
import functools import json import logging import re import threading import time from textwrap import dedent from typing import Any, NamedTuple import mlflow from mlflow.entities.model_registry.model_version import ModelVersion from mlflow.entities.model_registry.prompt_version import PromptVersion from mlflow.entit...
428
14,439
mlflow
mlflow/prompt/promptlab_model.py
.py
import os import re import yaml from mlflow.exceptions import MlflowException from mlflow.version import VERSION as __version__ class _PromptlabModel: import pandas as pd def __init__(self, prompt_template, prompt_parameters, model_parameters, model_route): self.prompt_parameters = prompt_parameter...
198
7,090
mlflow
mlflow/catboost/__init__.py
.py
""" The ``mlflow.catboost`` module provides an API for logging and loading CatBoost models. This module exports CatBoost models with the following flavors: CatBoost (native) format This is the main flavor that can be loaded back into CatBoost. :py:mod:`mlflow.pyfunc` Produced for use by generic pyfunc-based de...
383
13,506
mlflow
mlflow/genai/mcp_servers.py
.py
from __future__ import annotations import json import urllib.error import urllib.parse import urllib.request from pathlib import Path from typing import TYPE_CHECKING, Any, Literal, Mapping from mlflow.entities.mcp_server import ( MCPRemoteTransportType, MCPStatus, MCPTool, validate_mcp_server_name, )...
788
28,562
mlflow
mlflow/genai/__init__.py
.py
from mlflow.genai import ( datasets, judges, scorers, ) from mlflow.genai.agent_tester import test_agent from mlflow.genai.datasets import ( EvaluationDatasetVersion, create_dataset, delete_dataset, delete_dataset_tag, get_dataset, search_datasets, set_dataset_tags, ) from mlflow...
158
4,085
mlflow
mlflow/genai/scheduled_scorers.py
.py
from dataclasses import dataclass from mlflow.genai.scorers.base import Scorer _ERROR_MSG = ( "The `databricks-agents` package is required to use `mlflow.genai.scheduled_scorers`. " "Please install it with `pip install databricks-agents`." ) @dataclass() class ScorerScheduleConfig: """ A scheduled s...
83
3,568
mlflow
mlflow/genai/agent_tester.py
.py
from __future__ import annotations import inspect import logging from dataclasses import dataclass from typing import TYPE_CHECKING, Any, Callable import pydantic import mlflow from mlflow.genai.judges.utils.invocation_utils import get_chat_completions_with_structured_output from mlflow.utils.annotations import expe...
456
15,912
mlflow
mlflow/genai/mcp_tool_discovery.py
.py
"""Client-side MCP tool discovery helpers.""" from __future__ import annotations import asyncio import logging import threading from typing import Any, Mapping from mlflow.entities.mcp_server import MCPRemoteTransportType, MCPTool from mlflow.environment_variables import MLFLOW_ENABLE_MCP_TOOL_DISCOVERY from mlflow....
241
8,622
mlflow
mlflow/genai/simulators/distillation.py
.py
from __future__ import annotations import logging from concurrent.futures import ThreadPoolExecutor, as_completed from typing import TYPE_CHECKING import pydantic from mlflow.environment_variables import MLFLOW_GENAI_EVAL_MAX_WORKERS from mlflow.genai.simulators.prompts import DISTILL_GOAL_AND_PERSONA_PROMPT from ml...
170
5,874
mlflow
mlflow/genai/simulators/simulator.py
.py
from __future__ import annotations import inspect import logging import math import time import uuid from abc import ABC, abstractmethod from concurrent.futures import ThreadPoolExecutor, as_completed from contextlib import contextmanager from dataclasses import dataclass, field from threading import Lock from typing ...
852
33,644
mlflow
mlflow/genai/simulators/utils.py
.py
from __future__ import annotations import json import logging from contextlib import contextmanager from typing import TYPE_CHECKING, Any import pydantic import mlflow from mlflow.exceptions import MlflowException from mlflow.genai.judges.adapters.databricks_managed_judge_adapter import ( _create_message_from_da...
107
3,655
mlflow
mlflow/genai/simulators/__init__.py
.py
from mlflow.genai.simulators.distillation import generate_test_cases from mlflow.genai.simulators.simulator import ( BaseSimulatedUserAgent, ConversationSimulator, SimulatedUserAgent, SimulatorContext, ) __all__ = [ "BaseSimulatedUserAgent", "ConversationSimulator", "SimulatedUserAgent", ...
16
371
mlflow
mlflow/genai/simulators/prompts.py
.py
DEFAULT_PERSONA = "You are an inquisitive user having a natural conversation." INITIAL_USER_PROMPT = """Instructions: You are role-playing as a real user interacting with an AI assistant. - Write like a human user, not like an assistant or expert. Do not act as the helper or expert: NEVER answer the goal yourself, e...
133
6,609
mlflow
mlflow/genai/judges/builtin_judges.py
.py
from mlflow.genai.judges.base import Judge from mlflow.genai.scorers.builtin_scorers import BuiltInScorer class BuiltinJudge(BuiltInScorer, Judge): """ Base class for built-in AI judge scorers that use LLMs for evaluation. """
9
241
mlflow
mlflow/genai/judges/custom_prompt_judge.py
.py
import re from difflib import unified_diff from typing import Callable from mlflow.entities.assessment import Feedback from mlflow.entities.assessment_source import AssessmentSource, AssessmentSourceType from mlflow.genai.judges.builtin import _MODEL_API_DOC from mlflow.genai.judges.constants import USE_CASE_CUSTOM_PR...
171
6,420
mlflow
mlflow/genai/judges/__init__.py
.py
# Make utils available as an attribute for mocking from mlflow.genai.judges import utils # noqa: F401 from mlflow.genai.judges.base import AlignmentOptimizer, Judge from mlflow.genai.judges.builtin import ( is_context_relevant, is_context_sufficient, is_correct, is_grounded, is_safe, is_tool_ca...
36
953
mlflow
mlflow/genai/judges/constants.py
.py
_DATABRICKS_DEFAULT_JUDGE_MODEL = "databricks" _DATABRICKS_AGENTIC_JUDGE_MODEL = "gpt-oss-120b" # Use case constants for chat completions USE_CASE_BUILTIN_JUDGE = "builtin_judge" USE_CASE_AGENTIC_JUDGE = "agentic_judge" USE_CASE_CUSTOM_PROMPT_JUDGE = "custom_prompt_judge" USE_CASE_JUDGE_ALIGNMENT = "judge_alignment" ...
102
1,768
mlflow
mlflow/genai/judges/builtin.py
.py
from functools import wraps from typing import TYPE_CHECKING, Any from mlflow.entities.assessment import Feedback from mlflow.exceptions import MlflowException from mlflow.genai.judges.constants import USE_CASE_BUILTIN_JUDGE from mlflow.genai.judges.prompts.relevance_to_query import RELEVANCE_TO_QUERY_ASSESSMENT_NAME ...
767
28,017
mlflow
mlflow/genai/judges/make_judge.py
.py
import types from typing import Any, Literal, Union, get_args, get_origin from mlflow.genai.judges.base import Judge from mlflow.genai.judges.instructions_judge import InstructionsJudge from mlflow.telemetry.events import MakeJudgeEvent from mlflow.telemetry.track import record_usage_event def _is_optional_pb_value_...
295
13,720
mlflow
mlflow/genai/judges/base.py
.py
from __future__ import annotations from abc import ABC, abstractmethod from typing import Any from pydantic import BaseModel, Field from mlflow.entities.trace import Trace from mlflow.genai.judges.constants import ( _RATIONALE_FIELD_DESCRIPTION, _RESULT_FIELD_DESCRIPTION, ) from mlflow.genai.judges.utils imp...
138
4,360
mlflow
mlflow/genai/judges/optimizers/__init__.py
.py
"""MLflow GenAI Judge Optimizers.""" from mlflow.genai.judges.optimizers.gepa import GEPAAlignmentOptimizer from mlflow.genai.judges.optimizers.memalign import MemAlignOptimizer from mlflow.genai.judges.optimizers.simba import SIMBAAlignmentOptimizer __all__ = [ "GEPAAlignmentOptimizer", "MemAlignOptimizer", ...
12
353
mlflow
mlflow/genai/judges/optimizers/dspy.py
.py
"""DSPy-based alignment optimizer implementation.""" import logging from abc import abstractmethod from typing import Any, Callable, ClassVar, Collection from mlflow.entities.assessment import Feedback from mlflow.entities.trace import Trace from mlflow.exceptions import MlflowException from mlflow.genai.judges impor...
262
10,115
mlflow
mlflow/genai/judges/optimizers/dspy_utils.py
.py
"""Utility functions for DSPy-based alignment optimizers.""" import logging import os from collections import defaultdict from contextlib import contextmanager from typing import TYPE_CHECKING, Any, Callable, Iterator from mlflow import __version__ as VERSION from mlflow.entities.assessment_source import AssessmentSo...
668
23,923
mlflow
mlflow/genai/judges/optimizers/simba.py
.py
"""SIMBA alignment optimizer implementation.""" import logging from typing import TYPE_CHECKING, Any, Callable, ClassVar, Collection from mlflow.genai.judges.optimizers.dspy import DSPyAlignmentOptimizer from mlflow.genai.judges.optimizers.dspy_utils import ( _check_dspy_installed, suppress_verbose_logging, )...
120
4,178
mlflow
mlflow/genai/judges/optimizers/gepa.py
.py
"""GEPA alignment optimizer implementation.""" import logging from typing import Any, Callable, Collection from mlflow.exceptions import MlflowException from mlflow.genai.judges.optimizers.dspy import DSPyAlignmentOptimizer from mlflow.genai.judges.optimizers.dspy_utils import create_gepa_metric_adapter from mlflow.p...
140
5,278
mlflow
mlflow/genai/judges/optimizers/memalign/utils.py
.py
import copy import json import logging import re from concurrent.futures import ThreadPoolExecutor, as_completed from functools import lru_cache from typing import TYPE_CHECKING, Any from pydantic import BaseModel # Try to import jinja2 at module level try: from jinja2 import Template _JINJA2_AVAILABLE = Tru...
576
20,745
mlflow
mlflow/genai/judges/optimizers/memalign/__init__.py
.py
from mlflow.genai.judges.optimizers.memalign.optimizer import MemAlignOptimizer __all__ = ["MemAlignOptimizer"]
4
113
mlflow
mlflow/genai/judges/optimizers/memalign/prompts.py
.py
DISTILLATION_PROMPT_TEMPLATE = """You are helping improve an LLM judge with the \ following instructions: {{ judge_instructions }} Given a set of examples and a user's judgement of their quality, your task is to \ distill a set of guidelines from the judgements to model this user's perspective, \ which can be used to ...
69
2,655
mlflow
mlflow/genai/judges/optimizers/memalign/optimizer.py
.py
import copy import logging from collections.abc import Iterable from dataclasses import asdict from typing import TYPE_CHECKING, Any import mlflow from mlflow.entities.assessment import Assessment from mlflow.entities.trace import Trace from mlflow.exceptions import MlflowException from mlflow.genai.judges.base import...
817
34,333
mlflow
mlflow/genai/judges/tools/types.py
.py
""" Shared types for MLflow GenAI judge tools. This module provides common data structures and types that can be reused across multiple judge tools for consistent data representation. """ from dataclasses import dataclass from typing import Any from mlflow.entities.assessment import FeedbackValueType from mlflow.ent...
83
1,848