Skip to content

Code-along | 2024-06-11 | Creating AI Assistants with GPT-4o | Richie Cotton

Create a GPT-4o file search assistant that summarizes and explains arxiv papers about AGI.

The flow of this session is largely taken from the DataCamp OpenAI Assistants API Tutorial and the OpenAI Assistants API documentation.

Notes
  • OpenAI considers this much of this code experimental, so expect some changes in the coming months.

Before you begin

  • Make sure you have an OpenAI developer account.
  • Your OpenAI developer account has credit on it.
  • Define an environment variable named OPENAI_API_KEY containing the API key.

Task 0: Setup

First we need to make sure that we are using the latest version of the OpenAI API package.

# Run this to install the latest version of the OpenAI package
!pip install openai==1.33.0
Hidden output

We need the os, openai, and pandas packages.

Instructions

  • Import the os and openai packages without an alias.
  • Import the pandas package with its usual alias.
# Import the os package


# Import the openai package


# Import the pandas package with an alias

We need to define an OpenAI client.

Instructions

  • Define an OpenAI client. Assign to client.
# Define an OpenAI client. Assign to client.

Task 1: Upload the Papers