Skip to content

[3/4] Add support for multi-turn deepeval scorers#19263

Merged
smoorjani merged 27 commits intomlflow:masterfrom
smoorjani:stack/deepeval-multiturn
Dec 16, 2025
Merged

[3/4] Add support for multi-turn deepeval scorers#19263
smoorjani merged 27 commits intomlflow:masterfrom
smoorjani:stack/deepeval-multiturn

Conversation

@smoorjani
Copy link
Collaborator

@smoorjani smoorjani commented Dec 8, 2025

🛠 DevTools 🛠

Open in GitHub Codespaces

Install mlflow from this PR

# mlflow
pip install git+https://github.com/mlflow/mlflow.git@refs/pull/19263/merge
# mlflow-skinny
pip install git+https://github.com/mlflow/mlflow.git@refs/pull/19263/merge#subdirectory=libs/skinny

For Databricks, use the following command:

%sh curl -LsSf https://raw.githubusercontent.com/mlflow/mlflow/HEAD/dev/install-skinny.sh | sh -s pull/19263/merge

Related Issues/PRs

#xxx

What changes are proposed in this pull request?

Adding support for multi-turn deepeval scorers.

How is this PR tested?

  • Existing unit/integration tests
  • New unit/integration tests
  • Manual tests
import mlflow
from mlflow.entities.trace_info import TraceMetadataKey
from mlflow.genai.scorers.deepeval import ConversationCompleteness

mlflow.set_tracking_uri("databricks")
mlflow.set_experiment(experiment_id="3011836326718646")

traces = mlflow.search_traces(return_type="list")
session_id = None
for trace in traces:
    session_id = trace.info.trace_metadata.get(TraceMetadataKey.TRACE_SESSION)
    if session_id:
        break

session = mlflow.search_traces(
    return_type="list",
    filter_string=f"metadata.`{TraceMetadataKey.TRACE_SESSION}` = '{session_id}'",
)

print(f"Testing session {session_id} with {len(session)} traces")

scorer = ConversationCompleteness(model="databricks", threshold=0.5)
feedback = scorer(session=session)

if feedback.error:
    print(f"Error: {feedback.error}")
else:
    print(f"Value: {feedback.value}")
    print(f"Score: {feedback.metadata.get('score')}")
    print(f"Rationale: {feedback.rationale}")

outputs:

Testing session 9a14d892-2315-408c-a30e-81edce461425 with 6 traces
Value: yes
Score: 0.6
Rationale: The score is 0.6 because while the LLM addressed some of the user's requests, such as modifying documentation and removing specific emojis, it failed to simplify explanations as the user intended. Additionally, the LLM did not adequately resolve the user's parsing error, merely stating that it should be fixed without confirming the specific issue or providing steps for verification.

Does this PR require documentation update?

  • No. You can skip the rest of this section.
  • Yes. I've updated:
    • Examples
    • API references
    • Instructions

Will add a follow-up PR for this.

Release Notes

Is this a user-facing change?

  • No. You can skip the rest of this section.
  • Yes. Give a description of this change to be included in the release notes for MLflow users.

What component(s), interfaces, languages, and integrations does this PR affect?

Components

  • area/tracking: Tracking Service, tracking client APIs, autologging
  • area/models: MLmodel format, model serialization/deserialization, flavors
  • area/model-registry: Model Registry service, APIs, and the fluent client calls for Model Registry
  • area/scoring: MLflow Model server, model deployment tools, Spark UDFs
  • area/evaluation: MLflow model evaluation features, evaluation metrics, and evaluation workflows
  • area/gateway: MLflow AI Gateway client APIs, server, and third-party integrations
  • area/prompts: MLflow prompt engineering features, prompt templates, and prompt management
  • area/tracing: MLflow Tracing features, tracing APIs, and LLM tracing functionality
  • area/projects: MLproject format, project running backends
  • area/uiux: Front-end, user experience, plotting, JavaScript, JavaScript dev server
  • area/build: Build and test infrastructure for MLflow
  • area/docs: MLflow documentation pages

