feat: re-export serve types from public mellea.* namespace#1243
Open
markstur wants to merge 2 commits into
Open
feat: re-export serve types from public mellea.* namespace#1243markstur wants to merge 2 commits into
markstur wants to merge 2 commits into
Conversation
Creates a stable public API for m serve types by moving user-facing types from cli/serve/models to mellea/serve/models. Users can now import ChatMessage and related types via: from mellea.serve import ChatMessage Changes: - Add mellea/serve/ module with ChatMessage, TextContent, ImageUrlContent, and MessageContent - Update cli/serve/models.py to re-export from mellea.serve - Update m serve examples to use new import path - Update m-serve.md documentation - Maintain backward compatibility (cli.serve.models still works) The new public API provides clear separation between user-facing types (mellea.serve) and internal CLI implementation (cli/serve). Signed-off-by: Mark Sturdevant <mark.sturdevant@ibm.com> Assisted-by: IBM Bob
Signed-off-by: Mark Sturdevant <mark.sturdevant@ibm.com>
ajbozarth
reviewed
Jun 11, 2026
ajbozarth
left a comment
Contributor
There was a problem hiding this comment.
One action item and a few inline nits:
- The tests in
test/cli/test_serve_models_multimodal.pyshould move totest/serve/test_models_multimodal.pyand import frommellea.servedirectly. The types they cover now live there, and the file isn't touched in this PR so I can't comment inline.
| try: | ||
| from cpex.framework.hooks.policies import ( | ||
| HookPayloadPolicy, # type: ignore[import-not-found] | ||
| from cpex.framework.hooks.policies import ( # type: ignore[import-not-found] |
Contributor
There was a problem hiding this comment.
Unrelated to #873 — worth either pulling out or mentioning in the description.
Also worth noting: neither placement actually works. # type: ignore on a multi-line import has to sit on the closing ) to apply. And mypy passes clean without it anyway, so the cleanest fix is to just delete the comment rather than move it.
Comment on lines
+1
to
+5
| """User-facing types for m serve. | ||
|
|
||
| This module contains the types that users need when writing serve() functions | ||
| for use with the `m serve` command. | ||
| """ |
Contributor
There was a problem hiding this comment.
Nit: this docstring duplicates mellea/serve/__init__.py's nearly verbatim. Consider trimming to one line.
Suggested change
| """User-facing types for m serve. | |
| This module contains the types that users need when writing serve() functions | |
| for use with the `m serve` command. | |
| """ | |
| """User-facing types for `m serve`.""" |
psschwei
reviewed
Jun 11, 2026
psschwei
left a comment
Member
There was a problem hiding this comment.
Couple of minor questions:
- Should we update
docs/examples/notebooks/m_serve_example.ipynbtoo? - Should we test the new path?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
Issue
Fixes #873
Description
Creates a stable public API for m serve types by moving user-facing types from cli/serve/models to mellea/serve/models. Users can now import ChatMessage and related types via:
from mellea.serve import ChatMessage
Changes:
The new public API provides clear separation
between user-facing types (mellea.serve) and internal CLI implementation (cli/serve).
Testing
Attribution
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.
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.