Installation
granite4:micro not found
Python 3.13: outlines install failure
outlines requires a Rust compiler. Either install Rust
or pin Python to 3.12:
Intel Mac: torch errors
Create a Conda environment, install torchvision, then install Mellea inside it:
Missing optional dependency
Ollama connectivity
Connection refused
Wrong Ollama URL
If Ollama is running on a non-default host or port, pass the URL explicitly:Requirements and sampling
Requirements always failing — output looks fine
If the model keeps retrying but the output looks correct, the validation function may be too strict. Inspect what is being rejected:return_sampling_results=True makes instruct() return a SamplingResult instead
of a ModelOutputThunk. Use result.success to check whether the budget was
exhausted without a passing output.
Budget exhausted — result.success is False
The model failed all loop_budget attempts. Options:
-
Increase
loop_budget: - Simplify or relax the requirement.
-
Provide a more specific validation function that gives the model useful feedback via
ValidationResult.reason— the reason string is passed back to the model on retry. -
Switch to
SOFAISamplingStrategyto escalate to a stronger model when the primary model fails.
PreconditionException from @generative
@generative function failed before generation. This is
intentional — the function declared that its inputs do not meet a precondition.
Check the function’s @precondition decorators and validate your inputs before calling.
Agents and tools
react() raises RuntimeError
loop_budget without finding a final answer. Either
increase the budget or check that the tool functions are returning the information
the model needs to reach a conclusion.
Tool not called / wrong tool called
If the model is not calling tools as expected:- Verify
ModelOption.TOOLSis set in the session’s model options. - Check the tool’s docstring — the model uses it to decide when to call the tool. A vague or absent docstring leads to poor tool selection.
- Use
GuardianCheck(GuardianRisk.FUNCTION_CALL)to detect function call hallucinations.
Async
RuntimeError: no running event loop
ainstruct, achat, aact) or wrap in asyncio.run()
if you are at the top level.
asyncio.run() inside a Jupyter notebook
Jupyter notebooks already run an event loop. Use await directly or install
nest_asyncio:
Guardian / safety validation
Guardian model not found
Guardian returns unexpected results
- Enable
thinking=Truefor more accurate results on ambiguous inputs. - Verify you are passing the correct
backend_type("ollama"or"huggingface"). - For groundedness checks, ensure
context_textis the reference document the response should be grounded in.
Getting more help
- GitHub Issues: github.com/generative-computing/mellea/issues
- Examples:
docs/examples/ - Enable telemetry to inspect what is happening at each step — see Metrics and Telemetry.
See also: Quick Start | Inference-Time Scaling | Security and Taint Tracking