tidyprompt: Prompt Large Language Models and Enhance Their Functionality (original) (raw)

Easily construct prompts and associated logic for interacting with large language models (LLMs). 'tidyprompt' introduces the concept of prompt wraps, which are building blocks that you can use to quickly turn a simple prompt into a complex one. Prompt wraps do not just modify the prompt text, but also add extraction and validation functions that will be applied to the response of the LLM. This ensures that the user gets the desired output. 'tidyprompt' can add various features to prompts and their evaluation by LLMs, such as structured output, automatic feedback, retries, reasoning modes, autonomous R function calling, and R code generation and evaluation. It is designed to be compatible with any LLM provider that offers chat completion.

Version: 0.2.0
Depends: R (≥ 4.1.0)
Imports: dplyr, glue, httr2, jsonlite, stringr, utils, cli, R6, rlang
Suggests: knitr, rmarkdown, testthat (≥ 3.0.0), here, callr, skimr, jsonvalidate, tidyjson, DBI, ellmer (≥ 0.3.0), mcptools
Published: 2025-08-25
DOI: 10.32614/CRAN.package.tidyprompt
Author: Luka Koning [aut, cre, cph], Tjark Van de Merwe [aut, cph], Kennispunt Twente [fnd]
Maintainer: Luka Koning <l.koning at kennispunttwente.nl>
BugReports: https://github.com/KennispuntTwente/tidyprompt/issues
License: GPL (≥ 3) | file
URL: https://github.com/KennispuntTwente/tidyprompt,https://KennispuntTwente.github.io/tidyprompt/
NeedsCompilation: no
Materials: README, NEWS
CRAN checks: tidyprompt results

Documentation:

Downloads:

Linking:

Please use the canonical formhttps://CRAN.R-project.org/package=tidypromptto link to this page.