feat(ollama): add support for interactive ollama run sessions (#9)#153
Merged
Conversation
Add un(model, **opts) to RuntimePort with a RunResult value object. Implement it for Ollama by streaming tokens to stdout via client.generate(stream=True), supporting both a single-prompt mode and an interactive REPL loop. BaseRuntime provides a default raising NotImplementedError for unsupported runtimes. Wire a modeldock run CLI command and a ModelManager.run facade. Add unit tests with a fake RuntimePort covering the run path.
Fix CI uff format --check failure on ollama.py by collapsing the _run_single signature to a single line.
|
🎉 Congratulations @himanshu231204! Your pull request has been successfully merged into main. 🚀 Thank you for contributing to OpenAgentHQ and helping improve the project. We truly appreciate your contribution and hope to see you back with more amazing PRs! Happy Open Sourcing! ❤️ |
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.
Summary
Closes #9. Adds support for
ollama run <model>interactive sessions.run(model, **opts)toRuntimePortplus aRunResultvalue object (src/modeldock/ports/runtime.py).client.generate(stream=True), with both a single-prompt mode and an interactive REPL loop (src/modeldock/adapters/runtimes/ollama.py).BaseRuntimeprovides a defaultrun()raisingNotImplementedErrorfor runtimes that don't support interactive sessions (src/modeldock/adapters/runtimes/base.py).modeldock run <model> [--prompt ...]CLI command (src/modeldock/cli/commands/run.py,cli/app.py) and aModelManager.runfacade (src/modeldock/core/manager.py).RuntimePortcovering the run path (tests/unit/test_ollama_runtime.py,tests/conftest.py).Test plan
ruff checkcleanmypy --strictclean (67 files)pytest— 116 passed, 2 skippedmodeldock run mistral:lateststreams a real response; single-promptrun()returnsRunResult(..., ok); subscription-gated:cloudmodel returnsRunResult(..., failed(...))gracefully.Notes
domain/andports/pure (no I/O); all I/O lives in the adapter.ModelManagercall.