Generative AI with LangChain, RStudio, and just enough Python

LangChain is one of the hottest development platforms for creating applications that use generative AI—but it’s only available for Python and JavaScript. What to do if you’re an R programmer who wants to use LangChain?

Fortunately, you can do lots of useful things in LangChain with pretty basic Python code. And, thanks to the reticulate R package, R and RStudio users can write and run Python in the environment they’re comfortable with—including passing objects and data back and forth between Python and R.

In this LangChain tutorial, I’ll show you how to work with Python and R to access LangChain and OpenAI APIs. This will let you use a large language model (LLM)—the technology behind ChatGPT—to query ggplot2‘s 300-page PDF documentation. Our first sample query: “How do you rotate text on the x-axis of a graph?”

To read this article in full, please click here