Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## [Unreleased]

- Aligns the default local Ollama answer model with the city-core installer
pull set by using `gemma4:e4b` when `CIVICCODE_OLLAMA_MODEL` is unset.
- Hardened the existing CivicClerk ordinance-event intake route with an
optional shared-intake authorization header for city-core service-to-service
handoff calls, without broadening trusted staff-header access for the rest of
Expand Down
2 changes: 1 addition & 1 deletion civiccode/ai_answer.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def load_local_llm_config() -> LocalLLMConfig | None:
return LocalLLMConfig(
provider="ollama",
base_url=(base_url or "http://127.0.0.1:11434").rstrip("/"),
model=os.environ.get("CIVICCODE_OLLAMA_MODEL", "llama3.1:8b").strip() or "llama3.1:8b",
model=os.environ.get("CIVICCODE_OLLAMA_MODEL", "gemma4:e4b").strip() or "gemma4:e4b",
timeout_seconds=float(os.environ.get("CIVICCODE_OLLAMA_TIMEOUT_SECONDS", "20")),
)

Expand Down
13 changes: 13 additions & 0 deletions tests/test_milestone_7_citation_grounded_qa.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
from conftest import build_suite_staff_headers
from httpx import ASGITransport, AsyncClient

from civiccode.ai_answer import load_local_llm_config


ROOT = Path(__file__).resolve().parents[1]

Expand Down Expand Up @@ -193,6 +195,17 @@ def log_message(self, format: str, *args: object) -> None: # noqa: A002
assert "Source:" in payload["answer"]


def test_local_ollama_default_model_matches_city_core_pull(monkeypatch: pytest.MonkeyPatch) -> None:
monkeypatch.setenv("CIVICCODE_AI_MODE", "ollama")
monkeypatch.delenv("CIVICCODE_OLLAMA_MODEL", raising=False)
monkeypatch.delenv("CIVICCODE_OLLAMA_URL", raising=False)

config = load_local_llm_config()

assert config is not None
assert config.model == "gemma4:e4b"


def _ollama_generate_available() -> bool:
body = json.dumps(
{
Expand Down
Loading