Getting data

Last updated on 2025-10-14 | Edit this page

Estimated time: 20 minutes

Overview

Questions

  • How can I read the dataset into Python or R
  • How can I access data via an API using Python or R

Objectives

  • Read a dataset from file or fetch data via API

Before looking at the LiteLLM API, we want to make sure that we have a dataset to work with. We will be using publications data from OpenAlex. You can either load a prepared dataset (see Setup instructions) or use the API programmatically and obtain the data yourself.

Callout

You do this part on your own. Follow the instructions for your language.

Method 1: read data from file


Method 2: get data via API


Callout

For this part, we will need HTTP libraries for either Python or R. We will use the most common libraries, but if you are already familiar with another, feel free to use those.

GET vs. POST requests

The two most relevant HTTP request types for our purposes are GET and POST.

In simple words, GET requests retrieve data from the server, without sending any data, while POST requests send data and retrieve data in response.

When interacting with a language model, we are most likely going to send input data (prompts) to the server, which means we will be making POST requests. To retrieve data from OpenAlex, we will be using GET.