hermes.llm

Models

Systems receive an LLM client, so experiments choose the model. Completions can be cached on disk, so a rerun replays the same outputs.

Clients

from hermes import llm

client = llm.create(provider="ollama", model="llama3.1", cache=".cache/llm")
text = client.complete(prompt, system="...")

Every client has complete(prompt, system), model, and provider. llm.create builds one from a config's llm section; llm.from_env() builds the default from environment variables. Temperature is 0. Source: llm.py.

Ollama

VariableDefault
HERMES_OLLAMA_BASE_URLhttp://127.0.0.1:11434
HERMES_OLLAMA_MODELchosen from installed models: llama3.1, llama3, mistral, phi3, qwen2.5, qwen, then the first installed

The timeout is 180 seconds. Connection failures, timeouts, and missing models raise LookupError with the command to fix them.

OpenAI-compatible

VariableDefault
HERMES_LLM_PROVIDERset to openai to select this client
HERMES_LLM_API_KEYrequired
HERMES_LLM_BASE_URLhttps://api.together.xyz/v1
HERMES_LLM_MODELmeta-llama/Meta-Llama-3.1-8B-Instruct-Turbo

The timeout is 60 seconds.

Cache and retries

CachedLLM stores each completion as a JSON file keyed by a hash of the provider, model, system prompt, and prompt, and counts calls and cache hits for run.json. Both clients retry up to three attempts on read errors and on HTTP 429, 502, 503, and 504, with backoff.