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/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 |
mlflow | mlflow/genai/judges/tools/get_traces_in_session.py | .py | """
Get traces in session tool for MLflow GenAI judges.
This module provides a tool for retrieving traces from the same session
to enable multi-turn evaluation capabilities.
"""
from mlflow.entities.trace import Trace
from mlflow.exceptions import MlflowException
from mlflow.genai.judges.tools.base import JudgeTool
f... | 111 | 4,378 |
mlflow | mlflow/genai/judges/tools/utils.py | .py | """
Utilities for MLflow GenAI judge tools.
This module contains utility functions and classes used across
different judge tool implementations.
"""
from mlflow.exceptions import MlflowException
from mlflow.protos.databricks_pb2 import INVALID_PARAMETER_VALUE
def create_page_token(offset: int) -> str:
"""
C... | 48 | 1,147 |
mlflow | mlflow/genai/judges/tools/get_span.py | .py | """
Get span tool for MLflow GenAI judges.
This module provides a tool for retrieving a specific span by ID.
"""
import json
from mlflow.entities.trace import Trace
from mlflow.genai.judges.tools.base import JudgeTool
from mlflow.genai.judges.tools.constants import ToolNames
from mlflow.genai.judges.tools.types impo... | 133 | 5,306 |
mlflow | mlflow/genai/judges/tools/get_root_span.py | .py | """
Get root span tool for MLflow GenAI judges.
This module provides a tool for retrieving the root span of a trace,
which contains the top-level inputs and outputs.
"""
from mlflow.entities.trace import Trace
from mlflow.genai.judges.tools.base import JudgeTool
from mlflow.genai.judges.tools.constants import ToolNam... | 109 | 4,316 |
mlflow | mlflow/genai/judges/tools/search_traces.py | .py | """
Search traces tool for MLflow GenAI judges.
This module provides a tool for searching and retrieving traces from an MLflow experiment
based on filter criteria, ordering, and result limits. It enables judges to analyze
traces within the same experiment context.
"""
import logging
import mlflow
from mlflow.entitie... | 269 | 11,277 |
mlflow | mlflow/genai/judges/tools/__init__.py | .py | from mlflow.genai.judges.tools.base import JudgeTool
from mlflow.genai.judges.tools.get_root_span import GetRootSpanTool
from mlflow.genai.judges.tools.get_span import GetSpanTool
from mlflow.genai.judges.tools.get_span_image import GetSpanImageTool, SpanImageResult
from mlflow.genai.judges.tools.get_span_performance_a... | 47 | 1,524 |
mlflow | mlflow/genai/judges/tools/constants.py | .py | """
Constants for MLflow GenAI judge tools.
This module contains constant values used across the judge tools system,
providing a single reference point for tool names and other constants.
"""
# Tool names
class ToolNames:
"""Registry of judge tool names."""
GET_TRACE_INFO = "get_trace_info"
GET_ROOT_SPA... | 22 | 658 |
mlflow | mlflow/genai/judges/tools/get_trace_info.py | .py | """
Get trace info tool for MLflow GenAI judges.
This module provides a tool for retrieving trace metadata including
timing, location, state, and other high-level information.
"""
from mlflow.entities.trace import Trace
from mlflow.entities.trace_info import TraceInfo
from mlflow.genai.judges.tools.base import JudgeT... | 61 | 1,871 |
mlflow | mlflow/genai/judges/tools/registry.py | .py | """
Tool registry for MLflow GenAI judges.
This module provides a registry system for managing and invoking JudgeTool instances.
"""
import json
import logging
from typing import Any
import mlflow
from mlflow.entities import SpanType, Trace
from mlflow.environment_variables import MLFLOW_GENAI_EVAL_ENABLE_SCORER_TRA... | 148 | 4,753 |
mlflow | mlflow/genai/judges/tools/list_spans.py | .py | """
Tool definitions for MLflow GenAI judges.
This module provides concrete JudgeTool implementations that judges can use
to analyze traces and extract information during evaluation.
"""
from dataclasses import dataclass
from mlflow.entities.trace import Trace
from mlflow.genai.judges.tools.base import JudgeTool
fro... | 127 | 4,350 |
mlflow | mlflow/genai/judges/tools/get_span_performance_and_timing_report.py | .py | """
Get span timing report tool for MLflow traces.
This tool generates a timing report showing span latencies, execution order,
and concurrency patterns for performance analysis.
"""
from collections import defaultdict
from dataclasses import dataclass
from mlflow.entities.span import Span
from mlflow.entities.trace... | 500 | 17,080 |
mlflow | mlflow/genai/judges/tools/search_trace_regex.py | .py | """
Tool for searching traces using regex patterns.
This module provides functionality to search through entire traces (including
spans, metadata, tags, requests, and responses) using regular expressions
with case-insensitive matching.
"""
import re
from dataclasses import dataclass
from mlflow.entities.trace import... | 165 | 5,826 |
mlflow | mlflow/genai/judges/tools/get_span_image.py | .py | """
Get span image tool for MLflow GenAI judges.
This module provides a tool that resolves an ``mlflow-attachment://`` image
reference inside a span, downloads the real bytes, and returns them as a
base64 data URL so a multimodal judge model can actually view the image.
When autolog extracts an image from a span it r... | 198 | 8,690 |
mlflow | mlflow/genai/judges/tools/base.py | .py | """
Base classes for MLflow GenAI tools that can be used by judges.
This module provides the foundational interfaces for tools that judges can use
to enhance their evaluation capabilities.
"""
from abc import ABC, abstractmethod
from typing import Any
from mlflow.entities.trace import Trace
from mlflow.types.llm imp... | 54 | 1,418 |
mlflow | mlflow/genai/judges/prompts/knowledge_retention.py | .py | # NB: User-facing name for the knowledge retention assessment.
KNOWLEDGE_RETENTION_ASSESSMENT_NAME = "knowledge_retention"
KNOWLEDGE_RETENTION_PROMPT = """\
Your task is to evaluate the LAST AI response in the {{ conversation }} and determine if it:
- Correctly uses or references information the user provided in earli... | 29 | 1,594 |
mlflow | mlflow/genai/judges/prompts/conversational_safety.py | .py | # NB: User-facing name for the conversational safety assessment.
CONVERSATIONAL_SAFETY_ASSESSMENT_NAME = "conversational_safety"
CONVERSATIONAL_SAFETY_PROMPT = """\
Consider the following conversation history between a user and an assistant. Your task is to \
evaluate the safety of the assistant's responses only and o... | 27 | 1,403 |
mlflow | mlflow/genai/judges/prompts/guidelines.py | .py | from mlflow.genai.prompts.utils import format_prompt
GUIDELINES_FEEDBACK_NAME = "guidelines"
GUIDELINES_PROMPT_INSTRUCTIONS = """\
Given the following set of guidelines and some inputs, please assess whether the inputs fully \
comply with all the provided guidelines. Only focus on the provided guidelines and not the... | 51 | 1,814 |
mlflow | mlflow/genai/judges/prompts/conversational_tool_call_efficiency.py | .py | # NB: User-facing name for the conversational tool call efficiency assessment.
CONVERSATIONAL_TOOL_CALL_EFFICIENCY_ASSESSMENT_NAME = "conversational_tool_call_efficiency"
CONVERSATIONAL_TOOL_CALL_EFFICIENCY_PROMPT = """\
Consider the following conversation history between a user and an assistant, including tool calls ... | 27 | 1,541 |
mlflow | mlflow/genai/judges/prompts/relevance_to_query.py | .py | from mlflow.genai.prompts.utils import format_prompt
# NB: User-facing name for the is_context_relevant assessment.
RELEVANCE_TO_QUERY_ASSESSMENT_NAME = "relevance_to_context"
RELEVANCE_TO_QUERY_PROMPT_INSTRUCTIONS = """\
Consider the following question and answer. You must determine whether the answer provides \
in... | 37 | 1,397 |
mlflow | mlflow/genai/judges/prompts/context_sufficiency.py | .py | from typing import Any
from mlflow.genai.prompts.utils import format_prompt
# NB: User-facing name for the is_context_sufficient assessment.
CONTEXT_SUFFICIENCY_FEEDBACK_NAME = "context_sufficiency"
CONTEXT_SUFFICIENCY_PROMPT_INSTRUCTIONS = """\
Consider the following claim and document. You must determine whether ... | 72 | 2,451 |
mlflow | mlflow/genai/judges/prompts/tool_call_correctness.py | .py | import json
from typing import TYPE_CHECKING
from mlflow.genai.judges.utils.formatting_utils import (
format_available_tools,
format_tools_called,
)
from mlflow.genai.prompts.utils import format_prompt
if TYPE_CHECKING:
from mlflow.genai.utils.type import FunctionCall
from mlflow.types.chat import Cha... | 208 | 8,547 |
mlflow | mlflow/genai/judges/prompts/safety.py | .py | from mlflow.genai.prompts.utils import format_prompt
# NB: User-facing name for the safety assessment.
SAFETY_ASSESSMENT_NAME = "safety"
SAFETY_PROMPT = """\
You are a content safety classifier. Analyze the given text against policies prohibiting hate speech, harassment, incitement of violence, and the promotion of ... | 22 | 928 |
mlflow | mlflow/genai/judges/prompts/conversational_guidelines.py | .py | CONVERSATIONAL_GUIDELINES_ASSESSMENT_NAME = "conversational_guidelines"
CONVERSATIONAL_GUIDELINES_PROMPT = """\
Consider the following conversation history between a user and an assistant.
Your task is to evaluate whether the assistant's responses throughout the conversation comply with
the provided guidelines and out... | 24 | 1,158 |
mlflow | mlflow/genai/judges/prompts/fluency.py | .py | # NB: User-facing name for the fluency assessment.
FLUENCY_ASSESSMENT_NAME = "fluency"
FLUENCY_PROMPT = """\
You are a linguistic expert evaluating the Fluency of AI-generated text in {{ outputs }}.
Definition: Fluency measures the grammatical correctness, natural flow, and linguistic quality
of the text, regardless ... | 16 | 661 |
mlflow | mlflow/genai/judges/prompts/completeness.py | .py | # NB: User-facing name for the completeness assessment.
COMPLETENESS_ASSESSMENT_NAME = "completeness"
COMPLETENESS_PROMPT = """\
Consider the following user prompt and assistant response.
You must decide whether the assistant successfully addressed all explicit requests in the user's prompt.
Output only "yes" or "no" ... | 21 | 1,295 |
mlflow | mlflow/genai/judges/prompts/conversational_role_adherence.py | .py | # NB: User-facing name for the conversational role adherence assessment.
CONVERSATIONAL_ROLE_ADHERENCE_ASSESSMENT_NAME = "conversational_role_adherence"
CONVERSATIONAL_ROLE_ADHERENCE_PROMPT = """\
Consider the following conversation history between a user and an assistant. \
Your task is to evaluate whether the assist... | 31 | 2,069 |
mlflow | mlflow/genai/judges/prompts/groundedness.py | .py | from typing import Any
from mlflow.genai.prompts.utils import format_prompt
# NB: User-facing name for the is_grounded assessment.
GROUNDEDNESS_FEEDBACK_NAME = "groundedness"
GROUNDEDNESS_PROMPT_INSTRUCTIONS = """\
Consider the following claim and document. You must determine whether claim is supported by the \
doc... | 50 | 1,630 |
mlflow | mlflow/genai/judges/prompts/user_frustration.py | .py | # NB: User-facing name for the user frustration assessment.
USER_FRUSTRATION_ASSESSMENT_NAME = "user_frustration"
USER_FRUSTRATION_PROMPT = """\
Consider the following conversation history between a user and an assistant. Your task is to
determine the user's emotional trajectory and output exactly one of the following... | 20 | 1,183 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.