How should the PR be classified in the release notes? Choose one:

  • rn/none - No description will be included. The PR will be mentioned only by the PR number in the "Small Bugfixes and Documentation Updates" section
  • rn/breaking-change - The PR will be mentioned in the "Breaking Changes" section
  • rn/feature - A new user-facing feature worth mentioning in the release notes
  • rn/bug-fix - A user-facing bug fix worth mentioning in the release notes
  • rn/documentation - A user-facing documentation change worth mentioning in the release notes

Should this PR be included in the next patch release?

Yes should be selected for bug fixes, documentation updates, and other small changes. No should be selected for new features and larger changes. If you're unsure about the release classification of this PR, leave this unchecked to let the maintainers decide.

What is a minor/patch release?
  • Minor release: a release that increments the second part of the version number (e.g., 1.2.0 -> 1.3.0).
    Bug fixes, doc updates and new features usually go into minor releases.
  • Patch release: a release that increments the third part of the version number (e.g., 1.2.0 -> 1.2.1).
    Bug fixes and doc updates usually go into patch releases.
  • Yes (this PR will be cherry-picked and included in the next patch release)
  • No (this PR will be included in the next minor release)

Signed-off-by: Samraj Moorjani <samraj.moorjani@databricks.com>
Signed-off-by: Samraj Moorjani <samraj.moorjani@databricks.com>
Signed-off-by: Samraj Moorjani <samraj.moorjani@databricks.com>
Signed-off-by: Samraj Moorjani <samraj.moorjani@databricks.com>
Signed-off-by: Samraj Moorjani <samraj.moorjani@databricks.com>
.
Signed-off-by: Samraj Moorjani <samraj.moorjani@databricks.com>
Signed-off-by: Samraj Moorjani <samraj.moorjani@databricks.com>
Signed-off-by: Samraj Moorjani <samraj.moorjani@databricks.com>
Signed-off-by: Samraj Moorjani <samraj.moorjani@databricks.com>
Signed-off-by: Samraj Moorjani <samraj.moorjani@databricks.com>
Signed-off-by: Samraj Moorjani <samraj.moorjani@databricks.com>
Signed-off-by: Samraj Moorjani <samraj.moorjani@databricks.com>
Signed-off-by: Samraj Moorjani <samraj.moorjani@databricks.com>
.
Signed-off-by: Samraj Moorjani <samraj.moorjani@databricks.com>
,
Signed-off-by: Samraj Moorjani <samraj.moorjani@databricks.com>
Signed-off-by: Samraj Moorjani <samraj.moorjani@databricks.com>
Signed-off-by: Samraj Moorjani <samraj.moorjani@databricks.com>
Signed-off-by: Samraj Moorjani <samraj.moorjani@databricks.com>
Signed-off-by: Samraj Moorjani <samraj.moorjani@databricks.com>
@github-actions github-actions bot added area/evaluation MLflow Evaluation rn/none List under Small Changes in Changelogs. labels Dec 8, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Dec 8, 2025

Documentation preview for f6f2472 is available at:

More info
  • Ignore this comment if this PR does not change the documentation.
  • The preview is updated when a new commit is pushed to this PR.
  • This comment was created by this workflow run.
  • The documentation was built by this workflow run.

Signed-off-by: Samraj Moorjani <samraj.moorjani@databricks.com>
Signed-off-by: Samraj Moorjani <samraj.moorjani@databricks.com>
@smoorjani smoorjani force-pushed the stack/deepeval-multiturn branch from c3033da to 5a548bf Compare December 10, 2025 13:48
Signed-off-by: Samraj Moorjani <samraj.moorjani@databricks.com>
Signed-off-by: Samraj Moorjani <samraj.moorjani@databricks.com>
assert result.error.error_code == "RuntimeError"
assert result.error.error_message == "Test error"
assert result.source.source_type == AssessmentSourceType.LLM_JUDGE

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is perhaps out of scope for this PR, but are you planning on adding integration tests that install the latest deepeval and confirm that a single-turn and a multi-turn scorer work?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question - I think we'll need to do this for all integrations, did you have a specific code pointer/place in mind? I can file a follow-up ticket.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, check out how langchain integration testing works: https://sourcegraph.prod.databricks-corp.com/mlflow/mlflow/-/tree/tests/langchain

