Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

1.6 KB
Raw Blame
"""Verify real Ollama inference over the bundled Compose service network.

Run inside the LDR container after explicitly pulling qwen2.5:0.5b in Ollama.
This checks container DNS, the configured endpoint, model availability and
inference transport. It is not a research-quality benchmark.
"""

import os

import requests


MODEL = "qwen2.5:0.5b"


def main():
    endpoint = os.environ["LDR_LLM_OLLAMA_URL"].rstrip("/")
    with requests.Session() as client:
        client.trust_env = False
        response = client.get(endpoint + "/api/tags", timeout=10)
        response.raise_for_status()
        model = next(
            item for item in response.json()["models"] if item["name"] == MODEL
        )
        assert model["digest"], "Pulled model has no manifest digest"
        response = client.post(
            endpoint + "/api/generate",
            json={
                "model": MODEL,
                "prompt": "Reply with the word ready.",
                "stream": False,
                "keep_alive": 0,
                "options": {
                    "num_predict": 8,
                    "num_ctx": 1024,
                    "temperature": 0,
                },
            },
            timeout=300,
        )
        response.raise_for_status()
        result = response.json()
        assert result["done"] is True, "Ollama did not complete inference"
        assert result["response"].strip(), "Ollama returned no generated text"
        assert result["eval_count"] > 0, "Ollama generated no tokens"
    print(f"Compose inference passed: {MODEL}, digest={model['digest']}")


if __name__ == "__main__":
    main()