sample_id
stringlengths
21
196
text
stringlengths
105
936k
metadata
dict
category
stringclasses
6 values
mlflow/mlflow:.github/ui-preview/app.py
import logging import os import subprocess import sys from pathlib import Path import mlflow.server from mlflow.demo import generate_all_demos logging.basicConfig(level=logging.INFO) _logger = logging.getLogger(__name__) def setup(): # Extract UI build assets into the mlflow package's expected location tar_...
{ "repo_id": "mlflow/mlflow", "file_path": ".github/ui-preview/app.py", "license": "Apache License 2.0", "lines": 44, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:mlflow/demo/generators/judges.py
from __future__ import annotations import logging from mlflow.demo.base import ( DEMO_EXPERIMENT_NAME, DEMO_PROMPT_PREFIX, BaseDemoGenerator, DemoFeature, DemoResult, ) from mlflow.genai.scorers.registry import delete_scorer, list_scorers from mlflow.tracking._tracking_service.utils import _get_st...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/demo/generators/judges.py", "license": "Apache License 2.0", "lines": 124, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:tests/demo/test_judges_generator.py
import pytest from mlflow.demo.base import DemoFeature, DemoResult from mlflow.demo.generators.judges import DEMO_JUDGE_PREFIX, JudgesDemoGenerator from mlflow.genai.scorers.registry import list_scorers @pytest.fixture def judges_generator(): generator = JudgesDemoGenerator() original_version = generator.ver...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/demo/test_judges_generator.py", "license": "Apache License 2.0", "lines": 58, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:mlflow/store/artifact/b2_artifact_repo.py
from urllib.parse import urlparse from mlflow.store.artifact.optimized_s3_artifact_repo import OptimizedS3ArtifactRepository from mlflow.store.artifact.s3_artifact_repo import _get_s3_client _B2_USER_AGENT = "b2ai-mlflow" def _add_b2_user_agent(request, **kwargs): ua = request.headers.get("User-Agent", "") ...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/store/artifact/b2_artifact_repo.py", "license": "Apache License 2.0", "lines": 76, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:tests/store/artifact/test_b2_artifact_repo.py
import posixpath from unittest import mock from unittest.mock import ANY import pytest from mlflow.store.artifact.artifact_repository_registry import get_artifact_repository from mlflow.store.artifact.b2_artifact_repo import _B2_USER_AGENT, _add_b2_user_agent from mlflow.store.artifact.s3_artifact_repo import _cached...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/store/artifact/test_b2_artifact_repo.py", "license": "Apache License 2.0", "lines": 66, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:mlflow/entities/presigned_download.py
from __future__ import annotations from dataclasses import dataclass from typing import Any @dataclass class PresignedDownloadUrlResponse: """ Response containing a presigned URL for downloading an artifact directly from cloud storage. """ url: str headers: dict[str, str] file_size: int ...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/entities/presigned_download.py", "license": "Apache License 2.0", "lines": 27, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:dev/clint/src/clint/rules/except_bool_op.py
import ast from clint.rules.base import Rule class ExceptBoolOp(Rule): def _message(self) -> str: return ( "Did you mean `except (X, Y):`? Using or/and in an except handler is likely a mistake." ) @staticmethod def check(node: ast.ExceptHandler) -> bool: return isinst...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/src/clint/rules/except_bool_op.py", "license": "Apache License 2.0", "lines": 10, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:dev/clint/tests/rules/test_except_bool_op.py
from pathlib import Path from clint.config import Config from clint.linter import Position, Range, lint_file from clint.rules import ExceptBoolOp def test_except_bool_op(index_path: Path) -> None: code = """ # Bad - or in except try: pass except ValueError or KeyError: pass # Bad - and in except try: ...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/tests/rules/test_except_bool_op.py", "license": "Apache License 2.0", "lines": 45, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:mlflow/store/fs2db/_registry.py
""" Migrate model registry entities from FileStore to DB. FileStore layout: <mlruns>/models/ └── <model_name>/ ├── meta.yaml -> registered_models ├── tags/<key> -> registered_model_tags ├── aliases/<alias_name> -> registered_model_aliases └── version-...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/store/fs2db/_registry.py", "license": "Apache License 2.0", "lines": 116, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:mlflow/store/fs2db/_tracking.py
""" Migrate tracking store entities from FileStore to DB. FileStore layout: <mlruns>/ ├── <experiment_id>/ │ ├── meta.yaml -> experiments │ ├── tags/<key> -> experiment_tags │ ├── <run_uuid>/ │ │ ├── meta.yaml -> runs │ │ ├─...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/store/fs2db/_tracking.py", "license": "Apache License 2.0", "lines": 610, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:mlflow/store/fs2db/_utils.py
import logging from collections.abc import Iterator from dataclasses import dataclass, fields from pathlib import Path from typing import Any import yaml from mlflow.store.tracking.file_store import FileStore _logger = logging.getLogger(__name__) @dataclass class MigrationStats: experiments: int = 0 experi...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/store/fs2db/_utils.py", "license": "Apache License 2.0", "lines": 113, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:mlflow/store/fs2db/cli.py
from pathlib import Path import click from mlflow.store.fs2db import migrate from mlflow.utils.uri import get_uri_scheme @click.command("migrate-filestore") @click.option( "--source", required=True, type=click.Path(exists=True, file_okay=False, resolve_path=True), help="Root directory containing mlr...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/store/fs2db/cli.py", "license": "Apache License 2.0", "lines": 39, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:tests/store/fs2db/test_migration.py
import math from pathlib import Path from unittest import mock import pytest from sqlalchemy import create_engine, text from mlflow.entities import Experiment, Run, ViewType from mlflow.store.fs2db import migrate from mlflow.tracking import MlflowClient from mlflow.utils.file_utils import local_file_uri_to_path Clie...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/store/fs2db/test_migration.py", "license": "Apache License 2.0", "lines": 229, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:mlflow/mcp/decorator.py
""" Decorator for exposing MLflow CLI commands as MCP tools. Usage: from mlflow.mcp.decorator import mlflow_mcp @commands.command("search") @mlflow_mcp(tool_name="search_traces") @click.option(...) def search_traces(...): ... The decorator attaches MCP metadata to the Click command, which...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/mcp/decorator.py", "license": "Apache License 2.0", "lines": 54, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
mlflow/mlflow:tests/store/test_workspace_model_coverage.py
"""Verify that every SQLAlchemy model with a ``workspace`` column is handled by at least one workspace store's ``_get_query`` method. If a new model is added with a ``workspace`` column but the developer forgets to add it to ``_get_query``, that model's queries will bypass workspace isolation. This test catches that ...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/store/test_workspace_model_coverage.py", "license": "Apache License 2.0", "lines": 77, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:.github/workflows/triage.py
"""Triage GitHub issues: generate a comment requesting missing info.""" # ruff: noqa: T201 import argparse import concurrent.futures import json import os import re import sys import urllib.request from pathlib import Path from typing import Any PROMPT_TEMPLATE = """\ Triage the following GitHub issue and decide whet...
{ "repo_id": "mlflow/mlflow", "file_path": ".github/workflows/triage.py", "license": "Apache License 2.0", "lines": 204, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:fs2db/src/generate_synthetic_data.py
# ruff: noqa: T201 """ Generate synthetic MLflow FileStore data for testing the fs2db migration tool. Usage: uv run --with mlflow==3.6.0 --no-project python -I \ fs2db/src/generate_synthetic_data.py --output /tmp/fs2db/v3.6.0/ --size small This script uses the MLflow public API to create realistic on-disk...
{ "repo_id": "mlflow/mlflow", "file_path": "fs2db/src/generate_synthetic_data.py", "license": "Apache License 2.0", "lines": 354, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:mlflow/entities/workspace.py
"""Workspace entity shared between server and stores.""" from __future__ import annotations from dataclasses import dataclass from enum import Enum from typing import Any from mlflow.protos.service_pb2 import Workspace as ProtoWorkspace class WorkspaceDeletionMode(str, Enum): """Controls what happens to resour...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/entities/workspace.py", "license": "Apache License 2.0", "lines": 52, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:mlflow/server/workspace_helpers.py
from __future__ import annotations import logging import os from flask import Response, request from mlflow.entities import Workspace from mlflow.environment_variables import ( MLFLOW_ENABLE_WORKSPACES, MLFLOW_WORKSPACE_STORE_URI, ) from mlflow.exceptions import MlflowException from mlflow.protos import data...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/server/workspace_helpers.py", "license": "Apache License 2.0", "lines": 123, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:mlflow/store/db/workspace_migration.py
import sqlalchemy as sa from mlflow.store.workspace.sqlalchemy_store import _WORKSPACE_ROOT_MODELS from mlflow.utils.workspace_utils import DEFAULT_WORKSPACE_NAME # Derive table names from the shared ORM model list and add child/tags tables that also carry # a workspace column but are not "root" tables (they are upda...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/store/db/workspace_migration.py", "license": "Apache License 2.0", "lines": 134, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:mlflow/store/jobs/sqlalchemy_workspace_store.py
""" Workspace-aware variant of the jobs SQLAlchemy store. """ from __future__ import annotations import logging from mlflow.store.jobs.sqlalchemy_store import SqlAlchemyJobStore from mlflow.store.tracking.dbmodels.models import SqlJob from mlflow.store.workspace_aware_mixin import WorkspaceAwareMixin _logger = logg...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/store/jobs/sqlalchemy_workspace_store.py", "license": "Apache License 2.0", "lines": 26, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
mlflow/mlflow:mlflow/store/model_registry/sqlalchemy_workspace_store.py
""" Workspace-aware variant of the model registry SQLAlchemy store. """ from __future__ import annotations import logging from mlflow.store.model_registry.dbmodels.models import ( SqlModelVersion, SqlModelVersionTag, SqlRegisteredModel, SqlRegisteredModelAlias, SqlRegisteredModelTag, SqlWebho...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/store/model_registry/sqlalchemy_workspace_store.py", "license": "Apache License 2.0", "lines": 57, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:mlflow/store/tracking/sqlalchemy_workspace_store.py
from __future__ import annotations import logging import sqlalchemy import sqlalchemy.sql.expression as sql from sqlalchemy.exc import IntegrityError from sqlalchemy.future import select from mlflow.entities import ( Experiment, ) from mlflow.entities.entity_type import EntityAssociationType from mlflow.entities...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/store/tracking/sqlalchemy_workspace_store.py", "license": "Apache License 2.0", "lines": 421, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:mlflow/store/workspace/abstract_store.py
from __future__ import annotations import re from abc import ABC, abstractmethod from typing import Iterable from mlflow.entities import Workspace from mlflow.entities.workspace import WorkspaceDeletionMode from mlflow.exceptions import MlflowException # The workspace store can be backed by something other than the...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/store/workspace/abstract_store.py", "license": "Apache License 2.0", "lines": 99, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:mlflow/store/workspace/dbmodels/models.py
from __future__ import annotations import sqlalchemy as sa from sqlalchemy import Column, String, Text from mlflow.entities.workspace import Workspace from mlflow.store.db.base_sql_model import Base class SqlWorkspace(Base): __tablename__ = "workspaces" # Workspace-aware tables intentionally do not declare...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/store/workspace/dbmodels/models.py", "license": "Apache License 2.0", "lines": 23, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:mlflow/store/workspace/rest_store.py
from __future__ import annotations from urllib.parse import quote from mlflow.entities import Workspace from mlflow.entities.workspace import WorkspaceDeletionMode from mlflow.exceptions import MlflowException, RestException from mlflow.protos import databricks_pb2 from mlflow.protos.databricks_pb2 import INVALID_STA...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/store/workspace/rest_store.py", "license": "Apache License 2.0", "lines": 110, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:mlflow/store/workspace/sqlalchemy_store.py
from __future__ import annotations import logging from threading import Lock from typing import Iterable from cachetools import TTLCache from sqlalchemy.exc import IntegrityError from sqlalchemy.orm import sessionmaker from mlflow.entities.workspace import Workspace, WorkspaceDeletionMode from mlflow.environment_var...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/store/workspace/sqlalchemy_store.py", "license": "Apache License 2.0", "lines": 239, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:mlflow/store/workspace/utils.py
from __future__ import annotations import logging from mlflow.entities import Workspace from mlflow.protos import databricks_pb2 _INVALID_PARAMETER_VALUE_CODE = databricks_pb2.INVALID_PARAMETER_VALUE _INVALID_PARAMETER_VALUE_NAME = databricks_pb2.ErrorCode.Name(_INVALID_PARAMETER_VALUE_CODE) _logger = logging.getL...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/store/workspace/utils.py", "license": "Apache License 2.0", "lines": 30, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:mlflow/store/workspace_aware_mixin.py
""" Mixin class providing common workspace functionality for stores. """ from __future__ import annotations from mlflow.environment_variables import MLFLOW_ENABLE_WORKSPACES from mlflow.exceptions import MlflowException from mlflow.utils.workspace_context import get_request_workspace from mlflow.utils.workspace_utils...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/store/workspace_aware_mixin.py", "license": "Apache License 2.0", "lines": 49, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
mlflow/mlflow:mlflow/store/workspace_rest_store_mixin.py
from __future__ import annotations from mlflow.exceptions import MlflowException from mlflow.protos import databricks_pb2 from mlflow.utils.rest_utils import http_request from mlflow.utils.uri import is_databricks_uri from mlflow.utils.workspace_context import get_request_workspace class WorkspaceRestStoreMixin: ...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/store/workspace_rest_store_mixin.py", "license": "Apache License 2.0", "lines": 71, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:mlflow/tracking/_workspace/client.py
from __future__ import annotations from mlflow.entities.workspace import Workspace, WorkspaceDeletionMode from mlflow.tracking._workspace.registry import get_workspace_store class WorkspaceProviderClient: """ Client that exposes workspace CRUD operations via the configured provider. The provider is reso...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/tracking/_workspace/client.py", "license": "Apache License 2.0", "lines": 72, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:mlflow/tracking/_workspace/fluent.py
from __future__ import annotations import threading from typing import Callable, TypeVar from mlflow.entities.workspace import Workspace, WorkspaceDeletionMode from mlflow.exceptions import MlflowException, RestException from mlflow.protos import databricks_pb2 from mlflow.protos.databricks_pb2 import FEATURE_DISABLE...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/tracking/_workspace/fluent.py", "license": "Apache License 2.0", "lines": 115, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:mlflow/tracking/_workspace/registry.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...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/tracking/_workspace/registry.py", "license": "Apache License 2.0", "lines": 82, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:mlflow/utils/workspace_context.py
from __future__ import annotations from contextvars import ContextVar, Token from mlflow.environment_variables import MLFLOW_WORKSPACE from mlflow.utils.workspace_utils import DEFAULT_WORKSPACE_NAME _WORKSPACE: ContextVar[str | None] = ContextVar("mlflow_active_workspace", default=None) _IS_WORKSPACE_RESOLVED: Conte...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/utils/workspace_context.py", "license": "Apache License 2.0", "lines": 70, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:mlflow/utils/workspace_utils.py
from __future__ import annotations from mlflow.environment_variables import MLFLOW_WORKSPACE, MLFLOW_WORKSPACE_STORE_URI _workspace_store_uri: str | None = None DEFAULT_WORKSPACE_NAME = "default" WORKSPACES_DIR_NAME = "workspaces" WORKSPACE_HEADER_NAME = "X-MLFLOW-WORKSPACE" def _normalize_workspace(workspace: str...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/utils/workspace_utils.py", "license": "Apache License 2.0", "lines": 83, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
mlflow/mlflow:tests/db/test_workspace_migration.py
import os import re from contextlib import contextmanager import pytest import sqlalchemy as sa from alembic import command from mlflow.store.db.utils import _get_alembic_config from mlflow.store.tracking.dbmodels.initial_models import Base as InitialBase _LEGACY_REGISTERED_MODEL_TAGS = sa.table( "registered_mod...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/db/test_workspace_migration.py", "license": "Apache License 2.0", "lines": 1099, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/helpers/db_mocks.py
from __future__ import annotations from contextlib import contextmanager from unittest import mock def mock_get_managed_session_maker(*args, **kwargs): @contextmanager def _manager(): session = mock.MagicMock() def _mock_query(*q_args, **q_kwargs): query = mock.MagicMock() ...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/helpers/db_mocks.py", "license": "Apache License 2.0", "lines": 18, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/server/auth/test_auth_workspace.py
import json from contextlib import contextmanager from types import SimpleNamespace from unittest.mock import MagicMock, Mock import pytest from flask import Response, request from mlflow.environment_variables import MLFLOW_ENABLE_WORKSPACES from mlflow.exceptions import MlflowException from mlflow.protos.databricks_...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/server/auth/test_auth_workspace.py", "license": "Apache License 2.0", "lines": 987, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/server/auth/test_client_workspace.py
from contextlib import contextmanager import pytest import requests from mlflow import MlflowException from mlflow.environment_variables import ( MLFLOW_ENABLE_WORKSPACES, MLFLOW_FLASK_SERVER_SECRET_KEY, MLFLOW_TRACKING_PASSWORD, MLFLOW_TRACKING_USERNAME, MLFLOW_WORKSPACE_STORE_URI, ) from mlflow....
{ "repo_id": "mlflow/mlflow", "file_path": "tests/server/auth/test_client_workspace.py", "license": "Apache License 2.0", "lines": 309, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/server/auth/test_sqlalchemy_store_workspace.py
import pytest from mlflow.environment_variables import MLFLOW_ENABLE_WORKSPACES from mlflow.exceptions import MlflowException from mlflow.server.auth.entities import WorkspacePermission from mlflow.server.auth.permissions import EDIT, MANAGE, NO_PERMISSIONS, READ from mlflow.server.auth.sqlalchemy_store import SqlAlch...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/server/auth/test_sqlalchemy_store_workspace.py", "license": "Apache License 2.0", "lines": 179, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/server/jobs/test_jobs_workspace.py
import json import uuid from pathlib import Path from unittest.mock import MagicMock, patch import pytest from mlflow.entities import Workspace from mlflow.environment_variables import MLFLOW_ENABLE_WORKSPACES from mlflow.exceptions import MlflowException from mlflow.genai.scorers.builtin_scorers import Completeness ...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/server/jobs/test_jobs_workspace.py", "license": "Apache License 2.0", "lines": 75, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/server/test_otel_api.py
from unittest import mock from fastapi import FastAPI from fastapi.testclient import TestClient from opentelemetry.proto.collector.trace.v1.trace_service_pb2 import ExportTraceServiceRequest from mlflow.entities import Workspace from mlflow.environment_variables import MLFLOW_ENABLE_WORKSPACES from mlflow.server.fast...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/server/test_otel_api.py", "license": "Apache License 2.0", "lines": 209, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/server/test_workspace_endpoints.py
from __future__ import annotations import json from unittest import mock import pytest from flask import Flask from mlflow.entities.workspace import Workspace, WorkspaceDeletionMode from mlflow.server.handlers import get_endpoints @pytest.fixture(autouse=True) def enable_workspaces(monkeypatch): monkeypatch.se...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/server/test_workspace_endpoints.py", "license": "Apache License 2.0", "lines": 188, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/server/test_workspace_middleware.py
from __future__ import annotations import pytest import werkzeug from fastapi import FastAPI from fastapi.testclient import TestClient from flask import Flask from mlflow.entities import Workspace from mlflow.environment_variables import MLFLOW_ENABLE_WORKSPACES from mlflow.exceptions import MlflowException from mlfl...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/server/test_workspace_middleware.py", "license": "Apache License 2.0", "lines": 147, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/store/model_registry/test_rest_store_workspace.py
from unittest import mock import pytest from mlflow.exceptions import MlflowException from mlflow.store.model_registry.rest_store import RestStore from mlflow.utils.rest_utils import MlflowHostCreds ACTIVE_WORKSPACE = "team-a" def test_model_registry_rest_store_workspace_guard(): creds = MlflowHostCreds("https...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/store/model_registry/test_rest_store_workspace.py", "license": "Apache License 2.0", "lines": 19, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/store/model_registry/test_sqlalchemy_workspace_store.py
import shutil import uuid import pytest from mlflow.entities.model_registry import ModelVersionTag, RegisteredModelTag from mlflow.entities.webhook import WebhookAction, WebhookEntity, WebhookEvent from mlflow.environment_variables import MLFLOW_ENABLE_WORKSPACES from mlflow.exceptions import MlflowException from mlf...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/store/model_registry/test_sqlalchemy_workspace_store.py", "license": "Apache License 2.0", "lines": 330, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/store/tracking/test_rest_store_workspace.py
from unittest import mock import pytest from mlflow.exceptions import MlflowException from mlflow.store.tracking.rest_store import RestStore from mlflow.utils.rest_utils import MlflowHostCreds ACTIVE_WORKSPACE = "team-a" def test_supports_workspaces_queries_endpoint(): creds = MlflowHostCreds("https://example"...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/store/tracking/test_rest_store_workspace.py", "license": "Apache License 2.0", "lines": 84, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/store/tracking/test_sqlalchemy_workspace_store.py
import math import time import uuid from pathlib import Path from unittest import mock import pytest from mlflow.entities import ( Dataset, DatasetInput, Experiment, ExperimentTag, GatewayEndpointModelConfig, GatewayModelLinkageType, GatewayResourceType, InputTag, LoggedModelParame...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/store/tracking/test_sqlalchemy_workspace_store.py", "license": "Apache License 2.0", "lines": 1842, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/store/workspace/test_rest_store.py
from __future__ import annotations import json from types import SimpleNamespace from unittest import mock import pytest from mlflow.entities.workspace import Workspace, WorkspaceDeletionMode from mlflow.exceptions import MlflowException, RestException from mlflow.protos.service_pb2 import ( CreateWorkspace, ...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/store/workspace/test_rest_store.py", "license": "Apache License 2.0", "lines": 134, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/store/workspace/test_sqlalchemy_store.py
import pytest import sqlalchemy as sa from sqlalchemy.exc import IntegrityError from mlflow.entities.workspace import Workspace, WorkspaceDeletionMode from mlflow.exceptions import MlflowException from mlflow.store.workspace.dbmodels.models import SqlWorkspace from mlflow.store.workspace.sqlalchemy_store import SqlAlc...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/store/workspace/test_sqlalchemy_store.py", "license": "Apache License 2.0", "lines": 319, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/store/workspace/test_workspace_validator.py
import pytest from mlflow.exceptions import MlflowException from mlflow.store.workspace.abstract_store import WorkspaceNameValidator @pytest.mark.parametrize( "name", [ "team-a", "ab", "a" * 63, "123", "a1-b2", ], ) def test_workspace_name_validator_accepts_valid_n...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/store/workspace/test_workspace_validator.py", "license": "Apache License 2.0", "lines": 33, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/tracking/test_client_workspace.py
from __future__ import annotations from mlflow import MlflowClient from mlflow.environment_variables import MLFLOW_TRACKING_URI, MLFLOW_WORKSPACE_STORE_URI from mlflow.tracking._workspace import fluent as workspace_fluent from mlflow.utils.workspace_utils import DEFAULT_WORKSPACE_NAME def test_mlflow_client_resolves...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/tracking/test_client_workspace.py", "license": "Apache License 2.0", "lines": 97, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/tracking/test_workspace_registry.py
from __future__ import annotations import pytest from mlflow.store.workspace.rest_store import RestWorkspaceStore from mlflow.store.workspace.sqlalchemy_store import SqlAlchemyStore from mlflow.tracking._workspace.registry import ( UnsupportedWorkspaceStoreURIException, _get_workspace_store_registry, get_...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/tracking/test_workspace_registry.py", "license": "Apache License 2.0", "lines": 30, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/tracking/test_workspace_utils.py
import pytest from mlflow.environment_variables import MLFLOW_TRACKING_URI, MLFLOW_WORKSPACE_STORE_URI from mlflow.utils.workspace_utils import resolve_workspace_store_uri, set_workspace_store_uri @pytest.fixture(autouse=True) def _reset_workspace_uri(monkeypatch): set_workspace_store_uri(None) monkeypatch.d...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/tracking/test_workspace_utils.py", "license": "Apache License 2.0", "lines": 27, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/utils/test_workspace_utils.py
from __future__ import annotations import os from mlflow.environment_variables import MLFLOW_WORKSPACE from mlflow.utils.workspace_context import WorkspaceContext, clear_server_request_workspace from mlflow.utils.workspace_utils import ( DEFAULT_WORKSPACE_NAME, resolve_entity_workspace_name, ) def teardown_...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/utils/test_workspace_utils.py", "license": "Apache License 2.0", "lines": 28, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:dev/clint/src/clint/rules/unused_disable_comment.py
from clint.rules.base import Rule class UnusedDisableComment(Rule): def __init__(self, rule_name: str) -> None: self.rule_name = rule_name def _message(self) -> str: return f"Unused disable comment for rule `{self.rule_name}`"
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/src/clint/rules/unused_disable_comment.py", "license": "Apache License 2.0", "lines": 6, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:dev/clint/tests/rules/test_unused_disable_comment.py
from pathlib import Path from clint.config import Config from clint.linter import Position, Range, lint_file from clint.rules import UnusedDisableComment def test_stale_disable_comment(index_path: Path) -> None: code = """ import os # clint: disable=lazy-import """ config = Config(select={UnusedDisableComme...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/tests/rules/test_unused_disable_comment.py", "license": "Apache License 2.0", "lines": 72, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:dev/clint/tests/test_ignore_map.py
from clint.linter import DisableComment, parse_disable_comments def test_single_rule() -> None: code = """ x = 1 # clint: disable=rule-a y = 2 """ assert parse_disable_comments(code) == [DisableComment("rule-a", 1, 9, 1)] def test_multiple_rules() -> None: code = """ x = 1 # clint: disable=rule-a,rule...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/tests/test_ignore_map.py", "license": "Apache License 2.0", "lines": 61, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:mlflow/tracing/sampling.py
import contextvars from opentelemetry.sdk.trace.sampling import ( Sampler, SamplingResult, TraceIdRatioBased, ) # Context variable to override the sampling ratio for a specific trace. # When set, the sampler uses this ratio instead of the default. _SAMPLING_RATIO_OVERRIDE = contextvars.ContextVar("samplin...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/tracing/sampling.py", "license": "Apache License 2.0", "lines": 40, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:tests/gateway/test_tracing_utils.py
import pytest import mlflow from mlflow.entities import SpanType from mlflow.gateway.schemas.chat import StreamResponsePayload from mlflow.gateway.tracing_utils import ( _get_model_span_info, aggregate_chat_stream_chunks, maybe_traced_gateway_call, ) from mlflow.store.tracking.gateway.entities import Gatew...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/gateway/test_tracing_utils.py", "license": "Apache License 2.0", "lines": 516, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:mlflow/gateway/tracing_utils.py
import dataclasses import functools import inspect import logging from collections.abc import Callable from typing import Any import mlflow from mlflow.entities import SpanStatus, SpanType from mlflow.entities.trace_location import MlflowExperimentLocation from mlflow.gateway.config import GatewayRequestType from mlfl...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/gateway/tracing_utils.py", "license": "Apache License 2.0", "lines": 296, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:mlflow/cli/datasets.py
import json from typing import Any, Literal import click from mlflow import MlflowClient from mlflow.environment_variables import MLFLOW_EXPERIMENT_ID from mlflow.utils.string_utils import _create_table from mlflow.utils.time import conv_longdate_to_str EXPERIMENT_ID = click.option( "--experiment-id", "-x", ...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/cli/datasets.py", "license": "Apache License 2.0", "lines": 119, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:tests/cli/test_datasets.py
import json import pytest from click.testing import CliRunner import mlflow from mlflow.cli.datasets import commands from mlflow.genai.datasets import create_dataset @pytest.fixture def runner(): return CliRunner(catch_exceptions=False) @pytest.fixture def experiment(): exp_id = mlflow.create_experiment("...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/cli/test_datasets.py", "license": "Apache License 2.0", "lines": 129, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/gateway/providers/test_tracing.py
import time from typing import Any from unittest import mock import pytest import mlflow from mlflow.entities.trace_state import TraceState from mlflow.gateway.providers.base import BaseProvider, PassthroughAction from mlflow.gateway.schemas import chat, embeddings from mlflow.tracing.client import TracingClient from...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/gateway/providers/test_tracing.py", "license": "Apache License 2.0", "lines": 403, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:mlflow/cli/demo.py
import contextlib import logging import os import threading import time import webbrowser from collections.abc import Generator from pathlib import Path from urllib.parse import urljoin import click NOISY_LOGGERS = [ "alembic", "mlflow.store", "mlflow.tracking", "mlflow.tracing", "mlflow.genai", ...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/cli/demo.py", "license": "Apache License 2.0", "lines": 251, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:tests/demo/test_api_routes.py
from pathlib import Path import pytest import requests import mlflow from mlflow.server import handlers from mlflow.server.fastapi_app import app from mlflow.server.handlers import initialize_backend_stores from tests.helper_functions import get_safe_port from tests.tracking.integration_test_utils import ServerThrea...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/demo/test_api_routes.py", "license": "Apache License 2.0", "lines": 71, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/demo/test_cli.py
"""Tests for the mlflow demo CLI command. Includes both quick help/registration tests and functional tests that invoke the actual CLI command with a mocked server. """ import socket import sys from unittest import mock import click import pytest from click.testing import CliRunner import mlflow from mlflow.cli impo...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/demo/test_cli.py", "license": "Apache License 2.0", "lines": 127, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:mlflow/genai/simulators/distillation.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...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/simulators/distillation.py", "license": "Apache License 2.0", "lines": 138, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:mlflow/genai/simulators/utils.py
from __future__ import annotations import json import logging from contextlib import contextmanager from typing import TYPE_CHECKING, Any import mlflow from mlflow.exceptions import MlflowException from mlflow.genai.judges.adapters.databricks_managed_judge_adapter import ( call_chat_completions, create_litell...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/simulators/utils.py", "license": "Apache License 2.0", "lines": 111, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:tests/genai/simulators/test_distillation.py
from unittest import mock import pydantic import pytest from mlflow.entities.session import Session from mlflow.genai.simulators.distillation import ( _distill_goal_and_persona, _GoalAndPersona, generate_test_cases, ) @pytest.fixture def mock_session(): trace = mock.MagicMock() return Session([t...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/genai/simulators/test_distillation.py", "license": "Apache License 2.0", "lines": 175, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/genai/simulators/test_utils.py
from unittest import mock import pytest from mlflow.genai.simulators.utils import ( format_history, get_default_simulation_model, invoke_model_without_tracing, ) @pytest.mark.parametrize( ("history", "expected"), [ ([], None), ([{"role": "user", "content": "Hello"}], "user: Hello...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/genai/simulators/test_utils.py", "license": "Apache License 2.0", "lines": 80, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:examples/livekit/voice_agent.py
import logging import os from livekit.agents import JobContext, JobProcess, WorkerOptions, cli from livekit.agents.telemetry import set_tracer_provider from livekit.agents.voice import Agent, AgentSession from livekit.plugins import openai, silero from opentelemetry import trace from opentelemetry.exporter.otlp.proto....
{ "repo_id": "mlflow/mlflow", "file_path": "examples/livekit/voice_agent.py", "license": "Apache License 2.0", "lines": 59, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:mlflow/tracing/otel/translation/livekit.py
""" Translation utilities for LiveKit Agents semantic conventions. LiveKit Agents (Python SDK) provides real-time AI voice agents with built-in OpenTelemetry support. This translator maps LiveKit's span attributes to MLflow's semantic conventions for optimal visualization. Reference: - https://docs.livekit.io/agents/...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/tracing/otel/translation/livekit.py", "license": "Apache License 2.0", "lines": 91, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
mlflow/mlflow:tests/tracing/otel/test_livekit_translator.py
import json from unittest import mock import pytest from mlflow.entities.span import Span, SpanType from mlflow.tracing.constant import SpanAttributeKey from mlflow.tracing.otel.translation import ( translate_span_type_from_otel, translate_span_when_storing, ) from mlflow.tracing.otel.translation.livekit impo...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/tracing/otel/test_livekit_translator.py", "license": "Apache License 2.0", "lines": 263, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:mlflow/entities/session.py
from __future__ import annotations from typing import TYPE_CHECKING, Iterator from mlflow.tracing.constant import TraceMetadataKey if TYPE_CHECKING: from mlflow.entities import Trace class Session: """ A session object representing a group of traces that share the same session ID. Sessions typical...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/entities/session.py", "license": "Apache License 2.0", "lines": 32, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:mlflow/genai/utils/gateway_utils.py
from __future__ import annotations import base64 import os from dataclasses import dataclass from mlflow.environment_variables import MLFLOW_GATEWAY_URI from mlflow.exceptions import MlflowException from mlflow.tracking import get_tracking_uri from mlflow.utils.uri import append_to_uri_path, is_http_uri @dataclass ...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/utils/gateway_utils.py", "license": "Apache License 2.0", "lines": 53, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:tests/genai/utils/test_gateway_utils.py
import base64 from unittest import mock import pytest from mlflow.exceptions import MlflowException from mlflow.genai.utils.gateway_utils import GatewayLiteLLMConfig, get_gateway_litellm_config @pytest.mark.parametrize( ("gateway_uri", "tracking_uri", "endpoint_name", "expected_api_base"), [ # MLFLO...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/genai/utils/test_gateway_utils.py", "license": "Apache License 2.0", "lines": 96, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:mlflow/genai/scorers/trulens/models.py
from __future__ import annotations from typing import TYPE_CHECKING, Any from mlflow.exceptions import MlflowException from mlflow.genai.judges.adapters.databricks_managed_judge_adapter import ( call_chat_completions, ) from mlflow.genai.judges.constants import _DATABRICKS_DEFAULT_JUDGE_MODEL from mlflow.genai.ut...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/scorers/trulens/models.py", "license": "Apache License 2.0", "lines": 71, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:mlflow/genai/scorers/trulens/registry.py
from __future__ import annotations import re from typing import Any # Mapping: metric name -> (feedback method name, argument mapping) # Argument mapping: generic key -> TruLens-specific argument name _METRIC_REGISTRY: dict[str, tuple[str, dict[str, str]]] = { # RAG metrics "Groundedness": ( "grounded...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/scorers/trulens/registry.py", "license": "Apache License 2.0", "lines": 55, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:mlflow/genai/scorers/trulens/scorers/agent_trace.py
""" Agent trace scorers for goal-plan-action alignment evaluation. These scorers analyze agent execution traces to detect internal errors and evaluate the quality of agent reasoning, planning, and tool usage. Based on TruLens' benchmarked goal-plan-action alignment evaluations which achieve 95% error coverage against...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/scorers/trulens/scorers/agent_trace.py", "license": "Apache License 2.0", "lines": 205, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
mlflow/mlflow:mlflow/genai/scorers/trulens/utils.py
from __future__ import annotations import logging from typing import Any from mlflow.entities.trace import Trace from mlflow.genai.scorers.trulens.registry import build_trulens_args from mlflow.genai.utils.trace_utils import ( extract_retrieval_context_from_trace, parse_inputs_to_str, parse_outputs_to_str...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/scorers/trulens/utils.py", "license": "Apache License 2.0", "lines": 85, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:mlflow/genai/utils/message_utils.py
from __future__ import annotations from typing import Any def serialize_messages_to_prompts( messages: list[Any], ) -> tuple[str, str | None]: """ Serialize messages to user_prompt and system_prompt strings. Handles both litellm Message objects and message dicts with 'role' and 'content' keys. T...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/utils/message_utils.py", "license": "Apache License 2.0", "lines": 55, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:tests/genai/scorers/trulens/scorers/test_agent_trace.py
from unittest.mock import Mock, patch import pytest import trulens # noqa: F401 import mlflow from mlflow.entities.assessment import Feedback from mlflow.entities.assessment_source import AssessmentSourceType from mlflow.entities.span import SpanType from mlflow.exceptions import MlflowException @pytest.fixture de...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/genai/scorers/trulens/scorers/test_agent_trace.py", "license": "Apache License 2.0", "lines": 120, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/genai/scorers/trulens/test_models.py
import importlib from unittest.mock import Mock, patch import pytest import trulens # noqa: F401 from mlflow.exceptions import MlflowException from mlflow.genai.scorers.trulens.models import create_trulens_provider @pytest.fixture def mock_call_chat_completions(): with patch("mlflow.genai.scorers.trulens.model...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/genai/scorers/trulens/test_models.py", "license": "Apache License 2.0", "lines": 62, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/genai/scorers/trulens/test_registry.py
import pytest from mlflow.genai.scorers.trulens.registry import get_argument_mapping, get_feedback_method_name @pytest.mark.parametrize( ("metric_name", "expected_method"), [ ("Groundedness", "groundedness_measure_with_cot_reasons"), ("ContextRelevance", "context_relevance_with_cot_reasons"),...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/genai/scorers/trulens/test_registry.py", "license": "Apache License 2.0", "lines": 31, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/genai/scorers/trulens/test_trulens.py
from unittest.mock import Mock, patch import pytest import trulens # noqa: F401 from mlflow.entities.assessment import Feedback from mlflow.entities.assessment_source import AssessmentSourceType from mlflow.genai.judges.utils import CategoricalRating @pytest.fixture def mock_provider(): mock = Mock() mock....
{ "repo_id": "mlflow/mlflow", "file_path": "tests/genai/scorers/trulens/test_trulens.py", "license": "Apache License 2.0", "lines": 105, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/genai/scorers/trulens/test_utils.py
import pytest import mlflow from mlflow.genai.scorers.trulens.utils import ( format_rationale, map_scorer_inputs_to_trulens_args, ) def _create_test_trace( inputs: dict[str, str] | None = None, outputs: dict[str, str] | None = None, ): with mlflow.start_span() as span: if inputs is not No...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/genai/scorers/trulens/test_utils.py", "license": "Apache License 2.0", "lines": 109, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/genai/utils/test_message_utils.py
import pytest from mlflow.genai.utils.message_utils import serialize_messages_to_prompts from mlflow.types.llm import ChatMessage, FunctionToolCallArguments, ToolCall @pytest.mark.parametrize( ("messages", "expected_user_prompt", "expected_system_prompt"), [ # Basic user message (object) ( ...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/genai/utils/test_message_utils.py", "license": "Apache License 2.0", "lines": 172, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:dev/gen_rest_api.py
# /// script # dependencies = ["texttable"] # /// """Generate RST documentation from protobuf JSON definitions.""" from __future__ import annotations import json import logging import re from enum import Enum from pathlib import Path from textwrap import dedent from typing import Any from texttable import Texttable ...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/gen_rest_api.py", "license": "Apache License 2.0", "lines": 755, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:dev/proto_plugin.py
import json import sys import textwrap from dataclasses import asdict, dataclass from dataclasses import field as dataclass_field from enum import Enum from google.protobuf import descriptor_pb2 from google.protobuf.compiler import plugin_pb2 from mlflow.protos import databricks_pb2 class Visibility(Enum): PUBL...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/proto_plugin.py", "license": "Apache License 2.0", "lines": 460, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:mlflow/genai/scorers/guardrails/registry.py
from __future__ import annotations from mlflow.exceptions import MlflowException _SUPPORTED_VALIDATORS = [ "ToxicLanguage", "NSFWText", "DetectJailbreak", "DetectPII", "SecretsPresent", "GibberishText", ] def get_validator_class(validator_name: str): """ Get Guardrails AI validator c...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/scorers/guardrails/registry.py", "license": "Apache License 2.0", "lines": 32, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:mlflow/genai/scorers/guardrails/utils.py
from __future__ import annotations from typing import Any from mlflow.entities.trace import Trace from mlflow.exceptions import MlflowException from mlflow.genai.utils.trace_utils import ( parse_inputs_to_str, parse_outputs_to_str, resolve_inputs_from_trace, resolve_outputs_from_trace, ) def check_g...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/scorers/guardrails/utils.py", "license": "Apache License 2.0", "lines": 47, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:tests/genai/scorers/guardrails/test_guardrails.py
from unittest.mock import patch import guardrails import pytest from guardrails import Validator, register_validator from guardrails.classes.validation.validation_result import FailResult, PassResult import mlflow from mlflow.entities.assessment import Feedback from mlflow.entities.assessment_source import Assessment...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/genai/scorers/guardrails/test_guardrails.py", "license": "Apache License 2.0", "lines": 210, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/genai/scorers/guardrails/test_registry.py
from unittest.mock import MagicMock, patch import pytest from mlflow.exceptions import MlflowException from mlflow.genai.scorers.guardrails.registry import get_validator_class @pytest.mark.parametrize( ("validator_name", "expected_class"), [ ("ToxicLanguage", "ToxicLanguage"), ("NSFWText", "...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/genai/scorers/guardrails/test_registry.py", "license": "Apache License 2.0", "lines": 30, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/genai/scorers/guardrails/test_utils.py
import sys from unittest.mock import patch import pytest import mlflow from mlflow.exceptions import MlflowException from mlflow.genai.scorers.guardrails.utils import ( check_guardrails_installed, map_scorer_inputs_to_text, ) def _create_test_trace(inputs=None, outputs=None): """Create a test trace usin...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/genai/scorers/guardrails/test_utils.py", "license": "Apache License 2.0", "lines": 49, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:mlflow/demo/generators/prompts.py
from __future__ import annotations import logging from mlflow.demo.base import ( DEMO_EXPERIMENT_NAME, DEMO_PROMPT_PREFIX, BaseDemoGenerator, DemoFeature, DemoResult, ) from mlflow.demo.data import DEMO_PROMPTS, DemoPromptDef from mlflow.genai.prompts import ( delete_prompt_alias, register...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/demo/generators/prompts.py", "license": "Apache License 2.0", "lines": 110, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:tests/demo/test_prompts_generator.py
import pytest from mlflow.demo.base import DEMO_PROMPT_PREFIX, DemoFeature, DemoResult from mlflow.demo.data import DEMO_PROMPTS from mlflow.demo.generators.prompts import PromptsDemoGenerator from mlflow.genai.prompts import load_prompt, search_prompts @pytest.fixture def prompts_generator(): generator = Prompt...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/demo/test_prompts_generator.py", "license": "Apache License 2.0", "lines": 98, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:mlflow/demo/generators/evaluation.py
from __future__ import annotations import contextlib import hashlib import io import logging import os from collections.abc import Callable from typing import TYPE_CHECKING, Literal import mlflow if TYPE_CHECKING: from mlflow.genai.datasets import EvaluationDataset from mlflow.demo.base import ( DEMO_EXPERI...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/demo/generators/evaluation.py", "license": "Apache License 2.0", "lines": 333, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:tests/demo/test_evaluation_generator.py
import pytest import mlflow from mlflow.demo.base import DEMO_EXPERIMENT_NAME, DemoFeature, DemoResult from mlflow.demo.data import ALL_DEMO_TRACES from mlflow.demo.generators.evaluation import EvaluationDemoGenerator from mlflow.demo.generators.traces import TracesDemoGenerator @pytest.fixture def evaluation_genera...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/demo/test_evaluation_generator.py", "license": "Apache License 2.0", "lines": 84, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:mlflow/demo/data.py
from __future__ import annotations from dataclasses import dataclass, field from typing import Any from mlflow.demo.base import DEMO_PROMPT_PREFIX from mlflow.entities.model_registry import PromptVersion # ============================================================================= # Prompt Data Definitions # =====...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/demo/data.py", "license": "Apache License 2.0", "lines": 816, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex