Skip to content

feat(ollama): add support for interactive ollama run sessions (#9)#153

Merged
bityodha merged 2 commits into
mainfrom
feature/ollama-run
Jul 18, 2026
Merged

feat(ollama): add support for interactive ollama run sessions (#9)#153
bityodha merged 2 commits into
mainfrom
feature/ollama-run

Conversation

@himanshu231204

@himanshu231204 himanshu231204 commented Jul 18, 2026

Copy link
Copy Markdown
Member

Summary

Closes #9. Adds support for ollama run <model> interactive sessions.

  • Add run(model, **opts) to RuntimePort plus a RunResult value object (src/modeldock/ports/runtime.py).
  • Implement for Ollama by streaming tokens to stdout via client.generate(stream=True), with both a single-prompt mode and an interactive REPL loop (src/modeldock/adapters/runtimes/ollama.py).
  • BaseRuntime provides a default run() raising NotImplementedError for runtimes that don't support interactive sessions (src/modeldock/adapters/runtimes/base.py).
  • Wire a modeldock run <model> [--prompt ...] CLI command (src/modeldock/cli/commands/run.py, cli/app.py) and a ModelManager.run facade (src/modeldock/core/manager.py).
  • Unit tests with a fake RuntimePort covering the run path (tests/unit/test_ollama_runtime.py, tests/conftest.py).

Test plan

  • ruff check clean
  • mypy --strict clean (67 files)
  • pytest — 116 passed, 2 skipped
  • Live daemon verified: modeldock run mistral:latest streams a real response; single-prompt run() returns RunResult(..., ok); subscription-gated :cloud model returns RunResult(..., failed(...)) gracefully.

Notes

  • Keeps domain/ and ports/ pure (no I/O); all I/O lives in the adapter.
  • No business logic in the CLI; it only translates argv into a ModelManager call.

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.
@bityodha
bityodha merged commit 7893cf6 into main Jul 18, 2026
29 checks passed
@github-actions

Copy link
Copy Markdown

🎉 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! ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ollama: add support for ollama run interactive sessions

2 participants