Metadata-Version: 2.5
Name: somm
Version: 0.20.1
Summary: somm — self-hosted LLM telemetry, routing, and intelligence loop (library)
Project-URL: Homepage, https://github.com/lavallee/somm
Project-URL: Repository, https://github.com/lavallee/somm
Project-URL: Issues, https://github.com/lavallee/somm/issues
Project-URL: Changelog, https://github.com/lavallee/somm/blob/main/CHANGELOG.md
Author: Marc Lavallee
License: MIT
Classifier: Development Status :: 4 - Beta
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.12
Requires-Dist: httpx>=0.27
Requires-Dist: somm-core==0.20.1
Provides-Extra: chatgpt
Requires-Dist: filelock>=3.16; extra == 'chatgpt'
Requires-Dist: pyjwt[crypto]>=2.10; extra == 'chatgpt'
Provides-Extra: jsonschema
Requires-Dist: jsonschema>=4; extra == 'jsonschema'
Provides-Extra: litellm
Requires-Dist: litellm>=1.50; extra == 'litellm'
Provides-Extra: otel
Requires-Dist: opentelemetry-api>=1.20; extra == 'otel'
Requires-Dist: opentelemetry-exporter-otlp-proto-http>=1.20; extra == 'otel'
Requires-Dist: opentelemetry-sdk>=1.20; extra == 'otel'
Provides-Extra: postgres
Requires-Dist: psycopg[binary]>=3.2; extra == 'postgres'
Provides-Extra: pydantic
Requires-Dist: pydantic>=2; extra == 'pydantic'
Provides-Extra: tokenizers
Requires-Dist: tiktoken>=0.7; extra == 'tokenizers'
Description-Content-Type: text/markdown

# somm

**Self-hosted LLM telemetry, routing, and intelligence loop.**

The main library: `SommLLM` — one call wraps telemetry, provider routing
across ten providers, tool calling, streaming, embeddings, multimodal
dispatch, cost tracking, budget gates, online evaluation, durable eval
gates, prompt optimization proposals, experiment campaigns, and
cross-project model memory (the sommelier). It also exposes a neutral
one-attempt harness API for Claude Code, Codex, and OpenCode so task runners
do not reimplement CLI and event-stream adapters. Zero-config, privacy-first,
no phone-home.

```python
import somm

llm = somm.llm(project="my_app")
result = llm.generate(prompt="Reply with exactly: pong", workload="ping")
print(result.text, result.provider, result.cost_usd)
```

Async code can call `await llm.agenerate(...)`, `await llm.aembed(...)`,
`await llm.agenerate_structured(...)`, or iterate `llm.astream(...)`. These
methods use the same synchronous routing, embedding, governance, and telemetry
paths without blocking the caller's event loop.

```python
from somm import harnesses
from somm.harnesses import HarnessRequest

result = harnesses.run("codex", HarnessRequest(
    prompt="Fix the failing tests",
    cwd="~/src/my-project",
    capture_dir="./runs/task-1",
))
print(result.outcome, result.final_text)
```

Full documentation, design docs, and examples live in the
[somm repository](https://github.com/lavallee/somm).

### New-project Ollama default and text-only Claude CLI calls

The Ollama default remains `qwen3:8b` for compatibility; Somm does not
automatically substitute an installed model. If it is absent, install it with
`ollama pull qwen3:8b`, or run `ollama list` and select an installed generation
model using `SOMM_OLLAMA_MODEL`, `[tool.somm].ollama_model` in pyproject.toml,
or the per-call `--model` / `model=` option. A 404 now includes this guidance.

Claude CLI retains its existing agent/tool behavior by default, even though
Somm exposes a single-shot generation interface. For untrusted text, explicitly
disable built-in tools, MCP configuration, and setting sources:

```sh
somm generate --provider claude-cli --claude-cli-text-only --json "Summarize this text"
```

```python
result = llm.generate(
    untrusted_text,
    provider="claude-cli",
    claude_cli_text_only=True,
    allow_fallback=False,
)
```

This passes `--tools '' --strict-mcp-config --setting-sources ''` as literal
argv entries. It requires a Claude CLI provider pin and disabled fallback.
Remove configured `claude_cli_extra_args` / `SOMM_CLAUDE_CLI_ARGS` first:
combining arbitrary CLI arguments with this mode is rejected. This mode controls
CLI tool access; it is not an operating-system sandbox.

`somm generate` exits 0 only for an OK result, and nonzero for failed outcomes,
including empty responses. JSON results retain `ok`, `outcome`, and
`error_kind`, and include `error_detail` for actionable diagnostics.
