Skip to content

feat: re-export serve types from public mellea.* namespace #873

@planetf1

Description

@planetf1

Problem

m serve user programs must type their serve() input parameter as list[ChatMessage], because that is what the framework passes in. The only way to import ChatMessage today is:

from cli.serve.models import ChatMessage

cli/ is not part of the installed mellea package. This import works when running from the repo root, but fails for anyone who has installed mellea as a library and is writing their serve script outside the repo:

ModuleNotFoundError: No module named 'cli'

All existing examples in docs/examples/m_serve/ use this pattern, and PR #823 adds another instance.

Expected behaviour

Serve types needed by user programs should be importable from a stable public path, e.g.:

from mellea.serve import ChatMessage

Scope

At minimum ChatMessage needs a public export path. It is worth auditing cli/serve/models.py for any other types that user-facing serve() functions are expected to use and including them in the same export.

The CLI internals can then import from mellea.serve rather than defining the types in cli/.

Affected files

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions