Skip to content

[MLflow Demo] Add Prompt demo data#20047

Merged
BenWilson2 merged 1 commit intomlflow:masterfrom
BenWilson2:stack/demo/prompts
Jan 30, 2026
Merged

[MLflow Demo] Add Prompt demo data#20047
BenWilson2 merged 1 commit intomlflow:masterfrom
BenWilson2:stack/demo/prompts

Conversation

@BenWilson2
Copy link
Member

@BenWilson2 BenWilson2 commented Jan 16, 2026

🥞 Stacked PR

Use this link to review incremental changes.


Related Issues/PRs

#xxx

What changes are proposed in this pull request?

Adds data for simulating prompt evolution, including example traces (with evaluation) on versions of prompts for 3 separate domains.

Screenshot 2026-01-15 at 8 38 33 PM Screenshot 2026-01-15 at 8 38 43 PM Screenshot 2026-01-15 at 8 38 54 PM Screenshot 2026-01-15 at 8 39 03 PM

How is this PR tested?

  • Existing unit/integration tests
  • New unit/integration tests
  • Manual tests

Does this PR require documentation update?

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

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)

@BenWilson2 BenWilson2 changed the title add prompt generation [MLflow Demo] Add Prompt demo data Jan 16, 2026
@BenWilson2 BenWilson2 marked this pull request as ready for review January 16, 2026 01:40
Copilot AI review requested due to automatic review settings January 16, 2026 01:40
@github-actions
Copy link
Contributor

🛠 DevTools 🛠

Install mlflow from this PR

# mlflow
pip install git+https://github.com/mlflow/mlflow.git@refs/pull/20047/merge
# mlflow-skinny
pip install git+https://github.com/mlflow/mlflow.git@refs/pull/20047/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/20047/merge

@github-actions github-actions bot added area/tracking Tracking service, tracking client APIs, autologging rn/feature Mention under Features in Changelogs. labels Jan 16, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds demo prompt data to the MLflow demo data framework, creating realistic examples of prompt evolution across three different domains (customer support, document summarization, and code review). The prompts demonstrate versioning, alias management, and linkage to traces.

Changes:

  • Adds 3 demo prompts with 4 versions each showing realistic prompt evolution
  • Creates 12 prompt-linked traces that demonstrate prompt-to-trace associations
  • Implements PromptsDemoGenerator with full lifecycle management (create, check, delete)
  • Adds comprehensive test coverage for prompt generation and validation
  • Updates CI workflow to run demo tests in a separate job

Reviewed changes

Copilot reviewed 18 out of 19 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
mlflow/demo/data.py Adds 3 prompt definitions (CUSTOMER_SUPPORT_PROMPT, DOCUMENT_SUMMARIZER_PROMPT, CODE_REVIEWER_PROMPT) with version history and 12 prompt-linked trace examples
mlflow/demo/generators/prompts.py Implements PromptsDemoGenerator for creating, checking, and deleting prompt demo data
mlflow/demo/generators/traces.py Adds _create_prompt_linked_trace method to link traces to specific prompt versions
mlflow/demo/generators/init.py Registers PromptsDemoGenerator with the demo registry
tests/demo/test_prompts_generator.py Unit tests for PromptsDemoGenerator functionality
tests/demo/test_demo_integration.py Integration tests validating prompt generation against a real server
.github/workflows/master.yml Adds separate CI job for demo tests

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +108 to +111
TracesDemoGenerator.version = 2
assert generator.is_generated() is False

TracesDemoGenerator.version = 1
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

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

Missing cleanup after test modifies class variable. The version is reset to 1 at the end, but if the test fails before line 111, it will leave TracesDemoGenerator in an inconsistent state. Use a fixture with proper cleanup like in test_demo_integration.py (lines 48-52).

Copilot uses AI. Check for mistakes.
Comment on lines +118 to +122
EvaluationDemoGenerator.version = 99
fresh_generator = EvaluationDemoGenerator()
assert fresh_generator.is_generated() is False

EvaluationDemoGenerator.version = 1
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

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

