rollama: An R package for using generative large language models through Ollama
Johannes B. Gruber, Maximilian Weber
TL;DR
The paper proposes rollama, an R wrapper around Ollama, to enable private, reproducible, locally run Generative Large Language Models using open-source models. It integrates a Docker-based Ollama deployment with an R interface that exposes query and chat for single-turn and conversational interactions, plus model pulling and seed-based reproducibility. The work demonstrates practical workflows for text annotation, multimodal interaction, and text embeddings, highlighting the ability to generate deterministic outputs and embeddings without relying on proprietary APIs. This has significant implications for privacy-preserving, transparent NLP research in R, supported by learning materials and tutorials to lower adoption barriers.
Abstract
rollama is an R package that wraps the Ollama API, which allows you to run different Generative Large Language Models (GLLM) locally. The package and learning material focus on making it easy to use Ollama for annotating textual or imagine data with open-source models as well as use these models for document embedding. But users can use or extend rollama to do essentially anything else that is possible through OpenAI's API, yet more private, reproducible and for free.
