Prompt Large Language Models and Enhance Their Functionality
Add an image to a tidyprompt (multimodal)
Add a message to a chat history
Add text to a tidyprompt
Make LLM answer as a boolean (TRUE or FALSE)
Make LLM answer as a category
Make LLM answer as an integer (between min and max)
Make LLM answer as JSON (with optional schema; structured output)
Make LLM answer as a list of key-value pairs
Make LLM answer as a list of items
Build prompt for categorizing a text into multiple categories
Make LLM answer as a named list
Make LLM answer match a specific regex
Make LLM answer as a constrained text response
Set chain of thought mode for a prompt
Set ReAct mode for a prompt
Enable LLM to draft and execute R code
Enable LLM to draft and execute SQL queries on a database
Enable LLM to call R functions (and/or MCP server tools)
Method for chat_history() when the input is a single string
Method for chat_history() when the input is a data.frame
Default method for chat_history()
Create or validate chat_history object
Construct prompt text from a tidyprompt object
Convert a dataframe to a string representation
Function to extract a specific element from a list
Get the chat history of a tidyprompt object
Get prompt wraps from a tidyprompt object
Check if object is a tidyprompt object
Create an llm_break_soft object
Create an llm_break object
Create an llm_feedback object
Create a new LLM provider from an ellmer::chat() object
Create a new Google Gemini LLM provider
Create a new Groq LLM provider
Create a new Mistral LLM provider
Create a new Ollama LLM provider
Create a new OpenAI LLM provider
Create a new OpenRouter LLM provider
Create a new XAI (Grok) LLM provider
LlmProvider R6 Class
Have LLM check the result of a prompt (LLM-in-the-loop)
PersistentChat R6 class
Wrap a prompt with functions for modification and handling the LLM res...
Create a provider-level prompt wrap
Make evaluation of a prompt stop if LLM gives a specific response
Generate an example object from a JSON schema
Send a prompt to a LLM provider
Set the chat history of a tidyprompt object
Set system prompt of a tidyprompt object
Skim a dataframe and include labels and levels
Tidyprompt R6 Class
tidyprompt: Prompt Large Language Models and Enhance Their Functionali...
Create a tidyprompt object
Add tidyprompt function documentation to a function
Extract documentation from a function
Have user check the result of a prompt (human-in-the-loop)
Convert a named or unnamed list/vector to a string representation
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.
Useful links