Skip to content

Improve documentation for 'prompt_template'#19105

Merged
harupy merged 1 commit intomlflow:masterfrom
ingo-stallknecht:docs/transformers-prompt-template-example
Nov 28, 2025
Merged

Improve documentation for 'prompt_template'#19105
harupy merged 1 commit intomlflow:masterfrom
ingo-stallknecht:docs/transformers-prompt-template-example

Conversation

@ingo-stallknecht
Copy link
Contributor

@ingo-stallknecht ingo-stallknecht commented Nov 28, 2025

🛠 DevTools 🛠

Open in GitHub Codespaces

Install mlflow from this PR

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

Related Issues/PRs

None.

What changes are proposed in this pull request?

This PR improves the documentation for the prompt_template parameter in
LOG_MODEL_PARAM_DOCS (mlflow/mlflow/utils/docstring_utils.py).

The original description already explained the {prompt} placeholder and listed
the supported pipeline types. This update keeps the existing content intact and
adds a concise Python example demonstrating:

  • how to define a prompt template,
  • how to log a text-generation pipeline using mlflow.transformers.log_model,
  • how the pyfunc flavor applies the template automatically at inference time.

This example makes the intended usage clearer and improves the usability of the
prompt_template feature without changing any behavior.

How is this PR tested?

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

This is a documentation-only change.
Manual verification was performed to ensure that the added example integrates
correctly into the shared docstring, and CI will validate that the documentation
builds without issues.

Does this PR require documentation update?

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

This update enhances the API reference documentation for the prompt_template
parameter by adding a practical example.

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.

Improved documentation for the prompt_template parameter in the transformers
flavor, including a short usage example.

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

Components

  • area/tracking
  • area/models
  • area/model-registry
  • area/scoring
  • area/evaluation
  • area/gateway
  • area/prompts
  • area/tracing
  • area/projects
  • area/uiux
  • area/build
  • area/docs

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

  • rn/none
  • rn/breaking-change
  • rn/feature
  • rn/bug-fix
  • rn/documentation

Should this PR be included in the next patch release?

  • 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)

@github-actions github-actions bot added v3.7.0 area/docs Documentation issues rn/documentation Mention under Documentation Changes in Changelogs. labels Nov 28, 2025
@github-actions
Copy link
Contributor

@ingo-stallknecht Thank you for the contribution! Could you fix the following issue(s)?

⚠ DCO check

The DCO check failed. Please sign off your commit(s) by following the instructions here. See https://github.com/mlflow/mlflow/blob/master/CONTRIBUTING.md#sign-your-work for more details.

…avor

Signed-off-by: Ingo Stallknecht <ingostallknecht@gmail.com>
@github-actions
Copy link
Contributor

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

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 enhances the documentation for the prompt_template parameter in the transformers flavor by adding a practical Python code example. The change improves developer understanding of how to use prompt templates with text-generation pipelines.

  • Adds a complete working example demonstrating prompt template usage with mlflow.transformers.log_model
  • Shows the end-to-end workflow including logging, loading, and inference with the pyfunc flavor
  • Maintains consistency with existing documentation style and patterns

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

Copy link
Member

@harupy harupy left a comment

Choose a reason for hiding this comment

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

LGTM!

@harupy harupy added this pull request to the merge queue Nov 28, 2025
Merged via the queue into mlflow:master with commit 71a464a Nov 28, 2025
52 of 54 checks passed
BenWilson2 pushed a commit to BenWilson2/mlflow that referenced this pull request Dec 4, 2025
Signed-off-by: Ingo Stallknecht <ingostallknecht@gmail.com>
BenWilson2 pushed a commit that referenced this pull request Dec 4, 2025
Signed-off-by: Ingo Stallknecht <ingostallknecht@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/docs Documentation issues rn/documentation Mention under Documentation Changes in Changelogs. v3.7.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants