Sitemap
TDS Archive

An archive of data science, data analytics, data engineering, machine learning, and artificial intelligence writing from the former Towards Data Science Medium publication.

Member-only story

Cracking Open the OpenAI (Python) API

A complete beginner-friendly introduction with example code

12 min readJul 21, 2023

--

Press enter or click to view image in full size
Photo by Martin Sanchez on Unsplash

This is the 2nd article in a series on using Large Language Models (LLMs) in practice. Here I present a beginner-friendly introduction to the OpenAI API. This allows you to go beyond restrictive chat interfaces like ChatGPT and to get more out of LLMs for your unique use cases. Python example code is provided below and at the GitHub repository.

Table of Contents:

  1. What’s an API?
  2. OpenAI’s (Python) API
  3. Getting Started (4 Steps)
  4. Example Code

In the first article of this series, I described Prompt Engineering as the most accessible way to use LLMs in practice. The easiest (and most popular) way to do this is via tools like ChatGPT, which provide an intuitive, no-cost, and no-code way to interact with an LLM.

However, this ease of use comes at a cost. Namely, the chat UI is restrictive and does not translate well to many practical use…

--

--

TDS Archive
TDS Archive

Published in TDS Archive

An archive of data science, data analytics, data engineering, machine learning, and artificial intelligence writing from the former Towards Data Science Medium publication.