From Claude:

  Great question! Yes, integration tests that install the actual deepeval package would be valuable. Here's where they should go:

  Location: tests/genai/scorers/deepeval/

  You'd create a new directory structure similar to how other integrations are organized (e.g., tests/langchain/, tests/openai/). Based on MLflow's patterns, I'd recommend:

  tests/genai/scorers/deepeval/
  ├── __init__.py
  ├── conftest.py  # For fixtures and deepeval-specific setup
  └── test_deepeval_integration.py  # Integration tests with real deepeval

  CI Integration: The integration tests would run as part of the existing genai CI job in .github/workflows/master.yml (around line 380-420). You'd need to:

  1. Add deepeval to the pip install line in the genai job:
  - name: Install dependencies
    run: |
      source ./dev/install-common-deps.sh
      pip install openai dspy deepeval  # Add deepeval here

  2. The tests would automatically run with pytest tests/genai

Claude also commends you on your decision to include this in a follow-up PR :D

Signed-off-by: Samraj Moorjani <samraj.moorjani@databricks.com>
Signed-off-by: Samraj Moorjani <samraj.moorjani@databricks.com>
Copy link
Collaborator

@AveshCSingh AveshCSingh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let one small comment, otw LGTM. Please track the follow-ups

assert result.error.error_code == "RuntimeError"
assert result.error.error_message == "Test error"
assert result.source.source_type == AssessmentSourceType.LLM_JUDGE

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, check out how langchain integration testing works: https://sourcegraph.prod.databricks-corp.com/mlflow/mlflow/-/tree/tests/langchain

From Claude:

  Great question! Yes, integration tests that install the actual deepeval package would be valuable. Here's where they should go:

  Location: tests/genai/scorers/deepeval/

  You'd create a new directory structure similar to how other integrations are organized (e.g., tests/langchain/, tests/openai/). Based on MLflow's patterns, I'd recommend:

  tests/genai/scorers/deepeval/
  ├── __init__.py
  ├── conftest.py  # For fixtures and deepeval-specific setup
  └── test_deepeval_integration.py  # Integration tests with real deepeval

  CI Integration: The integration tests would run as part of the existing genai CI job in .github/workflows/master.yml (around line 380-420). You'd need to:

  1. Add deepeval to the pip install line in the genai job:
  - name: Install dependencies
    run: |
      source ./dev/install-common-deps.sh
      pip install openai dspy deepeval  # Add deepeval here

  2. The tests would automatically run with pytest tests/genai

Claude also commends you on your decision to include this in a follow-up PR :D

Signed-off-by: Samraj Moorjani <samraj.moorjani@databricks.com>
Signed-off-by: Samraj Moorjani <samraj.moorjani@databricks.com>
@smoorjani smoorjani added this pull request to the merge queue Dec 16, 2025
Merged via the queue into mlflow:master with commit b5ee71a Dec 16, 2025
47 checks passed
@smoorjani smoorjani deleted the stack/deepeval-multiturn branch December 16, 2025 22:19
WeichenXu123 pushed a commit to WeichenXu123/mlflow that referenced this pull request Dec 19, 2025
Signed-off-by: Samraj Moorjani <samraj.moorjani@databricks.com>
WeichenXu123 pushed a commit that referenced this pull request Dec 19, 2025
Signed-off-by: Samraj Moorjani <samraj.moorjani@databricks.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/evaluation MLflow Evaluation rn/none List under Small Changes in Changelogs. v3.8.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants