feat(models): add Ollama backend with localhost support#42
Open
54k wants to merge 2 commits into
Open
Conversation
…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
Author
|
@microsoft-github-policy-service agree |
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
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_bodyfor arbitrary paramssrc/webwright/models/_chat_utils.py— shared serialization helpers (deduplicated from openrouter_model.py)src/webwright/config/model_ollama.yamlsrc/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_MAPPINGUsage
python -m webwright.run.cli -c base.yaml -c model_ollama.yaml -t "web task" --start-url https://example.comTested
Kali WSL2 with Ollama cloud models — imports, configs, and end-to-end flow.