36 lines
1010 B
Python
36 lines
1010 B
Python
from __future__ import annotations
|
|
|
|
import time
|
|
|
|
import ollama
|
|
|
|
|
|
MODELS = ["qwen2.5:7b", "llama3.1:8b", "qwen2.5:14b"]
|
|
PROMPT = (
|
|
"Answer in Korean in exactly three bullets. Compare your usefulness for "
|
|
"local coding assistance, Korean Q&A, and careful reasoning."
|
|
)
|
|
|
|
|
|
def main() -> None:
|
|
for model in MODELS:
|
|
started = time.perf_counter()
|
|
try:
|
|
response = ollama.chat(
|
|
model=model,
|
|
messages=[
|
|
{"role": "system", "content": "Be concise and practical."},
|
|
{"role": "user", "content": PROMPT},
|
|
],
|
|
)
|
|
elapsed = time.perf_counter() - started
|
|
text = response["message"]["content"].strip().replace("\n", " ")
|
|
print(f"{model}\t{elapsed:.1f}s\t{text[:180]}")
|
|
except Exception as exc:
|
|
elapsed = time.perf_counter() - started
|
|
print(f"{model}\t{elapsed:.1f}s\tERROR: {exc}")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|