Welcome!

Programming with LLM APIs
A Beginner’s Guide in R and Python

posit::conf(2025)

2025-09-16

Welcome to Programming with LLM APIs !

  • Find a seat where you can see the screen!

  • Update your local copy of the workshop:
    posit-conf-2025.github.io/llm/setup.html

  • Join the Discord: https://pos.it/conf

  • wifi(
      network=“Posit Conf 2025”,
      password=“conf2025”
    )

🤝 Introductions 🤝

Our team: Joe Cheng, Garrick Aden-Buie, Karan Gathani, Julia Silge, Sam Clark, James Blair

Code of Conduct

Please Review: posit.co/code-of-conduct

💙 Treat everyone with respect
🧡 Everyone should feel welcome and safe

Reporting:

🗣️ any posit::conf staff member (t-shirt) or Info desk
📧 codeofconduct@posit.co

Meet each other

  • 👋 Hi, my name is …

  • 🤖 I’d call myself an AI… [skeptic, pragmatist, enthusiast]

  • ⚡ Share a moment when AI surprised you

About posit::conf(2025)

wifi(“Posit Conf 2025”, password=“conf2025”)

posit::conf(2025) Things to Know

  • 🚻 Gender-neutral bathroom: LL2 next to Chicago A

  • 🧘 Meditation/prayer room: LL2 Chicago A

  • 🤱 Lactation room: LL2 Chicago B

  • 🎉 Welcome reception: Tonight 5-7 pm, LL2 Grand Hall West

  • 🐠 Aquarium Night: Tomorrow 7-10 pm, Georgia Aquarium

posit::conf(2025) Social Media

  • Red lanyards available to those who don’t wish to be photographed

  • #PositConf2025 for all things conf

🙋 🙋‍♀️ 🙋‍♂️
Please ask questions!

About this workshop

🏡 posit-conf-2025.github.io/llm

Everything you need, in one place.

Discord

  1. Go posit.co/conference
  2. Click Login
  3. Find and click the discord banner
  4. Join us in #workshop-llm

Schedule

Time Activity
09:00 - 10:30 💬 Talking with LLMs via Code
10:30 - 11:00 Coffee break
11:00 - 12:30 💻 Programming with LLMs
12:30 - 13:30 🍽️ Lunch break
13:30 - 15:00 🔍 Augmented Generation
15:00 - 15:30 Coffee break
15:30 - 17:00 🚀 Beyond Tools

Schedule (the important bits)

Time Activity
09:00 - 10:30 💬 Talking with LLMs via Code
10:30 - 11:00 Coffee break
11:00 - 12:30 💻 Programming with LLMs
12:30 - 13:30 🍽️ Lunch break
13:30 - 15:00 🔍 Augmented Generation
15:00 - 15:30 Coffee break
15:30 - 17:00 🚀 Beyond Tools

Stickies

🟩

All good
I’m done

🟥

Not great
Need time or help

Computering

Setup

  1. Head to posit-conf-2025.github.io/llm/setup.html

  2. Clone our workshop repo posit-conf-2025/llm

  3. Open the project in Positron

  4. Install all the packages:

    • R: renv::restore()
    • Python: uv sync

We’re using Positron

File organization

_exercises/ Files for Your Turn exercises
_solutions/ Solutions to those exercises
_demos/ Files for stuff we demo
website/ The website and slides
./* Lots of project related files you can ignore

Exercise Solutions

👨‍💻 👩‍💻 _exercises/01_hello-llm/01_hello-llm.R
   🫣    _solutions/01_hello-llm/01_hello-llm.R

Also in Python:
👨‍💻 👩‍💻 _exercises/01_hello-llm/01_hello-llm.py
   📓    _exercises/01_hello-llm/01_hello-llm.pynb
   🫣    _solutions/01_hello-llm/01_hello-llm.py

Let’s Dive In!

..to our first activity!

To use an AI API…

…you need an API key!

How to get an API key, the usual way

aka. how to give OpenAI your money

  1. 🆙 Sign up for an account with OpenAI or Anthropic

  2. 💳 Add a payment method

  3. 🔑 Get an API key

  4. 💾 Store it in .Renviron or .env file
    as OPENAI_API_KEY or ANTHROPIC_API_KEY

But we’ll give you API keys to use today!

  1. Use these keys for all of our activities today

  2. Play and explore! But please be considerate :)

  3. We’ll turn them off at the end of the workshop

Your Turn 01_hello-llm

  1. 🔓 Decrypt the .env.secret.env:

    1. R: Run secret.R

    2. Python: Run make secret-decrypt in terminal
      or run uv run secret.py decrypt .env.secret > .env

  2. 🤫 The special phrase is:
    positconf2025-llm-workshop

  3. 🤖 Run the code in _exercises/01_hello-llm