Missing cleanup after test modifies class variable. The version is reset to 1 at the end, but if the test fails before line 122, it will leave EvaluationDemoGenerator in an inconsistent state. Use a fixture with proper cleanup like in test_demo_integration.py (lines 56-60).

Copilot uses AI. Check for mistakes.
Comment on lines +101 to +105
PromptsDemoGenerator.version = 99
fresh_generator = PromptsDemoGenerator()
assert fresh_generator.is_generated() is False

PromptsDemoGenerator.version = 2
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

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

Missing cleanup after test modifies class variable. The version is reset to 2 at the end, but if the test fails before line 105, it will leave PromptsDemoGenerator in an inconsistent state. Use a fixture with proper cleanup like in test_demo_integration.py (lines 64-68).

Copilot uses AI. Check for mistakes.
navigation_url="#/prompts",
)

def _create_prompt_with_versions(self, prompt_def) -> int:
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

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

Missing type hint for prompt_def parameter. Should be annotated as DemoPromptDef for better code clarity and IDE support.

Copilot uses AI. Check for mistakes.
Comment on lines +1241 to +1244

def get_expected_answers() -> dict[str, str]:
"""Build a dict mapping queries to expected responses for evaluation."""
return {trace.query.lower(): trace.expected_response for trace in ALL_DEMO_TRACES}
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

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

Dictionary is rebuilt on every call. Since ALL_DEMO_TRACES is a constant list, consider caching this dictionary at module level to avoid repeated iteration and lowercasing operations.

Suggested change
def get_expected_answers() -> dict[str, str]:
"""Build a dict mapping queries to expected responses for evaluation."""
return {trace.query.lower(): trace.expected_response for trace in ALL_DEMO_TRACES}
_EXPECTED_ANSWERS_BY_QUERY: dict[str, str] = {
trace.query.lower(): trace.expected_response for trace in ALL_DEMO_TRACES
}
def get_expected_answers() -> dict[str, str]:
"""Build a dict mapping queries to expected responses for evaluation."""
return _EXPECTED_ANSWERS_BY_QUERY

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Contributor

github-actions bot commented Jan 16, 2026

Documentation preview for 5c2543c 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.

@BenWilson2 BenWilson2 force-pushed the stack/demo/prompts branch 2 times, most recently from 991dccd to 23cadcf Compare January 17, 2026 04:24
@BenWilson2 BenWilson2 added team-review Trigger a team review request and removed team-review Trigger a team review request labels Jan 18, 2026
@BenWilson2 BenWilson2 force-pushed the stack/demo/prompts branch 4 times, most recently from 39a2634 to 0ad9742 Compare January 22, 2026 17:20
@BenWilson2 BenWilson2 force-pushed the stack/demo/prompts branch 2 times, most recently from ae40158 to b89db10 Compare January 26, 2026 15:00
Copy link
Collaborator

@B-Step62 B-Step62 left a comment

Choose a reason for hiding this comment

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

LGTM w/ a minor suggestion

Comment on lines +13 to +23
@dataclass
class PromptVersionDef:
template: str | list[dict[str, str]]
commit_message: str
alias: str | None = None


@dataclass
class DemoPromptDef:
name: str
versions: list[PromptVersionDef]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we use the real PromptVersion object?

Copy link
Member Author

Choose a reason for hiding this comment

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

yep will try!

@BenWilson2 BenWilson2 force-pushed the stack/demo/prompts branch 3 times, most recently from 856dc7b to e1f4aac Compare January 29, 2026 22:11
Signed-off-by: Ben Wilson <benjamin.wilson@databricks.com>
@BenWilson2 BenWilson2 added this pull request to the merge queue Jan 30, 2026
Merged via the queue into mlflow:master with commit 63bb97a Jan 30, 2026
49 checks passed
@BenWilson2 BenWilson2 deleted the stack/demo/prompts branch January 30, 2026 02:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/tracking Tracking service, tracking client APIs, autologging rn/feature Mention under Features in Changelogs. team-review Trigger a team review request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants