Skip to content

refactor(runtime)!: split model runtime protocols by capability#57

Merged
WH-2099 merged 3 commits intomainfrom
codex/split-model-runtime-protocols
Apr 21, 2026
Merged

refactor(runtime)!: split model runtime protocols by capability#57
WH-2099 merged 3 commits intomainfrom
codex/split-model-runtime-protocols

Conversation

@laipz8200
Copy link
Copy Markdown
Member

@laipz8200 laipz8200 commented Apr 20, 2026

Important

  1. Make sure you have read our contribution guidelines
  2. Search existing issues and pull requests to confirm this change is not a duplicate
  3. Open or identify the issue this pull request resolves or advances
  4. Use a Conventional Commits title for this pull request, and mark breaking changes with !
  5. Remember that the pull request title will become the squash merge commit message
  6. If CLA Assistant prompts you, sign CLA.md in the pull request conversation

Related Issue

Closes #56

Summary

This refactor breaks the monolithic model runtime contract into capability-specific protocols and moves those protocol definitions under graphon.model_runtime.protocols.

The change narrows each model wrapper to the runtime surface it actually consumes, updates Slim runtime integrations to use the new protocol package, exports the new protocol set from graphon.protocols, and makes ModelProviderFactory a provider-only abstraction backed by ModelProviderRuntime.

Breaking Changes

  • The top-level module path graphon.model_runtime.runtime is removed in favor of graphon.model_runtime.protocols.runtime.
  • Capability protocol module paths move from graphon.model_runtime.<model>_runtime to graphon.model_runtime.protocols.<model>_runtime.
  • ModelProviderFactory now accepts runtime= backed by ModelProviderRuntime instead of model_runtime= backed by the aggregate ModelRuntime.
  • ModelProviderFactory.get_model_type_instance() is removed. Callers that need invocation behavior must instantiate the appropriate model wrapper directly against the matching capability-specific runtime.
  • Custom runtime implementations that previously targeted the old monolithic module paths must update their imports to the new protocol package.
  • Downstream type integrations should now target ModelProviderRuntime, LLMModelRuntime, TextEmbeddingModelRuntime, RerankModelRuntime, SpeechToTextModelRuntime, ModerationModelRuntime, or TTSModelRuntime directly where appropriate instead of assuming a single required interface.
  • Typed integrations around SlimPreparedLLM and other LLM-facing helpers now depend on the LLM-specific runtime protocol package path.

Downstream Checklist

  • Replace imports from graphon.model_runtime.runtime with graphon.model_runtime.protocols.runtime where a full aggregate runtime is still required.
  • Replace imports from graphon.model_runtime.llm_runtime, text_embedding_runtime, rerank_runtime, speech_to_text_runtime, moderation_runtime, tts_runtime, and provider_runtime with their graphon.model_runtime.protocols.* equivalents.
  • Update ModelProviderFactory(...) call sites that passed model_runtime= to use runtime=.
  • Replace ModelProviderFactory.get_model_type_instance() usage with direct construction of LargeLanguageModel, TextEmbeddingModel, RerankModel, Speech2TextModel, ModerationModel, or TTSModel against the corresponding capability-specific runtime.
  • Update custom runtimes to implement only the capability-specific protocols they actually support.
  • Remove placeholder or stub methods that existed only to satisfy unrelated parts of the previous monolithic interface.
  • Update any factories, dependency injection bindings, or adapter registries that referenced the removed top-level protocol module paths.
  • Review typed call sites around SlimPreparedLLM, model wrappers, and provider factories to ensure they point at the new protocol package and provider-only factory boundary.
  • Search internal docs, examples, and downstream libraries for the removed module paths and migrate them to the new package structure.

Checklist

  • This pull request links the issue it resolves or advances
  • This pull request title follows Conventional Commits, and any breaking change is marked with !
  • If CLA Assistant prompted me, I signed CLA.md in the pull request conversation

Move capability-specific model runtime protocols into graphon.model_runtime.protocols and retarget model wrappers, Slim runtime helpers, and public exports to the narrower interfaces.

This removes the top-level model_runtime runtime protocol module in favor of the new protocols package layout and updates downstream-facing imports accordingly.
@laipz8200 laipz8200 marked this pull request as ready for review April 20, 2026 11:33
@dosubot dosubot Bot added the size:XL This PR changes 500-999 lines, ignoring generated files. label Apr 20, 2026
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Apr 21, 2026
41tair
41tair previously approved these changes Apr 21, 2026
@WH-2099 WH-2099 merged commit c9cb948 into main Apr 21, 2026
9 checks passed
@WH-2099 WH-2099 deleted the codex/split-model-runtime-protocols branch April 21, 2026 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Proposal: split model runtime abstractions by capability

3 participants