Webwright icon indicating copy to clipboard operation
Webwright copied to clipboard

feat(models): add Ollama backend with localhost support

Open 54k opened this issue 6 months ago • 1 comments

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.

54k avatar Jun 01 '26 23:06 54k

@microsoft-github-policy-service agree

54k avatar Jun 01 '26 23:06 54k