Installation¶
We recommend Python 3.12+.
Install with pip¶
The core install covers only parsing and navigating taxonomies. Its dependencies are
pandas, openpyxl and dspy.
To install the current state of master rather than the latest release, point pip at
the repository instead. The same form works with any extra below, by putting the extra
before the @:
Install with an embedding backend¶
The retrieval-based approaches (linear RAG,
Rephrase-Retrieve-Respond, agentic RAG)
additionally need a vector-store backend, which is available as an optional extra. Each
extra installs chromadb together with one embedding backend. The extras are kept
separate because the embedding backends' dependencies are large — install the one you
will use:
Embeddings are computed in-process by sentence-transformers. No server, no key —
the largest download, and the one that works offline.
Embeddings are computed by a self-hosted Ollama server you point the store at with
url. Keeps the model off your machine without sending data to a vendor.
| Extra | embedding_function_type |
Embeddings computed |
|---|---|---|
local |
"sentence_transformers" |
in-process, on your machine |
ollama |
"ollama" |
by a self-hosted server |
openai |
"openai" |
by the hosted API |
Tip
The extra and the backend have to match. Constructing a VectorStore with
embedding_function_type="ollama" without rac4os[ollama] installed raises an
ImportError naming the extra to install.
Installing more than one extra is fine; they differ only in the embedding library they pull in, and the backend is chosen per store at runtime.
Editable install¶
To work on the package itself:
The language model¶
rac4os does not install or host a language model. The classifiers construct a
dspy.LM from the model_name, api_key and optional api_base you pass them, so any
provider reachable through LiteLLM model
strings works — a hosted API, a self-hosted endpoint, or a local server:
classifier = SomeClassifier(
classification_name="SPEND_2026", # base classes take classification_system=cs
model_name="openai/gpt-4o-mini", # provider/model
api_key="...",
api_base=None, # set for a self-hosted or compatible endpoint
...
)
Nothing is sent anywhere until you call a classifier.
Generation settings¶
The retrieval-based classifiers take any further keyword argument as
**generation_kwargs and forward it to dspy.LM, so the decoding parameters are set
where you build the classifier rather than through a separate LM object:
classifier = SomeClassifier(
classification_name="SPEND_2026", # base classes take classification_system=cs
model_name="openai/gpt-4o-mini",
api_key="...",
temperature=0.0, # reproducible coding decisions
max_tokens=2000, # headroom for reasoning plus the answer
cache=False, # dspy caches identical calls by default
num_retries=3, # retries on 429 and 5xx, dspy's default
seed=42, # if your provider honours it
)
temperature and max_tokens are the two that matter for classification. dspy.LM
leaves both at None unless you set them, which means the provider's own defaults
apply — so if you want coding decisions to be reproducible, set temperature=0.0
yourself rather than assuming it. Give max_tokens enough room for the reasoning as
well as the answer: a chain of thought that is cut off mid-sentence costs a call and
returns nothing usable, and an agent that runs many steps needs considerably more.
Anything dspy.LM does not name itself — top_p, stop, reasoning_effort, a
provider-specific flag — is handed on to LiteLLM, so whatever your provider accepts can
be set the same way. An argument your provider does not recognise fails at the first
call, not at construction.
Note
This applies to the two retrieval-based classifiers, BaseRAGCoT and BaseRAGAgent,
and to everything built on them, including RAGChainOfThought, RAGAgent and
RRR_RAGChainOfThought, which forward their keyword arguments down. The hierarchy
traversal agent does not take generation settings; it builds its dspy.LM from
model_name, api_key and api_base alone.