Changelog
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
[0.4.1] - 2026-07-06
Changed
Updated project metadata
[0.4.0] - 2025-07-06
A major redesign that unifies the two previous classifier classes
(OllamaClassifier and LLMClassifier) into a single backend-agnostic
LLMClassifier backed by a unified LLMBackend ABC, and introduces two
distinct confidence scoring methods. This release contains breaking
changes.
Added
OllamaBackend— inference backend for the Ollama runtime (≥v0.12), using the native Ollama SDK behind the unifiedLLMBackendinterfaceAdaptive
generate()with budget-controlledmax_calls:1for fast/approximate,Kfor adaptive resolution,Nonefor exact. Makes 1 tomax_callsconstrained API calls and reconstructs per-label logprobs from a prefix trie over label tokenscoverage(per-label fraction of tokens scored) andn_calls(API calls made) fields onClassificationResultmethodfield onClassificationResult("adaptive_generate"or"multi_call") andapproximateflagollama_classifier.scoringmodule with geometric-mean normalization, prefix-trie, divergence-aware scoring, and cluster resolutionsupports_bare_label_constraintproperty onLLMBackendto drive context-dependent tokenization (bare labels vs. JSON-wrapped labels)Comprehensive test suite (52 tests, including integration tests with mocked backends)
Parallelized batch methods (sync via thread pool, async via
asyncio.gather)
Changed
BREAKING:
generate()now returns aClassificationResult(was astrin 0.3.0)BREAKING: Unified into a single
LLMClassifierclass. The oldOllamaClassifier(fromclassifier.py) and the oldLLMClassifier(fromllm_classifier.py) are replaced by oneLLMClassifierthat accepts anyLLMBackendBREAKING:
classify()rewritten: now uses multi-call completion scoring with geometric-mean normalization, eliminating the concentration (token-count) bias present in earlier versions. Makes N calls for N labelsClassificationResultis now a PydanticBaseModel(was a dataclass)httpxandpydanticare now required dependencies (were optional under the[backends]extra)ollamaPython SDK is now an optional dependency, installed via the[ollama]extra (only required when usingOllamaBackend)All backends now communicate via HTTP using the OpenAI-compatible API and implement
chat(),score(),tokenize(), and their async variants
Fixed
Concentration bias (token-count bias) in confidence scoring — fixed by applying geometric-mean normalization across both
generate()andclassify()Silent
0.0logprob fallback for unscored tokens — unscored tokens now use-infso they are correctly handled by softmaxCode duplication between
OllamaClassifierand the oldLLMClassifier— eliminated by the unified architecture
Removed
OllamaClassifierclass (replaced byLLMClassifier+OllamaBackend)Old
LLMClassifierfromllm_classifier.py(replaced by the unifiedLLMClassifierinclassifier.py)[backends]optional dependency group (httpxis now a core dependency)
[0.3.0] - 2025-04-27
Added
LLMClassifier— a generic, backend-agnostic classifier that works with any inference engineVLLMBackend— inference backend for vLLM (local and remote)SGLangBackend— inference backend for SGLang (local and remote)LlamaCppBackend— inference backend for llama.cpp server (local and remote)ollama_classifier.backendspackage withLLMBackendabstract base class[backends]optional dependency group (httpx) for non-Ollama enginesdocs/backends.rst— dedicated documentation page for inference backends
Changed
Bumped package version to 0.3.0
[0.1.0] - 2024-01-01
Added
Initial release
OllamaClassifierclass with sync and async methodsConstrained output generation using JSON schema
Two scoring methods: fast (single-call) and complete (multi-call with softmax)
Batch processing support
Support for simple labels and labels with descriptions
Custom system prompt support
ClassificationResultdataclass for structured results