sample_id
stringlengths
21
196
text
stringlengths
105
936k
metadata
dict
category
stringclasses
6 values
mlflow/mlflow:mlflow/genai/judges/tools/get_traces_in_session.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...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/judges/tools/get_traces_in_session.py", "license": "Apache License 2.0", "lines": 97, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:mlflow/genai/judges/tools/search_traces.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...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/judges/tools/search_traces.py", "license": "Apache License 2.0", "lines": 242, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:tests/genai/judges/test_judge_tool_get_traces_in_session.py
from unittest.mock import MagicMock, patch import pytest from mlflow.entities.trace import Trace, TraceData from mlflow.entities.trace_info import TraceInfo as MlflowTraceInfo from mlflow.entities.trace_location import TraceLocation from mlflow.entities.trace_state import TraceState from mlflow.exceptions import Mlfl...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/genai/judges/test_judge_tool_get_traces_in_session.py", "license": "Apache License 2.0", "lines": 130, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/genai/judges/test_judge_tool_search_traces.py
from unittest import mock import pytest from mlflow.entities.assessment import Expectation, Feedback from mlflow.entities.assessment_error import AssessmentError from mlflow.entities.assessment_source import AssessmentSource, AssessmentSourceType from mlflow.entities.span import Span from mlflow.entities.trace import...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/genai/judges/test_judge_tool_search_traces.py", "license": "Apache License 2.0", "lines": 370, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/tracing/test_otel_loading.py
import uuid from pathlib import Path import pytest from opentelemetry import trace as otel_trace from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter from opentelemetry.sdk.resources import Resource as OTelSDKResource from opentelemetry.sdk.trace import TracerProvider from opentelemetry.s...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/tracing/test_otel_loading.py", "license": "Apache License 2.0", "lines": 449, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/genai/scorers/test_scorer_description.py
from unittest.mock import patch import pytest from mlflow.genai import scorer from mlflow.genai.judges import make_judge from mlflow.genai.judges.instructions_judge import InstructionsJudge from mlflow.genai.scorers import RelevanceToQuery @pytest.fixture(autouse=True) def mock_databricks_runtime(): with patch(...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/genai/scorers/test_scorer_description.py", "license": "Apache License 2.0", "lines": 115, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/pytorch/test_forecasting_model.py
import os import numpy as np import pytest import torch from lightning.pytorch import Trainer from pytorch_forecasting import DeepAR, TimeSeriesDataSet from pytorch_forecasting.data.examples import generate_ar_data import mlflow @pytest.fixture def model_path(tmp_path): return os.path.join(tmp_path, "model") ...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/pytorch/test_forecasting_model.py", "license": "Apache License 2.0", "lines": 53, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:mlflow/tracing/databricks.py
from mlflow.exceptions import MlflowException from mlflow.utils.annotations import experimental from mlflow.utils.uri import is_databricks_uri @experimental(version="3.5.0") def set_databricks_monitoring_sql_warehouse_id( sql_warehouse_id: str, experiment_id: str | None = None ) -> None: """ Set the SQL w...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/tracing/databricks.py", "license": "Apache License 2.0", "lines": 37, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:tests/tracing/test_databricks.py
from unittest import mock import pytest from mlflow.exceptions import MlflowException from mlflow.tracing.databricks import set_databricks_monitoring_sql_warehouse_id def test_set_databricks_monitoring_sql_warehouse_id_requires_databricks_tracking_uri(): with mock.patch("mlflow.get_tracking_uri", return_value="...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/tracing/test_databricks.py", "license": "Apache License 2.0", "lines": 43, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:mlflow/genai/judges/prompts/equivalence.py
from mlflow.genai.prompts.utils import format_prompt # NB: User-facing name for the equivalence assessment. EQUIVALENCE_FEEDBACK_NAME = "equivalence" EQUIVALENCE_PROMPT_INSTRUCTIONS = """\ Compare the following actual output against the expected output. You must determine whether they \ are semantically equivalent o...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/judges/prompts/equivalence.py", "license": "Apache License 2.0", "lines": 34, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
mlflow/mlflow:mlflow/genai/optimize/optimize.py
import logging import uuid from concurrent.futures import ThreadPoolExecutor from contextlib import nullcontext from typing import TYPE_CHECKING, Any, Callable import mlflow from mlflow.entities import Trace from mlflow.entities.evaluation_dataset import EvaluationDataset as EntityEvaluationDataset from mlflow.entitie...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/optimize/optimize.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/genai/optimize/optimizers/base.py
from abc import ABC, abstractmethod from typing import Any, Callable from mlflow.genai.optimize.types import EvaluationResultRecord, PromptOptimizerOutput from mlflow.utils.annotations import experimental # The evaluation function that takes candidate prompts as a dict # (prompt template name -> prompt template) and ...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/optimize/optimizers/base.py", "license": "Apache License 2.0", "lines": 34, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
mlflow/mlflow:tests/genai/optimize/test_optimize.py
from typing import Any import pandas as pd import pytest import mlflow from mlflow.entities.model_registry import PromptModelConfig from mlflow.exceptions import MlflowException from mlflow.genai.datasets import create_dataset from mlflow.genai.optimize.optimize import optimize_prompts from mlflow.genai.optimize.opti...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/genai/optimize/test_optimize.py", "license": "Apache License 2.0", "lines": 398, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:mlflow/tracing/utils/prompt.py
import json from mlflow.entities.model_registry import PromptVersion from mlflow.exceptions import MlflowException from mlflow.tracing.constant import TraceTagKey # TODO: Remove tag based linking once we migrate to LinkPromptsToTraces endpoint def update_linked_prompts_tag(current_tag_value: str | None, prompt_versi...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/tracing/utils/prompt.py", "license": "Apache License 2.0", "lines": 38, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:tests/tracing/utils/test_prompt.py
import json import pytest from mlflow.entities.model_registry import PromptVersion from mlflow.exceptions import MlflowException from mlflow.tracing.utils.prompt import update_linked_prompts_tag def test_update_linked_prompts_tag(): pv1 = PromptVersion(name="test_prompt", version=1, template="Test template") ...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/tracing/utils/test_prompt.py", "license": "Apache License 2.0", "lines": 31, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:dev/clint/src/clint/rules/nested_mock_patch.py
import ast from clint.resolver import Resolver from clint.rules.base import Rule class NestedMockPatch(Rule): def _message(self) -> str: return ( "Do not nest `unittest.mock.patch` context managers. " "Use multiple context managers in a single `with` statement instead: " ...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/src/clint/rules/nested_mock_patch.py", "license": "Apache License 2.0", "lines": 45, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:dev/clint/tests/rules/test_nested_mock_patch.py
from pathlib import Path from clint.config import Config from clint.linter import Position, Range, lint_file from clint.rules.nested_mock_patch import NestedMockPatch def test_nested_mock_patch_unittest_mock(index_path: Path) -> None: code = """ import unittest.mock def test_foo(): with unittest.mock.patch(...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/tests/rules/test_nested_mock_patch.py", "license": "Apache License 2.0", "lines": 161, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:mlflow/cli/scorers.py
import json from typing import Literal import click from mlflow.environment_variables import MLFLOW_EXPERIMENT_ID from mlflow.genai.judges import make_judge from mlflow.genai.scorers import get_all_scorers from mlflow.genai.scorers import list_scorers as list_scorers_api from mlflow.mcp.decorator import mlflow_mcp fr...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/cli/scorers.py", "license": "Apache License 2.0", "lines": 168, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:tests/cli/test_scorers.py
import json from typing import Any from unittest.mock import patch import pytest from click.testing import CliRunner import mlflow from mlflow.cli.scorers import commands from mlflow.exceptions import MlflowException from mlflow.genai.scorers import get_all_scorers, list_scorers, scorer from mlflow.utils.string_utils...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/cli/test_scorers.py", "license": "Apache License 2.0", "lines": 503, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:dev/clint/src/clint/rules/mock_patch_dict_environ.py
import ast from clint.resolver import Resolver from clint.rules.base import Rule class MockPatchDictEnviron(Rule): def _message(self) -> str: return ( "Do not use `mock.patch.dict` to modify `os.environ` in tests; " "use pytest's monkeypatch fixture (monkeypatch.setenv / monkeypat...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/src/clint/rules/mock_patch_dict_environ.py", "license": "Apache License 2.0", "lines": 36, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:dev/clint/tests/rules/test_mock_patch_dict_environ.py
from pathlib import Path from clint.config import Config from clint.linter import Position, Range, lint_file from clint.rules.mock_patch_dict_environ import MockPatchDictEnviron def test_mock_patch_dict_environ_with_string_literal(index_path: Path) -> None: code = """ import os from unittest import mock # Bad -...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/tests/rules/test_mock_patch_dict_environ.py", "license": "Apache License 2.0", "lines": 110, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:dev/clint/src/clint/rules/mock_patch_as_decorator.py
import ast from clint.resolver import Resolver from clint.rules.base import Rule class MockPatchAsDecorator(Rule): def _message(self) -> str: return ( "Do not use `unittest.mock.patch` as a decorator. " "Use it as a context manager to avoid patches being active longer than needed ...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/src/clint/rules/mock_patch_as_decorator.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:dev/clint/tests/rules/test_mock_patch_as_decorator.py
from pathlib import Path from clint.config import Config from clint.linter import Position, Range, lint_file from clint.rules.mock_patch_as_decorator import MockPatchAsDecorator def test_mock_patch_as_decorator_unittest_mock(index_path: Path) -> None: code = """ import unittest.mock @unittest.mock.patch("foo.ba...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/tests/rules/test_mock_patch_as_decorator.py", "license": "Apache License 2.0", "lines": 86, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:mlflow/cli/eval.py
""" CLI commands for evaluating traces with scorers. """ import json from typing import Literal import click import pandas as pd import mlflow from mlflow.cli.genai_eval_utils import ( extract_assessments_from_results, format_table_output, resolve_scorers, ) from mlflow.entities import Trace from mlflow....
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/cli/eval.py", "license": "Apache License 2.0", "lines": 106, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:tests/cli/test_eval.py
import re from unittest import mock import click import pandas as pd import pytest import mlflow from mlflow.cli.eval import evaluate_traces from mlflow.entities import Trace, TraceInfo from mlflow.genai.scorers.base import scorer def test_evaluate_traces_with_single_trace_table_output(): experiment_id = mlflow...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/cli/test_eval.py", "license": "Apache License 2.0", "lines": 185, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/gateway/providers/test_traffic_route_provider.py
from typing import Any import pytest from mlflow.gateway.config import EndpointConfig from mlflow.gateway.providers.base import TrafficRouteProvider from tests.gateway.providers.test_openai import ( _run_test_chat, _run_test_chat_stream, _run_test_completions, _run_test_completions_stream, _run_t...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/gateway/providers/test_traffic_route_provider.py", "license": "Apache License 2.0", "lines": 60, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:mlflow/server/jobs/_job_subproc_entry.py
""" This module is used for launching subprocess to execute the job function. If the job has timeout setting, or the job has pip requirements dependencies, or the job has extra environment variables setting, the job is executed as a subprocess. """ import importlib import json import logging import os import threadin...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/server/jobs/_job_subproc_entry.py", "license": "Apache License 2.0", "lines": 63, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:mlflow/genai/optimize/optimizers/gepa_optimizer.py
import json import logging import tempfile from pathlib import Path from typing import TYPE_CHECKING, Any import mlflow from mlflow.exceptions import MlflowException from mlflow.genai.optimize.optimizers.base import BasePromptOptimizer, _EvalFunc from mlflow.genai.optimize.types import EvaluationResultRecord, PromptOp...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/optimize/optimizers/gepa_optimizer.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:tests/genai/optimize/optimizers/test_gepa_optimizer.py
import json import sys from pathlib import Path from typing import Any from unittest.mock import MagicMock, Mock, patch import pytest import mlflow from mlflow.genai.optimize.optimizers.gepa_optimizer import GepaPromptOptimizer from mlflow.genai.optimize.types import EvaluationResultRecord, PromptOptimizerOutput @p...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/genai/optimize/optimizers/test_gepa_optimizer.py", "license": "Apache License 2.0", "lines": 560, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:mlflow/store/tracking/databricks_rest_store.py
import base64 import logging from collections import defaultdict from datetime import datetime from typing import Any from urllib.parse import quote, urlencode from opentelemetry.proto.collector.trace.v1.trace_service_pb2 import ExportTraceServiceRequest from pydantic import BaseModel from mlflow.entities import Asse...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/store/tracking/databricks_rest_store.py", "license": "Apache License 2.0", "lines": 957, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:mlflow/tracing/enablement.py
""" Trace enablement functionality for MLflow to enable tracing to Databricks Storage. """ import logging import mlflow from mlflow.entities.trace_location import UCSchemaLocation from mlflow.exceptions import MlflowException from mlflow.utils.annotations import experimental from mlflow.utils.uri import is_databricks...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/tracing/enablement.py", "license": "Apache License 2.0", "lines": 126, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
mlflow/mlflow:mlflow/tracing/export/uc_table.py
import logging from typing import Sequence from opentelemetry.sdk.trace import ReadableSpan from mlflow.entities.span import Span from mlflow.entities.trace_info import TraceInfo from mlflow.environment_variables import MLFLOW_ENABLE_ASYNC_TRACE_LOGGING from mlflow.tracing.export.mlflow_v3 import MlflowV3SpanExporter...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/tracing/export/uc_table.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/processor/uc_table.py
import logging from opentelemetry.sdk.trace import ReadableSpan as OTelReadableSpan from opentelemetry.sdk.trace import Span as OTelSpan from opentelemetry.sdk.trace.export import SpanExporter from mlflow.entities.trace_info import TraceInfo from mlflow.entities.trace_location import TraceLocation, UCSchemaLocation, ...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/tracing/processor/uc_table.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/databricks_tracing_utils.py
import logging from google.protobuf.duration_pb2 import Duration from google.protobuf.timestamp_pb2 import Timestamp from mlflow.entities import Assessment, Span, Trace, TraceData, TraceInfo from mlflow.entities.trace_info_v2 import _truncate_request_metadata, _truncate_tags from mlflow.entities.trace_location import...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/utils/databricks_tracing_utils.py", "license": "Apache License 2.0", "lines": 246, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:tests/store/tracking/test_databricks_rest_store.py
import base64 import json import time from unittest import mock import pytest from google.protobuf.json_format import MessageToDict from opentelemetry.proto.trace.v1.trace_pb2 import Span as OTelProtoSpan import mlflow from mlflow.entities import Span from mlflow.entities.assessment import ( AssessmentSource, ...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/store/tracking/test_databricks_rest_store.py", "license": "Apache License 2.0", "lines": 1709, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/tracing/export/test_uc_table_exporter.py
import time from concurrent.futures import ThreadPoolExecutor from unittest import mock import pytest from mlflow.entities.span import Span from mlflow.tracing.export.uc_table import DatabricksUCTableSpanExporter from mlflow.tracing.trace_manager import InMemoryTraceManager from mlflow.tracing.utils import generate_t...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/tracing/export/test_uc_table_exporter.py", "license": "Apache License 2.0", "lines": 214, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/tracing/processor/test_uc_table_processor.py
from unittest import mock import pytest import mlflow import mlflow.tracking.context.default_context from mlflow.entities.span import LiveSpan from mlflow.entities.trace_location import TraceLocationType, UCSchemaLocation from mlflow.entities.trace_state import TraceState from mlflow.environment_variables import MLFL...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/tracing/processor/test_uc_table_processor.py", "license": "Apache License 2.0", "lines": 138, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/tracing/test_enablement.py
""" Tests for mlflow.tracing.enablement module """ from unittest import mock import pytest import mlflow from mlflow.entities.trace_location import UCSchemaLocation from mlflow.exceptions import MlflowException from mlflow.tracing.enablement import ( set_experiment_trace_location, unset_experiment_trace_loca...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/tracing/test_enablement.py", "license": "Apache License 2.0", "lines": 119, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/utils/test_databricks_tracing_utils.py
import json import pytest from google.protobuf.timestamp_pb2 import Timestamp import mlflow from mlflow.entities import ( AssessmentSource, Expectation, Feedback, Trace, TraceData, TraceInfo, TraceState, ) from mlflow.entities.trace_location import ( InferenceTableLocation, MlflowE...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/utils/test_databricks_tracing_utils.py", "license": "Apache License 2.0", "lines": 440, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:dev/clint/src/clint/rules/redundant_test_docstring.py
"""Rule to detect redundant docstrings in test functions and classes. This rule flags ALL single-line docstrings in test functions and classes. Single-line docstrings in tests rarely provide meaningful context and are typically redundant. Multi-line docstrings are always allowed as they generally provide meaningful co...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/src/clint/rules/redundant_test_docstring.py", "license": "Apache License 2.0", "lines": 56, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:dev/clint/tests/rules/test_redundant_test_docstring.py
from pathlib import Path from clint.config import Config from clint.linter import lint_file from clint.rules.redundant_test_docstring import RedundantTestDocstring def test_redundant_docstrings_are_flagged(index_path: Path) -> None: code = ''' def test_feature_a(): """ This test verifies that feature A w...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/tests/rules/test_redundant_test_docstring.py", "license": "Apache License 2.0", "lines": 175, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:mlflow/server/fastapi_security.py
import logging from http import HTTPStatus from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware from starlette.types import ASGIApp from mlflow.environment_variables import ( MLFLOW_SERVER_DISABLE_SECURITY_MIDDLEWARE, MLFLOW_SERVER_X_FRAME_OPTIONS, ) from mlflow.server.security_utils...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/server/fastapi_security.py", "license": "Apache License 2.0", "lines": 151, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:mlflow/server/security.py
import logging from http import HTTPStatus from flask import Flask, Response, request from flask_cors import CORS from mlflow.environment_variables import ( MLFLOW_SERVER_DISABLE_SECURITY_MIDDLEWARE, MLFLOW_SERVER_X_FRAME_OPTIONS, ) from mlflow.server.security_utils import ( CORS_BLOCKED_MSG, HEALTH_E...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/server/security.py", "license": "Apache License 2.0", "lines": 91, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:mlflow/server/security_utils.py
""" Shared security utilities for MLflow server middleware. This module contains common functions used by both Flask and FastAPI security implementations. """ import fnmatch from urllib.parse import urlparse from mlflow.environment_variables import ( MLFLOW_SERVER_ALLOWED_HOSTS, MLFLOW_SERVER_CORS_ALLOWED_OR...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/server/security_utils.py", "license": "Apache License 2.0", "lines": 119, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:tests/server/test_security.py
import pytest from fastapi import FastAPI from flask import Flask from starlette.testclient import TestClient from werkzeug.test import Client from mlflow.server import security from mlflow.server.fastapi_security import init_fastapi_security from mlflow.server.security_utils import is_allowed_host_header, is_api_endp...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/server/test_security.py", "license": "Apache License 2.0", "lines": 266, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/server/test_security_integration.py
import json import pytest from werkzeug.test import Client @pytest.mark.parametrize( ("host", "origin", "expected_status", "should_block"), [ ("evil.attacker.com:5000", "http://evil.attacker.com:5000", 403, True), ("localhost:5000", None, None, False), ], ) def test_dns_rebinding_and_cors...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/server/test_security_integration.py", "license": "Apache License 2.0", "lines": 100, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:mlflow/cli/genai_eval_utils.py
""" Utility functions for trace evaluation output formatting. """ from dataclasses import dataclass from typing import Any import click import pandas as pd from mlflow.exceptions import MlflowException from mlflow.genai.scorers import Scorer, get_all_scorers, get_scorer from mlflow.tracing.constant import Assessment...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/cli/genai_eval_utils.py", "license": "Apache License 2.0", "lines": 213, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:tests/cli/test_genai_eval_utils.py
from unittest import mock import click import pandas as pd import pytest from mlflow.cli.genai_eval_utils import ( NA_VALUE, Assessment, EvalResult, extract_assessments_from_results, format_table_output, resolve_scorers, ) from mlflow.exceptions import MlflowException from mlflow.tracing.const...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/cli/test_genai_eval_utils.py", "license": "Apache License 2.0", "lines": 405, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/claude_code/test_autolog.py
import sys from unittest.mock import MagicMock, patch import pytest from claude_agent_sdk.types import AssistantMessage, ResultMessage, TextBlock, UserMessage import mlflow.anthropic from mlflow.anthropic.autolog import patched_claude_sdk_init def test_anthropic_autolog_without_claude_sdk(): sys.modules.pop("cl...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/claude_code/test_autolog.py", "license": "Apache License 2.0", "lines": 125, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/server/jobs/test_utils.py
import os import pytest from mlflow.exceptions import MlflowException from mlflow.server.jobs.utils import _load_function, _validate_function_parameters pytestmark = pytest.mark.skipif( os.name == "nt", reason="MLflow job execution is not supported on Windows" ) def test_validate_function_parameters(): def...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/server/jobs/test_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:examples/pytorch/HPOExample/hpo_mnist.py
""" Hyperparameter Optimization Example with Pure PyTorch and MLflow This example demonstrates: - Using MLflow to track hyperparameter optimization trials - Parent/child run structure for organizing HPO experiments - Pure PyTorch training (no Lightning dependencies) - Simple MNIST classification with configurable hype...
{ "repo_id": "mlflow/mlflow", "file_path": "examples/pytorch/HPOExample/hpo_mnist.py", "license": "Apache License 2.0", "lines": 126, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:mlflow/server/jobs/_huey_consumer.py
""" This module is used for launching Huey consumer the command is like: ``` export _MLFLOW_HUEY_STORAGE_PATH={huey_store_dir} export _MLFLOW_HUEY_INSTANCE_KEY={huey_instance_key} huey_consumer.py mlflow.server.jobs.huey_consumer.huey_instance -w {max_workers} ``` It launches the Huey consumer that polls tasks from ...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/server/jobs/_huey_consumer.py", "license": "Apache License 2.0", "lines": 31, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:mlflow/server/jobs/_job_runner.py
""" This module is used for launching the job runner process. The job runner will: * enqueue all unfinished huey tasks when MLflow server is down last time. * Watch the `_MLFLOW_HUEY_STORAGE_PATH` path, if new files (named like `XXX.mlflow-huey-store`) are created, it means a new Huey queue is created, then the jo...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/server/jobs/_job_runner.py", "license": "Apache License 2.0", "lines": 37, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:tests/webhooks/test_delivery.py
from pathlib import Path from unittest.mock import patch import pytest from mlflow.entities.webhook import Webhook, WebhookAction, WebhookEntity, WebhookEvent from mlflow.store.model_registry.file_store import FileStore from mlflow.store.model_registry.sqlalchemy_store import SqlAlchemyStore from mlflow.webhooks.deli...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/webhooks/test_delivery.py", "license": "Apache License 2.0", "lines": 95, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:mlflow/genai/labeling/databricks_utils.py
""" Databricks utilities for MLflow GenAI labeling functionality. """ _ERROR_MSG = ( "The `databricks-agents` package is required to use labeling functionality. " "Please install it with `pip install databricks-agents`." ) def get_databricks_review_app(experiment_id: str | None = None): """Import databri...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/labeling/databricks_utils.py", "license": "Apache License 2.0", "lines": 14, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:mlflow/genai/labeling/stores.py
""" Labeling store functionality for MLflow GenAI. This module provides store implementations to manage labeling sessions and schemas """ import warnings from abc import ABCMeta, abstractmethod from typing import TYPE_CHECKING, Any, Callable from mlflow.entities import Trace from mlflow.exceptions import MlflowExcep...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/labeling/stores.py", "license": "Apache License 2.0", "lines": 409, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:mlflow/genai/judges/tools/get_span_performance_and_timing_report.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...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/judges/tools/get_span_performance_and_timing_report.py", "license": "Apache License 2.0", "lines": 419, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:tests/genai/judges/test_judge_tool_get_span_performance_and_timing_report.py
from mlflow.entities.span import Span from mlflow.entities.trace import Trace from mlflow.entities.trace_data import TraceData from mlflow.entities.trace_info import TraceInfo from mlflow.entities.trace_location import TraceLocation from mlflow.entities.trace_state import TraceState from mlflow.genai.judges.tools.get_s...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/genai/judges/test_judge_tool_get_span_performance_and_timing_report.py", "license": "Apache License 2.0", "lines": 728, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/langchain/test_responses_agent_langchain.py
import json from langchain_core.messages import AIMessage, HumanMessage, ToolMessage from mlflow.types.responses import ResponsesAgentStreamEvent, output_to_responses_items_stream def test_output_to_responses_items_stream_langchain(): """ Tests langchain message stream to responses items stream conversion. ...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/langchain/test_responses_agent_langchain.py", "license": "Apache License 2.0", "lines": 395, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:mlflow/server/job_api.py
""" Internal job APIs for UI invocation """ import json from typing import Any from fastapi import APIRouter, HTTPException from pydantic import BaseModel from mlflow.entities._job import Job as JobEntity from mlflow.entities._job_status import JobStatus from mlflow.exceptions import MlflowException job_api_router ...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/server/job_api.py", "license": "Apache License 2.0", "lines": 106, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:dev/clint/src/clint/rules/isinstance_union_syntax.py
import ast from clint.rules.base import Rule class IsinstanceUnionSyntax(Rule): def _message(self) -> str: return ( "Use `isinstance(obj, (X, Y))` instead of `isinstance(obj, X | Y)`. " "The union syntax with `|` is slower than using a tuple of types." ) @staticmethod...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/src/clint/rules/isinstance_union_syntax.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:dev/clint/tests/rules/test_isinstance_union_syntax.py
from pathlib import Path from clint.config import Config from clint.linter import Position, Range, lint_file from clint.rules import IsinstanceUnionSyntax def test_isinstance_union_syntax(index_path: Path) -> None: code = """ # Bad - basic union syntax isinstance(obj, str | int) isinstance(value, int | str | flo...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/tests/rules/test_isinstance_union_syntax.py", "license": "Apache License 2.0", "lines": 34, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:mlflow/entities/_job.py
import json from typing import Any from mlflow.entities._job_status import JobStatus from mlflow.entities._mlflow_object import _MlflowObject from mlflow.utils.workspace_utils import resolve_entity_workspace_name class Job(_MlflowObject): """ MLflow entity representing a Job. """ def __init__( ...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/entities/_job.py", "license": "Apache License 2.0", "lines": 98, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:mlflow/entities/_job_status.py
from enum import Enum from mlflow.exceptions import MlflowException from mlflow.protos.jobs_pb2 import JobStatus as ProtoJobStatus class JobStatus(str, Enum): """Enum for status of a Job.""" PENDING = "PENDING" RUNNING = "RUNNING" SUCCEEDED = "SUCCEEDED" FAILED = "FAILED" TIMEOUT = "TIMEOUT"...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/entities/_job_status.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/jobs/abstract_store.py
from abc import ABC, abstractmethod from typing import Any, Iterator from mlflow.entities._job import Job from mlflow.entities._job_status import JobStatus from mlflow.utils.annotations import developer_stable @developer_stable class AbstractJobStore(ABC): """ Abstract class that defines API interfaces for s...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/store/jobs/abstract_store.py", "license": "Apache License 2.0", "lines": 140, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
mlflow/mlflow:mlflow/store/jobs/sqlalchemy_store.py
import json import threading import uuid from typing import Any, Iterator import sqlalchemy from mlflow.entities._job import Job from mlflow.entities._job_status import JobStatus from mlflow.exceptions import MlflowException from mlflow.protos.databricks_pb2 import RESOURCE_DOES_NOT_EXIST from mlflow.store.db.utils i...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/store/jobs/sqlalchemy_store.py", "license": "Apache License 2.0", "lines": 337, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:dev/check_init_py.py
""" Pre-commit hook to check for missing `__init__.py` files in mlflow and tests directories. This script ensures that all directories under the mlflow package and tests directory that contain Python files also have an `__init__.py` file. This prevents `setuptools` from excluding these directories during package build...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/check_init_py.py", "license": "Apache License 2.0", "lines": 42, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:tests/dev/test_check_init_py.py
import subprocess import sys from pathlib import Path import pytest def get_check_init_py_script() -> Path: return Path(__file__).resolve().parents[2] / "dev" / "check_init_py.py" @pytest.fixture def temp_git_repo(tmp_path: Path) -> Path: subprocess.check_call(["git", "init"], cwd=tmp_path) subprocess....
{ "repo_id": "mlflow/mlflow", "file_path": "tests/dev/test_check_init_py.py", "license": "Apache License 2.0", "lines": 171, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:dev/clint/tests/test_index.py
from pathlib import Path from unittest.mock import patch from clint.index import SymbolIndex def test_symbol_index_build_basic(tmp_path: Path) -> None: mlflow_dir = tmp_path / "mlflow" mlflow_dir.mkdir() test_file = mlflow_dir / "test.py" test_file.write_text("def test_function(): pass") mock_g...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/tests/test_index.py", "license": "Apache License 2.0", "lines": 31, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:dev/clint/src/clint/rules/temp_dir_in_test.py
import ast from clint.resolver import Resolver from clint.rules.base import Rule class TempDirInTest(Rule): def _message(self) -> str: return "Do not use `tempfile.TemporaryDirectory` in test directly. Use `tmp_path` fixture (https://docs.pytest.org/en/stable/reference/reference.html#tmp-path)." @st...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/src/clint/rules/temp_dir_in_test.py", "license": "Apache License 2.0", "lines": 12, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:dev/clint/tests/rules/test_temp_dir_in_test.py
from pathlib import Path from clint.config import Config from clint.linter import Position, Range, lint_file from clint.rules.temp_dir_in_test import TempDirInTest def test_temp_dir_in_test(index_path: Path) -> None: code = """ import tempfile # Bad def test_func(): tempfile.TemporaryDirectory() # Good def...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/tests/rules/test_temp_dir_in_test.py", "license": "Apache License 2.0", "lines": 109, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:dev/clint/src/clint/rules/os_chdir_in_test.py
import ast from clint.resolver import Resolver from clint.rules.base import Rule class OsChdirInTest(Rule): def _message(self) -> str: return "Do not use `os.chdir` in test directly. Use `monkeypatch.chdir` (https://docs.pytest.org/en/stable/reference/reference.html#pytest.MonkeyPatch.chdir)." @stat...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/src/clint/rules/os_chdir_in_test.py", "license": "Apache License 2.0", "lines": 12, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:dev/clint/tests/rules/test_os_chdir_in_test.py
from pathlib import Path from clint.config import Config from clint.linter import Position, Range, lint_file from clint.rules.os_chdir_in_test import OsChdirInTest def test_os_chdir_in_test(index_path: Path) -> None: code = """ import os # Bad def test_func(): os.chdir("/tmp") # Good def non_test_func(): ...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/tests/rules/test_os_chdir_in_test.py", "license": "Apache License 2.0", "lines": 83, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:dev/clint/tests/test_resolve_paths.py
from __future__ import annotations import subprocess from pathlib import Path from unittest.mock import patch import pytest from clint.utils import ALLOWED_EXTS, _git_ls_files, resolve_paths @pytest.fixture def git_repo(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> Path: """Create and initialize a git rep...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/tests/test_resolve_paths.py", "license": "Apache License 2.0", "lines": 199, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:dev/clint/tests/test_config.py
import subprocess from pathlib import Path from typing import Generator import pytest from clint.config import Config from clint.utils import get_repo_root @pytest.fixture(autouse=True) def clear_repo_root_cache() -> Generator[None, None, None]: """Clear the get_repo_root cache before each test to avoid cross-te...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/tests/test_config.py", "license": "Apache License 2.0", "lines": 100, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:examples/haystack/tracing.py
import os from getpass import getpass from haystack import Pipeline from haystack.components.builders import ChatPromptBuilder from haystack.components.generators.chat import OpenAIChatGenerator from haystack.components.retrievers.in_memory import InMemoryBM25Retriever from haystack.components.routers import Condition...
{ "repo_id": "mlflow/mlflow", "file_path": "examples/haystack/tracing.py", "license": "Apache License 2.0", "lines": 119, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:mlflow/haystack/autolog.py
import json import logging import threading from typing import Any from haystack.tracing import OpenTelemetryTracer, enable_tracing from opentelemetry import trace from opentelemetry.context import Context from opentelemetry.sdk.trace import ReadableSpan as OTelReadableSpan from opentelemetry.sdk.trace import Span as ...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/haystack/autolog.py", "license": "Apache License 2.0", "lines": 206, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:tests/haystack/test_haystack_tracing.py
from unittest.mock import patch from haystack import Document, Pipeline, component from haystack.components.rankers import LostInTheMiddleRanker from haystack.components.retrievers import InMemoryBM25Retriever from haystack.document_stores.in_memory import InMemoryDocumentStore import mlflow from mlflow.entities impo...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/haystack/test_haystack_tracing.py", "license": "Apache License 2.0", "lines": 163, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:dev/xtest_viz.py
# /// script # dependencies = [ # "aiohttp", # ] # /// """ Script to visualize cross-version test results for MLflow autologging and models. This script fetches scheduled workflow run results from GitHub Actions and generates a markdown table showing the test status for different package versions across different ...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/xtest_viz.py", "license": "Apache License 2.0", "lines": 281, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:mlflow/genai/judges/base.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...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/judges/base.py", "license": "Apache License 2.0", "lines": 109, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
mlflow/mlflow:mlflow/genai/judges/builtin_judges.py
from mlflow.genai.judges.base import Judge from mlflow.genai.scorers.builtin_scorers import BuiltInScorer from mlflow.utils.annotations import experimental @experimental(version="3.4.0") class BuiltinJudge(BuiltInScorer, Judge): """ Base class for built-in AI judge scorers that use LLMs for evaluation. ""...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/judges/builtin_judges.py", "license": "Apache License 2.0", "lines": 8, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:mlflow/genai/judges/constants.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" ...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/judges/constants.py", "license": "Apache License 2.0", "lines": 101, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:mlflow/genai/judges/instructions_judge/constants.py
""" Constants for the InstructionsJudge module. This module contains constant values used by the InstructionsJudge class, including the augmented prompt template for trace-based evaluation. """ # Common base prompt for all judge evaluations JUDGE_BASE_PROMPT = """You are an expert judge tasked with evaluating the per...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/judges/instructions_judge/constants.py", "license": "Apache License 2.0", "lines": 51, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
mlflow/mlflow:mlflow/genai/judges/make_judge.py
from typing import Any, Literal, 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 from mlflow.utils.annotations import experimenta...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/judges/make_judge.py", "license": "Apache License 2.0", "lines": 206, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
mlflow/mlflow:mlflow/genai/judges/optimizers/dspy.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...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/judges/optimizers/dspy.py", "license": "Apache License 2.0", "lines": 212, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:mlflow/genai/judges/optimizers/dspy_utils.py
"""Utility functions for DSPy-based alignment optimizers.""" import logging import os from contextlib import contextmanager from typing import TYPE_CHECKING, Any, Callable, Iterator, Optional from mlflow import __version__ as VERSION from mlflow.entities.assessment_source import AssessmentSourceType from mlflow.entit...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/judges/optimizers/dspy_utils.py", "license": "Apache License 2.0", "lines": 478, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:mlflow/genai/judges/optimizers/simba.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, )...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/judges/optimizers/simba.py", "license": "Apache License 2.0", "lines": 96, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
mlflow/mlflow:mlflow/genai/judges/tools/base.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...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/judges/tools/base.py", "license": "Apache License 2.0", "lines": 42, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
mlflow/mlflow:mlflow/genai/judges/tools/constants.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. """ from mlflow.utils.annotations import experimental # Tool names @experimental(version="3.4.0") class ToolNames: """Regist...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/judges/tools/constants.py", "license": "Apache License 2.0", "lines": 18, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:mlflow/genai/judges/tools/get_root_span.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...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/judges/tools/get_root_span.py", "license": "Apache License 2.0", "lines": 97, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:mlflow/genai/judges/tools/get_span.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...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/judges/tools/get_span.py", "license": "Apache License 2.0", "lines": 118, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:mlflow/genai/judges/tools/get_trace_info.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...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/judges/tools/get_trace_info.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/genai/judges/tools/list_spans.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...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/judges/tools/list_spans.py", "license": "Apache License 2.0", "lines": 106, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:mlflow/genai/judges/tools/registry.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...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/judges/tools/registry.py", "license": "Apache License 2.0", "lines": 117, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:mlflow/genai/judges/tools/search_trace_regex.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...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/judges/tools/search_trace_regex.py", "license": "Apache License 2.0", "lines": 148, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:mlflow/genai/judges/tools/types.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...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/judges/tools/types.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/genai/judges/tools/utils.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 from mlflow.utils.annotations import experimental @exper...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/judges/tools/utils.py", "license": "Apache License 2.0", "lines": 38, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
mlflow/mlflow:tests/genai/judges/optimizers/test_dspy_base.py
from typing import Any, Callable, Collection from unittest.mock import MagicMock, Mock, patch import dspy import litellm import pytest from mlflow.entities.trace import Trace from mlflow.exceptions import MlflowException from mlflow.genai.judges import make_judge from mlflow.genai.judges.optimizers.dspy import DSPyAl...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/genai/judges/optimizers/test_dspy_base.py", "license": "Apache License 2.0", "lines": 385, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/genai/judges/optimizers/test_dspy_utils.py
from unittest.mock import MagicMock, Mock, patch import dspy import pytest from mlflow.exceptions import MlflowException from mlflow.genai.judges.base import JudgeField from mlflow.genai.judges.optimizers.dspy_utils import ( AgentEvalLM, agreement_metric, append_input_fields_section, construct_dspy_lm...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/genai/judges/optimizers/test_dspy_utils.py", "license": "Apache License 2.0", "lines": 380, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/genai/judges/optimizers/test_simba.py
from importlib import reload from unittest.mock import MagicMock, patch import dspy import pytest from mlflow.exceptions import MlflowException from mlflow.genai.judges.optimizers import SIMBAAlignmentOptimizer def test_dspy_optimize_no_dspy(): # Since dspy import is now at module level, we need to test this di...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/genai/judges/optimizers/test_simba.py", "license": "Apache License 2.0", "lines": 91, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test