Skip to main content

r-ellmer

Use when code loads or uses ellmer (library(ellmer), chat_openai, chat_claude, chat_ollama), chatting with LLMs from R, building chatbots, or extracting structured data from text with LLMs

跳到安装

来源信息

仓库
arthurgailes/r-package-skills
最近来源活动
2026年4月24日 15:12
检测到的 SKILL.md 语言
英语
星标
21
分支
1

安装方式

默认使用会先检查来源的 Prompt;你也可以切换为直接命令,或下载本地副本。

检查来源文件

决定是否安装前,请先阅读 SKILL.md,以及 SkillsMP 当前展示的配套文件。

文件资源管理器
4 个文件

正在显示 SKILL.md

SKILL.md
来源说明 · 只读预览
name
r-ellmer
description
Use when code loads or uses ellmer (library(ellmer), chat_openai, chat_claude, chat_ollama), chatting with LLMs from R, building chatbots, or extracting structured data from text with LLMs
# ellmer: R Interface to Large Language Models ## Overview **ellmer is the hub of the R AI stack.** Provides unified interface to 20+ LLM providers (OpenAI, Claude, Ollama, etc.) with stateful chat sessions, tool calling, and token tracking. **Install:** `install.packages("ellmer")` **API keys:** Set `OPENAI_API_KEY` or `ANTHROPIC_API_KEY` in `.Renviron` ## References Read `references/API.md` before writing code. - `references/API.md` - Complete function reference - `references/getting-started.md` - Core workflow and chat patterns - `references/tool-calling.md` - Tool registration and function calling ## When to Use - Chat with any LLM from R - Create custom chatbots with domain knowledge - Extract structured data from unstructured text - Need multi-provider support (switch between OpenAI/Claude/Ollama) - Build LLM-powered R applications ## When NOT to Use - Single one-off HTTP request (use httr2) - Need streaming with custom callbacks - Non-chat ML workflows (use tidymodels) ## Quick Reference ```r # Create chat chat <- chat_openai(model = "gpt-4o") chat <- chat_claude(model = "claude-sonnet-4") chat <- chat_ollama(model = "llama3.2") # Local # Chat (stateful - history preserved) chat$chat("Explain this error") chat$chat("How do I fix it?") # Remembers context # Fresh conversation chat <- chat_openai() # New = no history # Track costs token_usage() # Tool calling chat$set_tools(btw_tools()) # See r-btw skill ``` ## Common Mistakes | Issue | Solution | |-------|----------| | Forgot API key | Set in `.Renviron`, restart R | | Ollama connection error | Run `ollama serve` first | | Conversation too long/expensive | Start fresh chat for new topics | | Expecting accuracy | LLMs for prototyping, not critical work | | Using chat for single request | Just use httr2 for one-off calls | ## Use Cases **Custom chatbots:** Preload with documentation, package info, educational materials **Structured data extraction:** Sentiment analysis, geocoding, recipe parsing, document indexing **Programming assistance:** Code modernization, documentation lookup, explanation, security analysis **Other:** Alt text generation, statistical reasoning, brand style guide enforcement ## Advanced See `references/` for: - **API.md**: Complete function reference (all providers, models, methods) - **getting-started.md**: Core vocabulary, tokens, system prompts - **tool-calling.md**: Tool/function calling patterns ## Integration **With btw (context tools):** See r-btw skill **With ragnar (RAG):** See r-ragnar skill **With vitals (evaluation):** See r-vitals skill **Cross-package patterns:** See r-ai meta-skill
在 GitHub 查看