Create Your First AI Assistant — OpenAI Assistant API

Shweta Lodha
4 min readNov 16, 2023

Last week OpenAI announced a whole bunch of new features. Out of those, some are game-changing ones like extremely high context length with GPT-4 turbo, reduced prices of existing models, Assistant API, Vision API with GPT 4 turbo, Dall.E API and, lot more. So, out of all those, let’s have a closer look at the Assistant API today and see how we can create our own assistant in just a few lines of code.

Using Assistant API, we can build AI assistants in our own applications with just few sets of instructions.

Before we get started, make sure that you have installed the OpenAI, a python library. Let’s get started by grabbing the keys.

Get OpenAI API Key And Organization ID

To get the keys, you need to go to https://openai.com/, login and then grab the keys using highlighted way.

Here we need to grab 2 things — API key and Organization ID

Then set these values in an environment variable:

import os
os.environ["ORGANIZATION_ID"] = "ORG_ID_HERE"
os.environ["OPENAI_API_KEY"] = "API_KEY_HERE"

Import Required Packages And Create Client Object

--

--

Shweta Lodha
Shweta Lodha

Responses (3)