Add experiment prompts functionality#19156
Conversation
- Introduced new routes for experiment prompts and prompt details. - Updated the Prompts API to support filtering by experiment ID. - Enhanced the PromptsPage and PromptsDetailsPage components to handle experiment context. - Added tests for experiment-scoped prompts and prompt creation with experiment tags. - Updated side navigation to include a Prompts tab. This commit enhances the experiment tracking capabilities by linking prompts to specific experiments, allowing for better organization and retrieval of prompts associated with experiments. Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
There was a problem hiding this comment.
Pull request overview
This PR adds experiment-scoped prompt pages to improve organization and align with Databricks functionality. Prompts can now be viewed and managed within the context of specific experiments, while maintaining backward compatibility with the global prompts page.
- Introduced new routes for experiment-scoped prompts (
/experiments/:experimentId/promptsand/experiments/:experimentId/prompts/:promptName) - Updated the Prompts API to filter prompts by experiment ID using comma-separated tag values
- Modified PromptsPage and PromptsDetailsPage components to accept an optional experimentId prop
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| mlflow/server/js/src/experiment-tracking/routes.ts | Added new PageId entries for experiment prompts list and details, and updated getPromptDetailsPageRoute to support optional experimentId parameter |
| mlflow/server/js/src/experiment-tracking/route-defs.ts | Registered experiment-scoped prompt routes with lazy-loaded components |
| mlflow/server/js/src/experiment-tracking/pages/prompts/utils.ts | Added PROMPT_EXPERIMENT_IDS_TAG_KEY constant and extended PromptsTableMetadata type to include experimentId |
| mlflow/server/js/src/experiment-tracking/pages/prompts/hooks/usePromptsListQuery.tsx | Extended query to accept and pass experimentId parameter for filtering |
| mlflow/server/js/src/experiment-tracking/pages/prompts/hooks/useCreateRegisteredPromptMutation.tsx | Added promptTags parameter to support experiment ID tagging during prompt creation |
| mlflow/server/js/src/experiment-tracking/pages/prompts/hooks/useCreatePromptModal.tsx | Added logic to create experiment ID tags when creating prompts within experiment scope |
| mlflow/server/js/src/experiment-tracking/pages/prompts/components/PromptsListTableNameCell.tsx | Updated to generate experiment-scoped prompt detail links when experimentId is present |
| mlflow/server/js/src/experiment-tracking/pages/prompts/components/PromptsListTable.tsx | Added experimentId prop and passed it to table metadata |
| mlflow/server/js/src/experiment-tracking/pages/prompts/api.ts | Implemented experiment ID filtering using ILIKE query on comma-separated experiment IDs tag, and added additionalTags parameter to createRegisteredPrompt |
| mlflow/server/js/src/experiment-tracking/pages/prompts/api.test.ts | Added comprehensive tests for experiment ID filtering and prompt creation with additional tags |
| mlflow/server/js/src/experiment-tracking/pages/prompts/PromptsPage.tsx | Added experimentId prop and updated navigation to handle experiment-scoped routes |
| mlflow/server/js/src/experiment-tracking/pages/prompts/PromptsPage.test.tsx | Added test suite for experiment-scoped prompts including filtering and tag creation |
| mlflow/server/js/src/experiment-tracking/pages/prompts/PromptsDetailsPage.tsx | Added experimentId prop, updated navigation on delete, and conditionally rendered breadcrumbs |
| mlflow/server/js/src/experiment-tracking/pages/prompts/ExperimentPromptsPage.tsx | New wrapper component that extracts experimentId from route params and passes to PromptsPage |
| mlflow/server/js/src/experiment-tracking/pages/prompts/ExperimentPromptDetailsPage.tsx | New wrapper component that extracts experimentId from route params and passes to PromptsDetailsPage |
| mlflow/server/js/src/experiment-tracking/pages/experiment-page-tabs/side-nav/constants.tsx | Added Prompts tab to the experiment side navigation under the "Prompts & versions" section |
| mlflow/server/js/src/experiment-tracking/components/experiment-page/hooks/useGetExperimentPageActiveTabByRoute.tsx | Mapped experiment prompt routes to the Prompts tab name for active tab detection |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
mlflow/server/js/src/experiment-tracking/pages/prompts/PromptsDetailsPage.tsx
Outdated
Show resolved
Hide resolved
|
Documentation preview for 88143e7 is available at: More info
|
| [RoutePaths.experimentPromptsList]: ExperimentPageTabName.Prompts, | ||
| [RoutePaths.experimentPrompt]: ExperimentPageTabName.Prompts, |
There was a problem hiding this comment.
just so i remember to handle this in backsync, can you put some comment like // OSS experiment prompt page routes? this needs to be deconflicted / gated properly upstream
| experimentPageTabChatSessions = 'mlflow.experiment.tab.chat-sessions', | ||
| experimentPageTabSingleChatSession = 'mlflow.experiment.tab.single-chat-session', | ||
| experimentPageTabScorers = 'mlflow.experiment.tab.scorers', | ||
| experimentPromptsList = 'mlflow.experiment.prompts.list', |
There was a problem hiding this comment.
this is called "experimentPageTabPrompts" upstream, can we update the name here to match?
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
Related Issues/PRs
n/a
What changes are proposed in this pull request?
Add experiment-scoped prompt pages for better organization of features and consistency with Databricks. Kept existing global prompt tab in order to allow users to view unscoped prompts.
Screen.Recording.2025-12-02.at.17.13.15.mov
How is this PR tested?
Does this PR require documentation update?
Release Notes
Is this a user-facing change?
What component(s), interfaces, languages, and integrations does this PR affect?
Components
area/tracking: Tracking Service, tracking client APIs, autologgingarea/models: MLmodel format, model serialization/deserialization, flavorsarea/model-registry: Model Registry service, APIs, and the fluent client calls for Model Registryarea/scoring: MLflow Model server, model deployment tools, Spark UDFsarea/evaluation: MLflow model evaluation features, evaluation metrics, and evaluation workflowsarea/gateway: MLflow AI Gateway client APIs, server, and third-party integrationsarea/prompts: MLflow prompt engineering features, prompt templates, and prompt managementarea/tracing: MLflow Tracing features, tracing APIs, and LLM tracing functionalityarea/projects: MLproject format, project running backendsarea/uiux: Front-end, user experience, plotting, JavaScript, JavaScript dev serverarea/build: Build and test infrastructure for MLflowarea/docs: MLflow documentation pagesHow 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" sectionrn/breaking-change- The PR will be mentioned in the "Breaking Changes" sectionrn/feature- A new user-facing feature worth mentioning in the release notesrn/bug-fix- A user-facing bug fix worth mentioning in the release notesrn/documentation- A user-facing documentation change worth mentioning in the release notesShould this PR be included in the next patch release?
Yesshould be selected for bug fixes, documentation updates, and other small changes.Noshould 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?
Bug fixes, doc updates and new features usually go into minor releases.
Bug fixes and doc updates usually go into patch releases.