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
Problem
m serveuser programs must type theirserve()input parameter aslist[ChatMessage], because that is what the framework passes in. The only way to importChatMessagetoday is:cli/is not part of the installedmelleapackage. 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: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.:
Scope
At minimum
ChatMessageneeds a public export path. It is worth auditingcli/serve/models.pyfor any other types that user-facingserve()functions are expected to use and including them in the same export.The CLI internals can then import from
mellea.serverather than defining the types incli/.Affected files
cli/serve/models.py— current home ofChatMessagedocs/examples/m_serve/m_serve_example_simple.pydocs/examples/m_serve/m_serve_example_streaming.py(added in feat: streaming support in m serve OpenAI API server #823)