Skip to content

refactor(helpers): move has_user_content() to a backend-neutral module - #1758

Merged
AngeloDanducci merged 2 commits into
generative-computing:mainfrom
markstur:fix/1756-move-has-user-content
Oct 23, 2026
Merged

AngeloDanducci merged 2 commits into
generative-computing:mainfrom
markstur:fix/1756-move-has-user-content

Conversation

@markstur

Copy link
Copy Markdown
Contributor

Pull Request

Issue

Closes #1756

Description

has_user_content() was added in #1632 to guard the OpenAI, LiteLLM, and Ollama backends against empty user content, and lives in mellea/helpers/openai_compatible_helpers.py. The #1705 fix (PR #1757) makes the HuggingFace path the first non-OpenAI-compatible caller, so a backend-neutral helpers module is a better home.

Behavior-neutral: all callers import via the mellea.helpers package, so no backend changes are needed and open PR #1757 is unaffected by the move.

Testing

  • Tests added to the respective file if code was changed
  • New code has 100% coverage if code was added
  • Ensure existing tests and github automation passes (a maintainer will kick off the github automation when the rest of the PR is populated)

No new tests: the change is a behavior-neutral move. Verified locally: ruff format/ruff check and mypy clean on mellea/helpers/; pytest test/helpers/ test/backends/test_provider_fields.py (158 passed); docstring quality gate (audit_coverage.py --quality --fail-on-quality --threshold 100) passes.

Attribution

  • AI coding assistants used

Adding a new component, requirement, sampling strategy, or tool?

If your PR adds or modifies one of the types below, check the matching box. A checklist of type-specific review items will be posted as a comment.

  • Component
  • Requirement
  • Sampling Strategy
  • Tool

NOTE: Please ensure you have an issue that has been acknowledged by a core contributor and routed you to open a pull request against this repository. Otherwise, please open an issue before continuing with this pull request.

🤖 Generated with Claude Code

The HuggingFace path is now a non-OpenAI-compatible caller of
has_user_content(), so a backend-neutral helpers module is a better
home than openai_compatible_helpers.py. Behavior-neutral: all callers
import via the mellea.helpers package.

Also make the docstring timeless (drop issue-number narration, keep
the behavioral spec) and add the name to the package __all__, since
it now has four internal callers.

Closes generative-computing#1756

Assisted-by: Claude Code
Signed-off-by: Mark Sturdevant <[email protected]>
@markstur
markstur requested a review from a team as a code owner October 21, 2026 19:48
@github-actions github-actions Bot added the enhancement New feature or request label Oct 21, 2026
This code is already tested indirectly, but
adding unit tests to enforce the contract of
the method. Also this brings symmetry and goodness
of at least having a test file to pair with the
source file.

Signed-off-by: Mark Sturdevant <[email protected]>
Assisted-by: Claude Code

@AngeloDanducci AngeloDanducci left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@AngeloDanducci
AngeloDanducci added this pull request to the merge queue Oct 22, 2026
@AngeloDanducci
AngeloDanducci removed this pull request from the merge queue due to a manual request Oct 22, 2026
@AngeloDanducci
AngeloDanducci added this pull request to the merge queue Oct 23, 2026
Merged via the queue into generative-computing:main with commit 1326efb Oct 23, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move has_user_content() to a backend-neutral helpers module

2 participants