Skip to content

feat(models): add Ollama backend with localhost support#42

Open
54k wants to merge 2 commits into
microsoft:mainfrom
54k:add-ollama-backend
Open

feat(models): add Ollama backend with localhost support#42
54k wants to merge 2 commits into
microsoft:mainfrom
54k:add-ollama-backend

Conversation

@54k

@54k 54k commented Jun 1, 2026

Copy link
Copy Markdown

Summary

Adds a new model backend for Ollama (local + cloud-hosted) via /v1/chat/completions.

Why

Enables running Webwright with self-hosted models — no API keys needed for local Ollama instances.

Changes

New files

  • src/webwright/models/ollama_model.py — auto-skips API key on localhost, ollama_extra_body for arbitrary params
  • src/webwright/models/_chat_utils.py — shared serialization helpers (deduplicated from openrouter_model.py)
  • src/webwright/config/model_ollama.yaml
  • src/webwright/config/model_ollama_fast.yaml (reasoning_effort=none)
  • src/webwright/config/model_ollama_reason.yaml (reasoning_effort=high)
  • src/webwright/config/model_ollama_qwen.yaml (Qwen3-Coder 80B example)

Modified

  • src/webwright/models/__init__.py — +1 line registering ollama in MODEL_MAPPING

Usage

python -m webwright.run.cli -c base.yaml -c model_ollama.yaml -t "web task" --start-url https://example.com

Tested

Kali WSL2 with Ollama cloud models — imports, configs, and end-to-end flow.

…ble inference params

Adds a new model backend for Ollama (local + cloud-hosted) using the standard
/v1/chat/completions endpoint. No API key required for local instances.

Key features:
- Auto-skips API key check on localhost endpoints
- ollama_extra_body config key passes arbitrary params (reasoning_effort,
  num_ctx, seed, etc.) directly to the Ollama API payload
- Reuses shared chat-completions serialization helpers in _chat_utils.py
- Four ready-to-use config presets: default, fast (no reasoning),
  reason (high reasoning), qwen (Qwen3-Coder 80B)

Files:
- src/webwright/models/_chat_utils.py — shared serialization helpers
- src/webwright/models/ollama_model.py — Ollama backend implementation
- src/webwright/models/__init__.py — register ollama in MODEL_MAPPING
- src/webwright/config/model_ollama*.yaml — config presets
@54k

54k commented Jun 1, 2026

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

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.

1 participant