If running on an Intel mac, you may get errors related to torch/torchvision versions. Conda maintains updated versions of these packages. You will need to create a conda environment and run
conda install 'torchvision>=0.22.0' (this should also install pytorch and torchvision-extra). Then, you should be able to run uv pip install mellea. To run the examples, you will need to use python <filename> inside the conda environment instead of uv run --with mellea <filename>.If you are using python >= 3.13, you may encounter an issue where outlines cannot be installed due to rust compiler issues (
error: can't find Rust compiler). You can either downgrade to python 3.12 or install the rust compiler to build the wheel for outlines locally.Mellea supports many other models and backends. By default, a new Mellea
session will run IBM’s capable Granite 4 (3B) model on your own laptop. This is a
good (and free!) way to get started. If you would like to try out other models
or backends, you can explicitly specify the backend and model in the
start_session method. For example,
mellea.start_session(backend_name="ollama", model_id=mellea.model_ids.IBM_GRANITE_3_3_8B).user_variables. These are filled by treating the instruction description as a jinja template.
The m.instruct() function returns a ModelOutputThunk per default, which has the model output string bound to the field .value.
While this was a quick start to run a simple request, let’s look into more into the more advanced idea of validation on the next page…