tidyllm tidyllm website

License: MIT CRAN Status

tidyllm is an R package for working with large language model APIs in data analysis workflows. It supports Anthropic Claude, OpenAI, Google Gemini, Mistral, Groq, DeepSeek, OpenRouter, TypeSafe (decision models), local models via Ollama and llama.cpp, and more, all through a single consistent interface.

Features

Installation

To install tidyllm from CRAN, use:

install.packages("tidyllm")

Or for the development version from GitHub:

devtools::install_github("edubruell/tidyllm")

Basic Example

library(tidyllm)

# Describe an image with Claude, continue with a local model
conversation <- llm_message("Describe this image.",
                             .media = img("photo.jpg")) |>
  chat(claude())

conversation |>
  llm_message("Based on that description, what research topic could this figure relate to?") |>
  chat(ollama(.model = "qwen3.5:4b"))

For more examples and advanced usage, see the Get Started vignette.

Please note: To use tidyllm you need either a local Ollama or llama.cpp installation, or an active API key for one of the supported cloud providers. See the Get Started vignette for setup instructions.

What’s new in 0.8.0

Closed questions with probabilities. decide() puts yes/no, choice and score questions to a text, an image, a recording or a PDF. It returns a tibble with one row per question, the answer and its probability. You write the questions once as a tidyllm_schema() and switch between jev(), openai(), gemini() and ollama().

questions <- tidyllm_schema(
  late = field_lgl("Was the payment late?"),
  tone = field_fct("Tone of the message", .levels = c("polite", "angry"))
)

decide("Your invoice is two weeks overdue and I am furious.", questions, jev())

Pass a character vector to code many texts in parallel. field_box() asks where something is in a picture (experimental, jev() only). The decision models article walks through it.

Read many replies at once. get_reply(), get_reply_data() and get_metadata() accept the list that parallel_chat() and fetch_batch() return.

Current provider defaults. mistral() defaults to mistral-large-4, which always reasons (.reasoning_effort of "low", "medium" or "high"). openai() accepts every reasoning effort the API names, and gemini() accepts .thinking_level = "xhigh". llamacpp() looks for the server on port 9931.

Perplexity removed. perplexity() is gone. Use Perplexity models through openrouter() and web search through websearch_tool().

Read the Changelog for the full list of changes.

Learn More

Get Started with tidyllm covers setup, your first chat and the basic verbs. Read it first, then pick the article that matches your task. The Changelog lists every change, and the documentation holds the function reference.

Start here: the common research tasks, simplest first

Go deeper: setup choices and larger builds

Similar packages

Contributing

Contributions are welcome. Open an issue or a pull request on GitHub.

License

This project is licensed under the MIT License; see the LICENSE file for details.