- Removed references to llamacpp from configuration files, scripts, and documentation, streamlining the LLM setup process to focus solely on Ollama. - Updated environment variables and paths to eliminate llamacpp-related entries, ensuring clarity in the configuration. - Adjusted CLI commands and help messages to reflect the removal of llamacpp, enhancing user experience and reducing confusion. - Revised documentation to provide clear guidance on using Ollama exclusively, including updates to setup instructions and runtime options.
58 lines
1.7 KiB
Python
58 lines
1.7 KiB
Python
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
from gpu_rent.llm_runtime import (
|
|
decide_runtime,
|
|
normalize_runtime,
|
|
parse_ollama_models,
|
|
write_ollama_models_preset,
|
|
)
|
|
|
|
|
|
def test_normalize_runtime():
|
|
assert normalize_runtime(None) == "none"
|
|
assert normalize_runtime("OLLAMA") == "ollama"
|
|
with pytest.raises(ValueError):
|
|
normalize_runtime("llamacpp")
|
|
with pytest.raises(ValueError):
|
|
normalize_runtime("foo")
|
|
|
|
|
|
def test_decide_runtime_flags_win():
|
|
assert (
|
|
decide_runtime(flag=None, ollama_flag=True, from_config="none") == "ollama"
|
|
)
|
|
assert (
|
|
decide_runtime(flag="ollama", ollama_flag=False, from_config="none") == "ollama"
|
|
)
|
|
assert decide_runtime(flag=None, ollama_flag=False, from_config="ollama") == "ollama"
|
|
|
|
|
|
def test_parse_ollama_models(tmp_path: Path):
|
|
path = tmp_path / "m.yaml"
|
|
path.write_text(
|
|
"models:\n - name: huihui_ai/qwen2.5-abliterate:7b\n default: true\n - qwen2.5:3b\n",
|
|
encoding="utf-8",
|
|
)
|
|
entries = parse_ollama_models(path)
|
|
assert [e.name for e in entries] == [
|
|
"huihui_ai/qwen2.5-abliterate:7b",
|
|
"qwen2.5:3b",
|
|
]
|
|
assert entries[0].default is True
|
|
|
|
|
|
def test_parse_empty_manifest(tmp_path: Path):
|
|
path = tmp_path / "empty.yaml"
|
|
path.write_text("models: []\n", encoding="utf-8")
|
|
assert parse_ollama_models(path) == []
|
|
assert parse_ollama_models(tmp_path / "missing.yaml") == []
|
|
|
|
|
|
def test_write_preset(tmp_path: Path):
|
|
path = tmp_path / "out.yaml"
|
|
write_ollama_models_preset(path, "recommended")
|
|
entries = parse_ollama_models(path)
|
|
assert entries[0].name == "huihui_ai/qwen2.5-vl-abliterated:7b"
|