| 1 |
"""Ollama integration — Modelfile emission + `ollama create`/`run`. |
| 2 |
|
| 3 |
The `binary.py`, `register.py`, and |
| 4 |
`smoke.py` modules call `subprocess`; `modelfile.py` and |
| 5 |
`template_registry.py` are pure-python and fully unit-testable. |
| 6 |
""" |
| 7 |
|
| 8 |
from __future__ import annotations |
| 9 |
|
| 10 |
from dlm.export.ollama.binary import ( |
| 11 |
OLLAMA_MIN_VERSION, |
| 12 |
check_ollama_version, |
| 13 |
locate_ollama, |
| 14 |
ollama_version, |
| 15 |
) |
| 16 |
from dlm.export.ollama.errors import ( |
| 17 |
ModelfileError, |
| 18 |
OllamaBinaryNotFoundError, |
| 19 |
OllamaCreateError, |
| 20 |
OllamaError, |
| 21 |
OllamaSmokeError, |
| 22 |
OllamaVersionError, |
| 23 |
TemplateRegistryError, |
| 24 |
VerificationError, |
| 25 |
) |
| 26 |
from dlm.export.ollama.modelfile import ModelfileContext, render_modelfile |
| 27 |
from dlm.export.ollama.register import ollama_create, ollama_lock_path |
| 28 |
from dlm.export.ollama.smoke import first_line, ollama_run |
| 29 |
from dlm.export.ollama.template_registry import ( |
| 30 |
DialectTemplate, |
| 31 |
get_template, |
| 32 |
load_template_text, |
| 33 |
registered_dialects, |
| 34 |
) |
| 35 |
from dlm.export.ollama.verify import ( |
| 36 |
parse_prompt_eval_count, |
| 37 |
run_with_telemetry, |
| 38 |
verify_token_count, |
| 39 |
) |
| 40 |
|
| 41 |
__all__ = [ |
| 42 |
"DialectTemplate", |
| 43 |
"ModelfileContext", |
| 44 |
"ModelfileError", |
| 45 |
"OLLAMA_MIN_VERSION", |
| 46 |
"OllamaBinaryNotFoundError", |
| 47 |
"OllamaCreateError", |
| 48 |
"OllamaError", |
| 49 |
"OllamaSmokeError", |
| 50 |
"OllamaVersionError", |
| 51 |
"TemplateRegistryError", |
| 52 |
"VerificationError", |
| 53 |
"check_ollama_version", |
| 54 |
"first_line", |
| 55 |
"get_template", |
| 56 |
"load_template_text", |
| 57 |
"locate_ollama", |
| 58 |
"ollama_create", |
| 59 |
"ollama_lock_path", |
| 60 |
"ollama_run", |
| 61 |
"ollama_version", |
| 62 |
"parse_prompt_eval_count", |
| 63 |
"registered_dialects", |
| 64 |
"render_modelfile", |
| 65 |
"run_with_telemetry", |
| 66 |
"verify_token_count", |
| 67 |
] |