tidyverse/ellmer

Call LLM APIs from R

What it solves

ellmer provides a unified, easy-to-use interface for integrating large language models (LLMs) into the R programming language. It removes the complexity of managing multiple different API providers and authentication methods, allowing R users to switch between models from various cloud providers or local LLMs without rewriting their code.

How it works

The package uses stateful R6 objects to manage conversations. Users create a chat object using a provider-specific function (e.g., chat_openai() or chat_ollama()), which maintains the conversation history (context) across multiple queries. It supports multiple interaction modes: an interactive chat console for direct communication, a programmatic method call for script-based interaction, and the support for multimodal inputs like images via content_image_file() and content_image_url().

Who it’s for

It is designed for R users, data scientists, and researchers who want to leverage LLMs for data analysis, code generation, or application development within their R environment.

Highlights

  • Broad Provider Support: Supports a wide range of official providers (Anthropic, OpenAI, Google, AWS Bedrock, Azure OpenAI, Databricks, Snowflake) and community-supported providers (Groq, Mistral, Hugging Face, etc.).
  • Flexible Interaction: Offers both a live interactive console and programmatic access.
  • Advanced LLM Features: Implements streaming outputs, tool/function calling, and structured data extraction.
  • Seamless Authentication: Automatically detects OAuth or IAM-based credentials for major cloud providers.
  • Local LLM Integration: Integrates with Ollama for running models locally to ensure data privacy and zero cost.

Related

  • Project
  • Project
  • Project
  • Project
  • Project