sample_id
stringlengths
21
196
text
stringlengths
105
936k
metadata
dict
category
stringclasses
6 values
mlflow/mlflow:tests/genai/judges/test_alignment_optimizer.py
from unittest.mock import Mock, patch import pytest from mlflow.entities.trace import Trace from mlflow.genai.judges import AlignmentOptimizer, Judge, make_judge from mlflow.genai.judges.base import JudgeField from mlflow.genai.scorers import UserFrustration class MockJudge(Judge): """Mock Judge implementation ...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/genai/judges/test_alignment_optimizer.py", "license": "Apache License 2.0", "lines": 114, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/genai/judges/test_judge_base.py
from typing import Any import pytest from mlflow.entities.assessment import Feedback from mlflow.entities.trace import Trace from mlflow.genai.judges import Judge from mlflow.genai.judges.base import JudgeField from mlflow.genai.scorers.base import Scorer class MockJudgeImplementation(Judge): def __init__(self,...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/genai/judges/test_judge_base.py", "license": "Apache License 2.0", "lines": 88, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/genai/judges/test_judge_tool_get_root_span.py
import pytest 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.jud...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/genai/judges/test_judge_tool_get_root_span.py", "license": "Apache License 2.0", "lines": 208, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/genai/judges/test_judge_tool_get_span.py
import pytest 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.jud...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/genai/judges/test_judge_tool_get_span.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/genai/judges/test_judge_tool_get_trace_info.py
from mlflow.entities.trace import Trace 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_trace_info import GetTraceInfoTool from mlflow.types.llm import ToolDefinition def tes...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/genai/judges/test_judge_tool_get_trace_info.py", "license": "Apache License 2.0", "lines": 61, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/genai/judges/test_judge_tool_list_spans.py
from unittest import mock import pytest from mlflow.entities.span import Span from mlflow.entities.span_status import SpanStatus, SpanStatusCode 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...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/genai/judges/test_judge_tool_list_spans.py", "license": "Apache License 2.0", "lines": 123, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/genai/judges/test_judge_tool_registry.py
import inspect import json import pytest import mlflow from mlflow.entities.span import SpanType from mlflow.entities.trace import Trace from mlflow.entities.trace_info import TraceInfo from mlflow.entities.trace_location import TraceLocation from mlflow.entities.trace_state import TraceState from mlflow.exceptions i...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/genai/judges/test_judge_tool_registry.py", "license": "Apache License 2.0", "lines": 166, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/genai/judges/test_make_judge.py
import json import sys import types import typing from dataclasses import asdict from typing import Any, Literal from unittest import mock from unittest.mock import patch import litellm import pandas as pd import pydantic import pytest from opentelemetry.sdk.trace import ReadableSpan as OTelReadableSpan import mlflow...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/genai/judges/test_make_judge.py", "license": "Apache License 2.0", "lines": 3006, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/genai/judges/test_search_trace_regex_tool.py
import json import pytest 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.search_trace_re...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/genai/judges/test_search_trace_regex_tool.py", "license": "Apache License 2.0", "lines": 254, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:mlflow/genai/prompts/utils.py
import re from typing import Any def format_prompt(prompt: str, **values: Any) -> str: """Format double-curly variables in the prompt template.""" for key, value in values.items(): # Escape backslashes in the replacement string to prevent re.sub from interpreting # them as escape sequences (e....
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/prompts/utils.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/src/clint/rules/no_shebang.py
from clint.rules.base import Rule class NoShebang(Rule): def _message(self) -> str: return "Python scripts should not contain shebang lines" @staticmethod def check(file_content: str) -> bool: """ Returns True if the file contains a shebang line at the beginning. A sheban...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/src/clint/rules/no_shebang.py", "license": "Apache License 2.0", "lines": 11, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:dev/clint/tests/rules/test_no_shebang.py
from pathlib import Path import pytest from clint.config import Config from clint.linter import Position, Range, lint_file from clint.rules import NoShebang def test_no_shebang(index_path: Path) -> None: config = Config(select={NoShebang.name}) # Test file with shebang - should trigger violation code = ...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/tests/rules/test_no_shebang.py", "license": "Apache License 2.0", "lines": 53, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/genai/scorers/test_builtin_scorers_registration.py
from pathlib import Path from typing import Iterator from unittest import mock import pytest import mlflow from mlflow.exceptions import MlflowException from mlflow.genai.scorers import RetrievalRelevance, Safety, Scorer from mlflow.genai.scorers.base import ScorerSamplingConfig @pytest.fixture def mock_databricks_...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/genai/scorers/test_builtin_scorers_registration.py", "license": "Apache License 2.0", "lines": 108, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:mlflow/genai/judges/prompts/retrieval_relevance.py
from mlflow.genai.prompts.utils import format_prompt RETRIEVAL_RELEVANCE_PROMPT = """\ Consider the following question and document. You must determine whether the document provides information that is (fully or partially) relevant to the question. Do not focus on the correctness or completeness of the document. Do no...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/judges/prompts/retrieval_relevance.py", "license": "Apache License 2.0", "lines": 17, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
mlflow/mlflow:mlflow/genai/judges/prompts/safety.py
from mlflow.genai.prompts.utils import format_prompt # NB: User-facing name for the safety assessment. SAFETY_ASSESSMENT_NAME = "safety" SAFETY_PROMPT = """\ You are a content safety classifier. Analyze the given text against policies prohibiting hate speech, harassment, incitement of violence, and the promotion of ...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/judges/prompts/safety.py", "license": "Apache License 2.0", "lines": 14, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
mlflow/mlflow:mlflow/data/evaluation_dataset_source.py
from typing import Any from mlflow.data.dataset_source import DatasetSource class EvaluationDatasetSource(DatasetSource): """ Represents the source of an evaluation dataset stored in MLflow's tracking store. """ def __init__(self, dataset_id: str): """ Args: dataset_id: T...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/data/evaluation_dataset_source.py", "license": "Apache License 2.0", "lines": 49, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:mlflow/entities/dataset_record.py
from __future__ import annotations import json from dataclasses import dataclass from typing import Any from google.protobuf.json_format import MessageToDict from mlflow.entities._mlflow_object import _MlflowObject from mlflow.entities.dataset_record_source import DatasetRecordSource, DatasetRecordSourceType from ml...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/entities/dataset_record.py", "license": "Apache License 2.0", "lines": 157, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:mlflow/entities/dataset_record_source.py
from __future__ import annotations import json from dataclasses import asdict, dataclass from enum import Enum from typing import Any from mlflow.entities._mlflow_object import _MlflowObject from mlflow.exceptions import MlflowException from mlflow.protos.databricks_pb2 import INVALID_PARAMETER_VALUE from mlflow.prot...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/entities/dataset_record_source.py", "license": "Apache License 2.0", "lines": 99, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:mlflow/entities/evaluation_dataset.py
from __future__ import annotations import json from enum import Enum from typing import TYPE_CHECKING, Any from mlflow.data import Dataset from mlflow.data.evaluation_dataset_source import EvaluationDatasetSource from mlflow.data.pyfunc_dataset_mixin import PyFuncConvertibleDatasetMixin from mlflow.entities._mlflow_o...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/entities/evaluation_dataset.py", "license": "Apache License 2.0", "lines": 519, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:mlflow/store/tracking/_sql_backend_utils.py
from functools import wraps from typing import Any, Callable, TypeVar, cast from mlflow.exceptions import MlflowException from mlflow.protos.databricks_pb2 import FEATURE_DISABLED F = TypeVar("F", bound=Callable[..., Any]) def filestore_not_supported(func: F) -> F: """ Decorator for FileStore methods that a...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/store/tracking/_sql_backend_utils.py", "license": "Apache License 2.0", "lines": 25, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:tests/entities/test_dataset_record.py
import json import pytest from mlflow.entities.dataset_record import DatasetRecord from mlflow.entities.dataset_record_source import DatasetRecordSource from mlflow.protos.datasets_pb2 import DatasetRecord as ProtoDatasetRecord from mlflow.protos.datasets_pb2 import DatasetRecordSource as ProtoDatasetRecordSource d...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/entities/test_dataset_record.py", "license": "Apache License 2.0", "lines": 428, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/entities/test_dataset_record_source.py
import json import pytest from mlflow.entities.dataset_record_source import DatasetRecordSource, DatasetRecordSourceType from mlflow.exceptions import MlflowException from mlflow.protos.datasets_pb2 import DatasetRecordSource as ProtoDatasetRecordSource def test_dataset_record_source_type_constants(): assert Da...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/entities/test_dataset_record_source.py", "license": "Apache License 2.0", "lines": 168, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/entities/test_evaluation_dataset.py
import json from unittest.mock import Mock, patch import pandas as pd import pytest from opentelemetry.sdk.trace import ReadableSpan as OTelReadableSpan from mlflow.entities.dataset_record import DatasetRecord from mlflow.entities.dataset_record_source import DatasetRecordSourceType from mlflow.entities.evaluation_da...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/entities/test_evaluation_dataset.py", "license": "Apache License 2.0", "lines": 619, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/genai/datasets/test_fluent.py
import json import os import sys import warnings from unittest import mock import pandas as pd import pytest import mlflow from mlflow.data import Dataset from mlflow.data.pyfunc_dataset_mixin import PyFuncConvertibleDatasetMixin from mlflow.entities.dataset_record_source import DatasetRecordSourceType from mlflow.en...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/genai/datasets/test_fluent.py", "license": "Apache License 2.0", "lines": 1832, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:mlflow/ai_commands/ai_command_utils.py
"""Core module for managing MLflow commands.""" import os import re from pathlib import Path from typing import Any import yaml def parse_frontmatter(content: str) -> tuple[dict[str, Any], str]: """Parse frontmatter from markdown content. Args: content: Markdown content with optional YAML frontmatt...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/ai_commands/ai_command_utils.py", "license": "Apache License 2.0", "lines": 88, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:tests/ai_commands/test_ai_command_utils.py
import platform from unittest import mock import pytest from mlflow.ai_commands import get_command, get_command_body, list_commands, parse_frontmatter def test_parse_frontmatter_with_metadata(): content = """--- namespace: genai description: Test command --- # Command content This is the body.""" metadata...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/ai_commands/test_ai_command_utils.py", "license": "Apache License 2.0", "lines": 200, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/cli/test_ai_commands.py
from unittest import mock from click.testing import CliRunner from mlflow.cli import cli def test_list_commands_cli(): mock_commands = [ { "key": "genai/analyze_experiment", "namespace": "genai", "description": "Analyzes an MLflow experiment", }, { ...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/cli/test_ai_commands.py", "license": "Apache License 2.0", "lines": 152, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:bin/install.py
""" Install binary tools for MLflow development. """ # ruff: noqa: T201 import argparse import gzip import http.client import json import platform import subprocess import tarfile import time import urllib.request from dataclasses import dataclass from pathlib import Path from typing import Literal from urllib.error i...
{ "repo_id": "mlflow/mlflow", "file_path": "bin/install.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/tracing/processor/otel_metrics_mixin.py
""" Mixin class for OpenTelemetry span processors that provides metrics recording functionality. This mixin allows different span processor implementations to share common metrics logic while maintaining their own inheritance hierarchies (BatchSpanProcessor, SimpleSpanProcessor). """ import logging from typing import...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/tracing/processor/otel_metrics_mixin.py", "license": "Apache License 2.0", "lines": 100, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:tests/tracing/processor/test_otel_metrics.py
import time import pytest from opentelemetry import metrics from opentelemetry.sdk.metrics import MeterProvider from opentelemetry.sdk.metrics.export import InMemoryMetricReader import mlflow @pytest.fixture def metric_reader() -> InMemoryMetricReader: """Create an in-memory metric reader for testing.""" re...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/tracing/processor/test_otel_metrics.py", "license": "Apache License 2.0", "lines": 84, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:dev/clint/src/clint/rules/forbidden_deprecation_warning.py
import ast from clint.resolver import Resolver from clint.rules.base import Rule def _is_deprecation_warning(expr: ast.expr) -> bool: return isinstance(expr, ast.Name) and expr.id == "DeprecationWarning" class ForbiddenDeprecationWarning(Rule): def _message(self) -> str: return ( "Do no...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/src/clint/rules/forbidden_deprecation_warning.py", "license": "Apache License 2.0", "lines": 27, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:dev/clint/tests/rules/test_forbidden_deprecation_warning.py
from pathlib import Path from clint.config import Config from clint.linter import Position, Range, lint_file from clint.rules import ForbiddenDeprecationWarning def test_forbidden_deprecation_warning(index_path: Path) -> None: code = """ import warnings # Bad - should be flagged warnings.warn("message", categor...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/tests/rules/test_forbidden_deprecation_warning.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/mcp/cli.py
import click from mlflow.mcp.server import run_server from mlflow.telemetry.events import McpRunEvent from mlflow.telemetry.track import record_usage_event @click.group( "mcp", help=( "Model Context Protocol (MCP) server for MLflow. " "MCP enables LLM applications to interact with MLflow trac...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/mcp/cli.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:mlflow/mcp/server.py
import contextlib import io import os from typing import TYPE_CHECKING, Any, Callable import click from click.types import BOOL, FLOAT, INT, STRING, UUID import mlflow.deployments.cli as deployments_cli import mlflow.experiments import mlflow.models.cli as models_cli import mlflow.runs from mlflow.ai_commands.ai_comm...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/mcp/server.py", "license": "Apache License 2.0", "lines": 183, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:tests/mcp/test_cli.py
import sys import pytest from fastmcp import Client from fastmcp.client.transports import StdioTransport import mlflow @pytest.mark.asyncio async def test_cli(): transport = StdioTransport( command=sys.executable, args=[ "-m", "mlflow", "mcp", "run...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/mcp/test_cli.py", "license": "Apache License 2.0", "lines": 23, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/mcp/test_mcp.py
import sys from collections.abc import AsyncIterator import pytest import pytest_asyncio from fastmcp import Client from fastmcp.client.transports import StdioTransport import mlflow from mlflow.mcp import server @pytest_asyncio.fixture() async def client() -> AsyncIterator[Client]: transport = StdioTransport( ...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/mcp/test_mcp.py", "license": "Apache License 2.0", "lines": 139, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:mlflow/genai/git_versioning/git_info.py
import logging from dataclasses import dataclass from typing_extensions import Self from mlflow.utils.mlflow_tags import ( MLFLOW_GIT_BRANCH, MLFLOW_GIT_COMMIT, MLFLOW_GIT_DIFF, MLFLOW_GIT_DIRTY, MLFLOW_GIT_REPO_URL, ) _logger = logging.getLogger(__name__) class GitOperationError(Exception): ...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/git_versioning/git_info.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:tests/genai/test_git_versioning.py
import subprocess from pathlib import Path from unittest import mock import pytest import mlflow from mlflow.genai import disable_git_model_versioning, enable_git_model_versioning from mlflow.genai.git_versioning import _get_active_git_context from mlflow.utils.mlflow_tags import MLFLOW_GIT_DIFF @pytest.fixture(aut...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/genai/test_git_versioning.py", "license": "Apache License 2.0", "lines": 207, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:mlflow/store/artifact/databricks_run_artifact_repo.py
import re from mlflow.store.artifact.databricks_tracking_artifact_repo import ( DatabricksTrackingArtifactRepository, ) class DatabricksRunArtifactRepository(DatabricksTrackingArtifactRepository): """ Artifact repository for interacting with run artifacts in a Databricks workspace. If operations usin...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/store/artifact/databricks_run_artifact_repo.py", "license": "Apache License 2.0", "lines": 26, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:mlflow/store/artifact/databricks_tracking_artifact_repo.py
import logging import re from abc import ABC, abstractmethod from mlflow.entities import FileInfo from mlflow.exceptions import MlflowException from mlflow.store.artifact.artifact_repo import ArtifactRepository from mlflow.store.artifact.databricks_artifact_repo import DatabricksArtifactRepository from mlflow.store.ar...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/store/artifact/databricks_tracking_artifact_repo.py", "license": "Apache License 2.0", "lines": 81, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:tests/store/artifact/test_databricks_run_artifact_repo.py
from pathlib import Path from unittest import mock import pytest from databricks.sdk.service.files import DirectoryEntry from mlflow.entities.file_info import FileInfo from mlflow.store.artifact.databricks_run_artifact_repo import DatabricksRunArtifactRepository @pytest.fixture(autouse=True) def set_fake_databricks...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/store/artifact/test_databricks_run_artifact_repo.py", "license": "Apache License 2.0", "lines": 239, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:mlflow/store/analytics/trace_correlation.py
import math from dataclasses import dataclass # Recommended smoothing parameter for NPMI calculation # Using Jeffreys prior (alpha=0.5) to minimize bias while providing robust estimates JEFFREYS_PRIOR = 0.5 @dataclass class TraceCorrelationCounts: """ Count statistics for trace correlation analysis. Thi...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/store/analytics/trace_correlation.py", "license": "Apache License 2.0", "lines": 163, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
mlflow/mlflow:mlflow/tracing/analysis.py
import math from dataclasses import dataclass from mlflow.entities._mlflow_object import _MlflowObject from mlflow.protos.service_pb2 import CalculateTraceFilterCorrelation @dataclass class TraceFilterCorrelationResult(_MlflowObject): """ Result of calculating correlation between two trace filter conditions....
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/tracing/analysis.py", "license": "Apache License 2.0", "lines": 71, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
mlflow/mlflow:mlflow/cli/traces.py
""" Comprehensive MLflow Traces CLI for managing trace data, assessments, and metadata. This module provides a complete command-line interface for working with MLflow traces, including search, retrieval, deletion, tagging, and assessment management. It supports both table and JSON output formats with flexible field se...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/cli/traces.py", "license": "Apache License 2.0", "lines": 780, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:mlflow/utils/jsonpath_utils.py
""" JSONPath utilities for navigating and manipulating nested JSON structures. This module provides a simplified JSONPath-like implementation without adding external dependencies to MLflow. Instead of using a full JSONPath library, we implement a lightweight subset focused on trace data navigation using dot notation w...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/utils/jsonpath_utils.py", "license": "Apache License 2.0", "lines": 271, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:tests/cli/test_traces.py
import json import logging from unittest import mock import pytest from click.testing import CliRunner from mlflow.cli.traces import commands from mlflow.entities import ( AssessmentSourceType, MlflowExperimentLocation, Trace, TraceData, TraceInfo, TraceLocation, TraceLocationType, Tra...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/cli/test_traces.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/utils/test_jsonpath_utils.py
import pytest from mlflow.utils.jsonpath_utils import ( filter_json_by_fields, jsonpath_extract_values, split_path_respecting_backticks, validate_field_paths, ) def test_jsonpath_extract_values_simple(): data = {"info": {"trace_id": "tr-123", "state": "OK"}} values = jsonpath_extract_values(d...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/utils/test_jsonpath_utils.py", "license": "Apache License 2.0", "lines": 196, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:mlflow/genai/utils/display_utils.py
import sys from mlflow.entities import Run from mlflow.store.tracking.rest_store import RestStore from mlflow.tracing.display.display_handler import _is_jupyter from mlflow.tracking._tracking_service.utils import _get_store, get_tracking_uri from mlflow.utils.mlflow_tags import MLFLOW_DATABRICKS_WORKSPACE_URL from mlf...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/utils/display_utils.py", "license": "Apache License 2.0", "lines": 134, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
mlflow/mlflow:tests/genai/utils/test_display_utils.py
from unittest import mock import mlflow from mlflow.genai.utils import display_utils from mlflow.store.tracking.rest_store import RestStore from mlflow.tracking.client import MlflowClient from mlflow.utils.mlflow_tags import MLFLOW_DATABRICKS_WORKSPACE_URL def test_display_outputs_jupyter(monkeypatch): mock_stor...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/genai/utils/test_display_utils.py", "license": "Apache License 2.0", "lines": 62, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:mlflow/tracing/archival.py
_ERROR_MSG = ( "The `databricks-agents` package is required to use databricks trace archival. " "Please install it with `pip install databricks-agents`." ) def enable_databricks_trace_archival( *, delta_table_fullname: str, experiment_id: str | None = None, ) -> None: """ Enable archiving ...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/tracing/archival.py", "license": "Apache License 2.0", "lines": 50, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
mlflow/mlflow:tests/tracing/test_archival.py
from unittest import mock import pytest from mlflow.tracing.archival import ( disable_databricks_trace_archival, enable_databricks_trace_archival, ) from mlflow.version import IS_TRACING_SDK_ONLY if IS_TRACING_SDK_ONLY: pytest.skip("Databricks archival enablement requires skinny", allow_module_level=True...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/tracing/test_archival.py", "license": "Apache License 2.0", "lines": 63, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:dev/clint/src/clint/rules/no_class_based_tests.py
import ast from typing_extensions import Self from clint.rules.base import Rule class NoClassBasedTests(Rule): def __init__(self, class_name: str) -> None: self.class_name = class_name @classmethod def check(cls, node: ast.ClassDef, path_name: str) -> Self | None: # Only check in test f...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/src/clint/rules/no_class_based_tests.py", "license": "Apache License 2.0", "lines": 26, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:dev/clint/tests/rules/test_no_class_based_tests.py
from pathlib import Path from clint.config import Config from clint.linter import Position, Range, lint_file from clint.rules.no_class_based_tests import NoClassBasedTests def test_no_class_based_tests(index_path: Path) -> None: code = """import pytest # Bad - class-based test with test methods class TestSometh...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/tests/rules/test_no_class_based_tests.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/claude_code/cli.py
"""MLflow CLI commands for Claude Code integration.""" from pathlib import Path import click from mlflow.claude_code.config import get_tracing_status, setup_environment_config from mlflow.claude_code.hooks import disable_tracing_hooks, setup_hooks_config @click.group("autolog") def commands(): """Commands for ...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/claude_code/cli.py", "license": "Apache License 2.0", "lines": 122, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:mlflow/claude_code/config.py
"""Configuration management for Claude Code integration with MLflow.""" import json import os from dataclasses import dataclass from pathlib import Path from typing import Any from mlflow.environment_variables import ( MLFLOW_EXPERIMENT_ID, MLFLOW_EXPERIMENT_NAME, MLFLOW_TRACKING_URI, ) # Configuration f...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/claude_code/config.py", "license": "Apache License 2.0", "lines": 122, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:mlflow/claude_code/hooks.py
"""Hook management for Claude Code integration with MLflow.""" import json import os import sys from pathlib import Path from typing import Any from mlflow.claude_code.config import ( ENVIRONMENT_FIELD, HOOK_FIELD_COMMAND, HOOK_FIELD_HOOKS, MLFLOW_EXPERIMENT_ID, MLFLOW_EXPERIMENT_NAME, MLFLOW_...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/claude_code/hooks.py", "license": "Apache License 2.0", "lines": 193, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:mlflow/claude_code/tracing.py
"""MLflow tracing integration for Claude Code interactions.""" import dataclasses import json import logging import os import sys from datetime import datetime from pathlib import Path from typing import Any import dateutil.parser import mlflow from mlflow.claude_code.config import ( MLFLOW_TRACING_ENABLED, ...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/claude_code/tracing.py", "license": "Apache License 2.0", "lines": 700, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:tests/claude_code/test_cli.py
import json from pathlib import Path import pytest from click.testing import CliRunner from mlflow.claude_code.cli import commands from mlflow.claude_code.config import HOOK_FIELD_COMMAND, HOOK_FIELD_HOOKS from mlflow.claude_code.hooks import upsert_hook @pytest.fixture def runner(): """Provide a CLI runner for...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/claude_code/test_cli.py", "license": "Apache License 2.0", "lines": 69, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/claude_code/test_config.py
import json import pytest from mlflow.claude_code.config import ( MLFLOW_TRACING_ENABLED, get_env_var, get_tracing_status, load_claude_config, save_claude_config, setup_environment_config, ) @pytest.fixture def temp_settings_path(tmp_path): """Provide a temporary settings.json path for t...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/claude_code/test_config.py", "license": "Apache License 2.0", "lines": 131, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/claude_code/test_tracing.py
import importlib import json import logging from pathlib import Path import pytest from claude_agent_sdk.types import ( AssistantMessage, ResultMessage, TextBlock, ToolResultBlock, ToolUseBlock, UserMessage, ) import mlflow import mlflow.claude_code.tracing as tracing_module from mlflow.claude...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/claude_code/test_tracing.py", "license": "Apache License 2.0", "lines": 717, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/genai/evaluate/test_context.py
import threading from unittest import mock import pytest import mlflow from mlflow.environment_variables import MLFLOW_TRACKING_USERNAME from mlflow.genai.evaluation.context import NoneContext, _set_context, eval_context, get_context @pytest.fixture(autouse=True) def reset_context(): yield _set_context(None...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/genai/evaluate/test_context.py", "license": "Apache License 2.0", "lines": 51, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:mlflow/entities/scorer.py
import json from functools import lru_cache from mlflow.entities._mlflow_object import _MlflowObject from mlflow.protos.service_pb2 import Scorer as ProtoScorer class ScorerVersion(_MlflowObject): """ A versioned scorer entity that represents a specific version of a scorer within an MLflow experiment. ...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/entities/scorer.py", "license": "Apache License 2.0", "lines": 169, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
mlflow/mlflow:tests/genai/scorers/test_scorer_CRUD.py
from unittest.mock import ANY, Mock, patch import mlflow import mlflow.genai from mlflow.entities import GatewayEndpointModelConfig, GatewayModelLinkageType from mlflow.entities.gateway_endpoint import GatewayEndpoint from mlflow.genai.scorers import Guidelines, Scorer, scorer from mlflow.genai.scorers.base import Sco...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/genai/scorers/test_scorer_CRUD.py", "license": "Apache License 2.0", "lines": 305, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:mlflow/entities/webhook.py
from enum import Enum from typing import Literal, TypeAlias from typing_extensions import Self from mlflow.exceptions import MlflowException from mlflow.protos.webhooks_pb2 import Webhook as ProtoWebhook from mlflow.protos.webhooks_pb2 import WebhookAction as ProtoWebhookAction from mlflow.protos.webhooks_pb2 import ...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/entities/webhook.py", "license": "Apache License 2.0", "lines": 383, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:mlflow/webhooks/constants.py
# MLflow webhook headers WEBHOOK_SIGNATURE_HEADER = "X-MLflow-Signature" WEBHOOK_TIMESTAMP_HEADER = "X-MLflow-Timestamp" WEBHOOK_DELIVERY_ID_HEADER = "X-MLflow-Delivery-Id" # Webhook signature version WEBHOOK_SIGNATURE_VERSION = "v1"
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/webhooks/constants.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:mlflow/webhooks/delivery.py
"""Webhook delivery implementation following Standard Webhooks conventions. This module implements webhook delivery patterns similar to the Standard Webhooks specification (https://www.standardwebhooks.com), providing consistent and secure webhook delivery with HMAC signature verification and timestamp-based replay pr...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/webhooks/delivery.py", "license": "Apache License 2.0", "lines": 286, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:mlflow/webhooks/types.py
"""Type definitions for MLflow webhook payloads. This module contains class definitions for all webhook event payloads that are sent when various model registry events occur. """ from typing import Literal, TypeAlias, TypedDict from mlflow.entities.webhook import WebhookAction, WebhookEntity, WebhookEvent class Re...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/webhooks/types.py", "license": "Apache License 2.0", "lines": 448, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
mlflow/mlflow:tests/entities/test_webhook.py
import pytest from mlflow.entities.webhook import ( Webhook, WebhookAction, WebhookEntity, WebhookEvent, WebhookStatus, WebhookTestResult, ) from mlflow.exceptions import MlflowException from mlflow.protos.webhooks_pb2 import WebhookAction as ProtoWebhookAction from mlflow.protos.webhooks_pb2 i...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/entities/test_webhook.py", "license": "Apache License 2.0", "lines": 186, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/store/model_registry/test_rest_store_webhooks.py
""" This test file verifies webhook CRUD operations with the REST client, testing both server handlers and the REST client together. """ from pathlib import Path from typing import Iterator import pytest from cryptography.fernet import Fernet from mlflow.entities.webhook import WebhookAction, WebhookEntity, WebhookE...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/store/model_registry/test_rest_store_webhooks.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/tracking/test_client_webhooks.py
from pathlib import Path from typing import Iterator import pytest from cryptography.fernet import Fernet from mlflow.entities.webhook import WebhookAction, WebhookEntity, WebhookEvent, WebhookStatus from mlflow.environment_variables import MLFLOW_WEBHOOK_SECRET_ENCRYPTION_KEY from mlflow.exceptions import MlflowExce...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/tracking/test_client_webhooks.py", "license": "Apache License 2.0", "lines": 186, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/webhooks/app.py
import base64 import hashlib import hmac import itertools import json import sys from pathlib import Path import fastapi import uvicorn from fastapi import HTTPException, Request from mlflow.webhooks.constants import ( WEBHOOK_DELIVERY_ID_HEADER, WEBHOOK_SIGNATURE_HEADER, WEBHOOK_SIGNATURE_VERSION, WE...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/webhooks/app.py", "license": "Apache License 2.0", "lines": 191, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/webhooks/test_e2e.py
import contextlib import os import subprocess import sys import time from dataclasses import dataclass from pathlib import Path from typing import Any, Generator import psutil import pytest import requests from cryptography.fernet import Fernet from mlflow import MlflowClient from mlflow.entities.webhook import Webho...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/webhooks/test_e2e.py", "license": "Apache License 2.0", "lines": 814, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:dev/normalize_chars.py
import sys from pathlib import Path # Mapping of characters to normalize. Start with quotes; extend as needed. CHAR_MAP = { "\u2018": "'", # left single quotation mark "\u2019": "'", # right single quotation mark "\u201c": '"', # left double quotation mark "\u201d": '"', # right double quotation ma...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/normalize_chars.py", "license": "Apache License 2.0", "lines": 34, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:examples/agno/tracing.py
import mlflow mlflow.set_tracking_uri("http://localhost:5000") mlflow.set_experiment("AGNO Reasoning Finance Team") mlflow.agno.autolog() mlflow.anthropic.autolog() mlflow.openai.autolog() from agno.agent import Agent from agno.models.anthropic import Claude from agno.models.openai import OpenAIChat from agno.team.t...
{ "repo_id": "mlflow/mlflow", "file_path": "examples/agno/tracing.py", "license": "Apache License 2.0", "lines": 69, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:mlflow/agno/utils.py
import importlib import logging import pkgutil from agno.models.base import Model from agno.storage.base import Storage _logger = logging.getLogger(__name__) def discover_storage_backends(): # 1. Import all storage modules import agno.storage as pkg for _, modname, _ in pkgutil.iter_modules(pkg.__path_...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/agno/utils.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/agno/test_agno_tracing.py
import sys from unittest.mock import MagicMock, patch import agno import pytest from agno.agent import Agent from agno.exceptions import ModelProviderError from agno.models.anthropic import Claude from agno.tools.function import Function, FunctionCall from anthropic.types import Message, TextBlock, Usage from packagin...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/agno/test_agno_tracing.py", "license": "Apache License 2.0", "lines": 292, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:mlflow/entities/entity_type.py
""" Entity type constants for MLflow's entity_association table. The entity_association table enables many-to-many relationships between different MLflow entities. It uses source and destination type/id pairs to create flexible associations without requiring dedicated junction tables for each relationship type. """ c...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/entities/entity_type.py", "license": "Apache License 2.0", "lines": 14, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
mlflow/mlflow:mlflow/genai/evaluation/context.py
""" Introduces main Context class and the framework to specify different specialized contexts. """ import functools from abc import ABC, abstractmethod from typing import Callable, ParamSpec, TypeVar import mlflow from mlflow.tracking.context import registry as context_registry from mlflow.utils.mlflow_tags import ML...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/evaluation/context.py", "license": "Apache License 2.0", "lines": 106, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
mlflow/mlflow:mlflow/genai/evaluation/entities.py
"""Entities for evaluation.""" import hashlib import json from dataclasses import dataclass, field from typing import Any import pandas as pd from mlflow.entities.assessment import Expectation, Feedback from mlflow.entities.assessment_source import AssessmentSource, AssessmentSourceType from mlflow.entities.dataset_...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/evaluation/entities.py", "license": "Apache License 2.0", "lines": 183, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:mlflow/genai/evaluation/harness.py
"""Entry point to the evaluation harness""" from __future__ import annotations import logging import time import traceback import uuid from concurrent.futures import ThreadPoolExecutor, as_completed from typing import Any, Callable import pandas as pd from mlflow.exceptions import MlflowException try: from tqd...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/evaluation/harness.py", "license": "Apache License 2.0", "lines": 429, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:mlflow/genai/judges/custom_prompt_judge.py
import re from difflib import unified_diff from typing import Callable from mlflow.entities.assessment import Feedback from mlflow.entities.assessment_source import AssessmentSource, AssessmentSourceType from mlflow.genai.judges.builtin import _MODEL_API_DOC from mlflow.genai.judges.constants import USE_CASE_CUSTOM_PR...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/judges/custom_prompt_judge.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/judges/prompts/context_sufficiency.py
from typing import Any from mlflow.genai.prompts.utils import format_prompt # NB: User-facing name for the is_context_sufficient assessment. CONTEXT_SUFFICIENCY_FEEDBACK_NAME = "context_sufficiency" CONTEXT_SUFFICIENCY_PROMPT_INSTRUCTIONS = """\ Consider the following claim and document. You must determine whether ...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/judges/prompts/context_sufficiency.py", "license": "Apache License 2.0", "lines": 56, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
mlflow/mlflow:mlflow/genai/judges/prompts/correctness.py
from mlflow.genai.prompts.utils import format_prompt # NB: User-facing name for the is_correct assessment. CORRECTNESS_FEEDBACK_NAME = "correctness" CORRECTNESS_PROMPT_INSTRUCTIONS = """\ Consider the following question, claim and document. You must determine whether the claim is \ supported by the document in the c...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/judges/prompts/correctness.py", "license": "Apache License 2.0", "lines": 53, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
mlflow/mlflow:mlflow/genai/judges/prompts/groundedness.py
from typing import Any from mlflow.genai.prompts.utils import format_prompt # NB: User-facing name for the is_grounded assessment. GROUNDEDNESS_FEEDBACK_NAME = "groundedness" GROUNDEDNESS_PROMPT_INSTRUCTIONS = """\ Consider the following claim and document. You must determine whether claim is supported by the \ doc...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/judges/prompts/groundedness.py", "license": "Apache License 2.0", "lines": 37, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
mlflow/mlflow:mlflow/genai/judges/prompts/guidelines.py
from mlflow.genai.prompts.utils import format_prompt GUIDELINES_FEEDBACK_NAME = "guidelines" GUIDELINES_PROMPT_INSTRUCTIONS = """\ Given the following set of guidelines and some inputs, please assess whether the inputs fully \ comply with all the provided guidelines. Only focus on the provided guidelines and not the...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/judges/prompts/guidelines.py", "license": "Apache License 2.0", "lines": 36, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
mlflow/mlflow:mlflow/genai/judges/prompts/relevance_to_query.py
from mlflow.genai.prompts.utils import format_prompt # NB: User-facing name for the is_context_relevant assessment. RELEVANCE_TO_QUERY_ASSESSMENT_NAME = "relevance_to_context" RELEVANCE_TO_QUERY_PROMPT_INSTRUCTIONS = """\ Consider the following question and answer. You must determine whether the answer provides \ in...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/judges/prompts/relevance_to_query.py", "license": "Apache License 2.0", "lines": 27, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
mlflow/mlflow:mlflow/genai/scorers/aggregation.py
"""Generate the metrics logged into MLflow.""" import collections import logging import numpy as np from mlflow.entities.assessment import Feedback from mlflow.genai.evaluation.entities import EvalResult from mlflow.genai.judges.builtin import CategoricalRating from mlflow.genai.scorers.base import AggregationFunc, ...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/scorers/aggregation.py", "license": "Apache License 2.0", "lines": 92, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:tests/genai/judges/test_builtin.py
import json from unittest import mock import pytest from litellm.types.utils import ModelResponse from mlflow.entities.assessment import ( AssessmentError, AssessmentSource, AssessmentSourceType, Feedback, ) from mlflow.exceptions import MlflowException from mlflow.genai import judges from mlflow.gena...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/genai/judges/test_builtin.py", "license": "Apache License 2.0", "lines": 576, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/genai/judges/test_custom_prompt_judge.py
import json from unittest import mock import pytest from litellm.types.utils import ModelResponse from mlflow.entities.assessment import AssessmentError from mlflow.entities.assessment_source import AssessmentSourceType from mlflow.genai.judges.custom_prompt_judge import _remove_choice_brackets, custom_prompt_judge ...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/genai/judges/test_custom_prompt_judge.py", "license": "Apache License 2.0", "lines": 128, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/genai/scorers/test_aggregation.py
import pytest from mlflow.entities.assessment import Feedback from mlflow.genai.evaluation.entities import EvalItem, EvalResult from mlflow.genai.judges.builtin import CategoricalRating from mlflow.genai.scorers.aggregation import ( _cast_assessment_value_to_float, compute_aggregated_metrics, ) from mlflow.gen...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/genai/scorers/test_aggregation.py", "license": "Apache License 2.0", "lines": 101, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:mlflow/server/fastapi_app.py
""" FastAPI application wrapper for MLflow server. This module provides a FastAPI application that wraps the existing Flask application using WSGIMiddleware to maintain 100% API compatibility while enabling future migration to FastAPI endpoints. """ import json from fastapi import FastAPI, Request from fastapi.middl...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/server/fastapi_app.py", "license": "Apache License 2.0", "lines": 86, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:dev/extract_deps.py
import ast import re from pathlib import Path from typing import cast def parse_dependencies(content: str) -> list[str]: pattern = r"dependencies\s*=\s*(\[[\s\S]*?\])\n" match = re.search(pattern, content) if match is None: raise ValueError("Could not find dependencies in pyproject.toml") deps...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/extract_deps.py", "license": "Apache License 2.0", "lines": 17, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:dev/clint/src/clint/rules/get_artifact_uri.py
from clint.rules.base import Rule class GetArtifactUri(Rule): def _message(self) -> str: return ( "`mlflow.get_artifact_uri` should not be used in examples. " "Use the return value of `log_model` instead." )
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/src/clint/rules/get_artifact_uri.py", "license": "Apache License 2.0", "lines": 7, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:dev/clint/tests/rules/test_get_artifact_uri.py
from pathlib import Path import pytest from clint.config import Config from clint.linter import Position, Range, lint_file from clint.rules import GetArtifactUri def test_get_artifact_uri_in_rst_example(index_path: Path) -> None: code = """ Documentation ============= Here's an example: .. code-block:: python ...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/tests/rules/test_get_artifact_uri.py", "license": "Apache License 2.0", "lines": 64, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:mlflow/genai/scorers/registry.py
""" Registered scorer functionality for MLflow GenAI. This module provides functions to manage registered scorers that automatically evaluate traces in MLflow experiments. """ import json import warnings from abc import ABCMeta, abstractmethod from typing import TYPE_CHECKING, Optional from mlflow.exceptions import ...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/scorers/registry.py", "license": "Apache License 2.0", "lines": 566, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
mlflow/mlflow:mlflow/telemetry/client.py
import atexit import random import sys import threading import time import urllib.parse import uuid import warnings from dataclasses import asdict from functools import lru_cache from queue import Empty, Full, Queue from typing import Any, Literal import requests from mlflow.environment_variables import _MLFLOW_TELEM...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/telemetry/client.py", "license": "Apache License 2.0", "lines": 411, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:mlflow/telemetry/constant.py
from mlflow.ml_package_versions import GENAI_FLAVOR_TO_MODULE_NAME, NON_GENAI_FLAVOR_TO_MODULE_NAME # NB: Kinesis PutRecords API has a limit of 500 records per request BATCH_SIZE = 500 BATCH_TIME_INTERVAL_SECONDS = 10 MAX_QUEUE_SIZE = 1000 MAX_WORKERS = 1 CONFIG_STAGING_URL = "https://config-staging.mlflow-telemetry.i...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/telemetry/constant.py", "license": "Apache License 2.0", "lines": 88, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:mlflow/telemetry/events.py
import inspect import os import sys from enum import Enum from typing import TYPE_CHECKING, Any from mlflow.entities import Feedback from mlflow.telemetry.constant import ( GENAI_MODULES, MODULES_TO_CHECK_IMPORT, ) if TYPE_CHECKING: from mlflow.genai.scorers.base import Scorer GENAI_EVALUATION_PATH = "m...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/telemetry/events.py", "license": "Apache License 2.0", "lines": 485, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:mlflow/telemetry/schemas.py
import json import platform import sys from dataclasses import dataclass from enum import Enum from typing import Any from mlflow.version import IS_MLFLOW_SKINNY, IS_TRACING_SDK_ONLY, VERSION class Status(str, Enum): UNKNOWN = "unknown" SUCCESS = "success" FAILURE = "failure" @dataclass class Record: ...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/telemetry/schemas.py", "license": "Apache License 2.0", "lines": 68, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:mlflow/telemetry/track.py
import functools import inspect import logging import time from typing import Any, Callable, ParamSpec, TypeVar from mlflow.environment_variables import MLFLOW_EXPERIMENT_ID from mlflow.telemetry.client import get_telemetry_client from mlflow.telemetry.events import Event from mlflow.telemetry.schemas import Record, S...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/telemetry/track.py", "license": "Apache License 2.0", "lines": 107, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex